PfSense als load balancer (Multi-WAN Version 1.2.x)

Aus ConfigWiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Using the pfSense Wizard)
(Konfiguration)
 
(8 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 94: Zeile 94:
 
* DHCP y  
 
* DHCP y  
 
* DHCP start address 192.168.0.100
 
* DHCP start address 192.168.0.100
* DHCP end address 192.168.0.10
+
* DHCP end address 192.168.0.200
  
 
==Setting up routers==
 
==Setting up routers==
Zeile 101: Zeile 101:
 
==Using the pfSense Wizard==
 
==Using the pfSense Wizard==
  
* Go to http://192.168.0.1 (LAN IP)
+
* im Browser http://192.168.0.1 (LAN IP) aufrufen
* Select System - Setup Wizard from the menu
+
* Setup Wizard ausführeh
  
General parameters screen
+
Grundlegende Einstellungen
  
 
* hostname
 
* hostname
Zeile 112: Zeile 112:
 
* Allow DNS server list to be overridden by DHCP/PPP on WAN
 
* Allow DNS server list to be overridden by DHCP/PPP on WAN
  
Note: it is important to use one from each (or use a public DNS service) or you will loose internet access when one or other connections fails.
+
Hinweis, Es ist wichtig von jeder Internetverbindung einen zu nehmen, oder Öffentliche zu verwenden.
  
 
* time server DNS name
 
* time server DNS name
Zeile 124: Zeile 124:
  
 
password and reboot
 
password and reboot
 +
 +
Es ist zu beachten, daß der Loadbalancer nicht mit PPPoE-Verbindungen zusammenarbeitet. Ein einfaches DSL-Modem eignet sich nicht dafür, es muß also ein DSL-Router eingesetzt und statische IPs im Interface eingetragen werden.
  
 
==OPT1, OPT2.OPTn  interface==
 
==OPT1, OPT2.OPTn  interface==
Optional 1 (WAN2) set up for a MultiWAN configuration
+
*Optional 1 (WAN2) set up for a MultiWAN configuration
Optional 2 (WAN3) set up for a MultiWAN configuration
+
*Optional 2 (WAN3) set up for a MultiWAN configuration
Optional n (WANn) set up for a MultiWAN configuration
+
*Optional n (WANn) set up for a MultiWAN configuration
  
 
From the pfSense menu select Interfaces - OPT1 and set up as follows:
 
From the pfSense menu select Interfaces - OPT1 and set up as follows:
Zeile 140: Zeile 142:
 
* Checking interfaces
 
* Checking interfaces
  
Interfaces set up for a MultiWAN configuration
+
==Interfaces set up for a MultiWAN configuration==
 
+
From the pfsense menu select Interfaces - Assign and you should get an screen like the one of the right. Note your hex numbers (The MAC addresses) will be different.
+
 
+
Now to check that pfSense can see your modem routers you use Diagnostics - Ping. With WAN 1 selected, enter the IP address of your modem / router - 192.168.0.254 if you are using the guide values in this document.
+
 
+
If you are using using a modem / router without NAT, the check first that the WAN link is up and ping the DNS server address that you recorded earlier.
+
 
+
FTP helper: Check also that FTP helper is only enabled for the LAN interface. That is it should be disabled on all WAN interfaces
+
 
+
 
+
Setting up Load Balancing pools
+
Overview
+
how the various Pools and gateways are related, and how they can be used
+
 
+
This setup uses 3 pools
+
  
  1. One pool for load balanced use when both WANS are working
+
*From the pfsense menu select Interfaces - Assign and you should get an screen like the one of the right. Note your hex numbers (The MAC addresses) will be different.
  2. One pool which prefers WAN 1, for use when WAN 2 has failed
+
*Now to check that pfSense can see your modem routers you use Diagnostics - Ping. With WAN 1 selected, enter the IP address of your modem / router - 192.168.0.254 if you are using the guide values in this document.
  3. One pool which prefers WAN 2, for use when WAN 1 has failed
+
*If you are using using a modem / router without NAT, the check first that the WAN link is up and ping the DNS server address that you recorded earlier.
 +
*FTP helper: Check also that FTP helper is only enabled for the LAN interface. That is it should be disabled on all WAN interfaces
  
These pools use the 2 gateways that are already established (by the interfaces WAN and WAN 2) to load balance and support failover when a WAN link fails
+
==Setting up Load Balancing pools==
Selecting a Monitor IP address
+
  
pfSense monitors each WAN connection by pinging the monitor address you specify. If the ping fails, the link is marked down and the appropriate failover configuration is used (actually if the ping fails it retries a few times to be sure, this avoids false indications of the connection going down).
+
[[Bild:LB.jpg|border|250px]]
  
Note that pfSense automatically sets up to route traffic to your monitor IP only down the link it is monitoring, so don't use a popular web site as this will force all its traffic down 1 link. Better to use a router or server in your ISP's network.
 
  
Good addresses to use your ISP's DNS server (1 from each ISP). The web interface makes it easy to pick these when setting up the pools later.
+
* pools
 +
#3 pools for load balanced
 +
#3 pools for fail over
 +
* die "Monitor-IP's" sollten die primären DNS der einzelnen Provider sein.
  
Other good monitor addresses are the default gateway your modem has assigned (if it responds to ping!), your ISP's webmail server, or a router within your ISP's network - you can find one of these by using traceroute to a public service, be careful though, larger ISPs will have networks that dynamically adapt so a router you see now may not be there an hour later!
+
==Firewall anpassen==
  
 +
* Aliase erstellen
 +
** Einen für Protokolle, die kein sharing vertragen (22, 443, 444, 3389, 8448).
 +
** Einen für hosts, bei denen scharing aus irgend welchen Gründen (z.B. langsames ajax) nicht funktioniert, oder es zu Problemen kommt (kann später ergänzt werden).
 +
*
  
After Wizard general setup
+
==RRD==
 +
Für die RRD-Grafiken werden die IPs aus der config.xml geholt, die sich nicht direkt in der Weboberfläche konfigurieren lassen.
 +
Daher sind dort die '''use_rrd_gateway'''-Werte direkt in der Shell auf die Monitor-IPs der LoadBalancer-Konfiguration zu setzen.
  
* Go into 'Services' - 'DNS Forwarder', turn on
+
/cf/conf/config.xml (Auszug):
**Register DHCP leases in DNS forwarder
+
        <interfaces>
**Register DHCP static mappings in DNS forwarde
+
                <lan>
 +
                        ...
 +
                </lan>
 +
                <wan>
 +
                        <if>xl2</if>
 +
                        ...
 +
                        <use_rrd_gateway>$MonitorIP-WAN</use_rrd_gateway>
 +
                </wan>
 +
                <opt1>
 +
                        <if>xl1</if>
 +
                        ...
 +
                        <use_rrd_gateway>$MonitorIP-OPT1</use_rrd_gateway>
 +
                </opt1>
 +
                <opt2>
 +
                        <if>xl0</if>
 +
                        ...
 +
                        <use_rrd_gateway>$MonitorIP-OPT2</use_rrd_gateway>
 +
                </opt2>
 +
        </interfaces>

Aktuelle Version vom 18. Oktober 2012, 15:18 Uhr

Inhaltsverzeichnis

[Bearbeiten] Ziel

Die Idee ist, ein Gerät zu konfigurieren, das

  • 1 LAN mit mehreren WAN verbindet,
  • load balancing gewährleistet,
  • fall back Funktionalität bietet.


Fehler beim Erstellen des Vorschaubildes: Die Miniaturansicht konnte nicht am vorgesehenen Ort gespeichert werden
UMTS Router Vodafone   UMTS Router O2  ADSL (slow)
    |                          |            |
    ------------ pfSense Box ---------------
                    |
                   LAN

[Bearbeiten] externe Anleitung

Multi-WAN Version 1.2.x

[Bearbeiten] Hardware

[Bearbeiten] Hardware Architectures

pfSense is supported only on the x86 architecture. The types of devices supported range from standard PCs to a variety of embedded devices. It is targeted at x86-based PCs 300 MHz or faster.

[Bearbeiten] Minimum Hardware Requirements

PII / 128MB

[Bearbeiten] Unsere Hardware

  • AMD Duron800
  • 512MB DDR400
  • 1x Realtek RTL8139c
  • 1x 3Com 3c905-TX
  • 2x 3Com 3c905-TX-M

[Bearbeiten] Vorbereitung / HW-Bastelei

  • Zusammenbau
  • Notieren der Netzwerkkarten in Einbaureihenfolge von oben nach unten
  • Knoppix booten, Netzwerkkarten testen (ping) Tabelle anlegen
NIC-Name IRQ/Base Linux-Dev-Name BSD-Dev-Name MAC
3c905-TX irq5/0xD400 eth0 xl0 (später nach booten von pfSense eingefügt) 00:60:..
3c905-TX-M irq11/0xAF80 eth1 xl1 (später nach booten von pfSense eingefügt) 00:04:..
3c905-TX-M irq5/0xFF00 eth2 xl2 (später nach booten von pfSense eingefügt) 00:01:..
RTL8139c irq5/0x800 eth3 rl0 (später nach booten von pfSense eingefügt) 00:30:..
  • memtest
  • aktuelles pfSense "Live CD with Installer" downloaden und auf CD brennen

[Bearbeiten] Installation

  • erst pfSense default von CD starten
  • bei entsprechender Frage Optionen installieren (I) wählen
  • eventuelle Fehlermeldungen von fdisk bzgl. zu großer Sektoren etc. durch skip ignorieren
  • wie gewünscht neu booten, CD entfernen

[Bearbeiten] Konfiguration

UMTS Router Vodafone   UMTS Router O2  ADSL (slow)
192.168.30.1           192.168.20.1    192.168.10.1 
    |                          |            |
255.255.255.0          255.255.255.0   255.255.255.0
    |                          |            |
192.168.30.10          192.168.20.10   192.168.10.10
    |                          |            |
    ------------ pfSense Box ---------------
                    |
                   LAN
                192.168.0.1
                255.255.255.0
          DHCP Y (192.168.0.100 - ....200)

[Bearbeiten] pfSense console setup

  • LAN IP Address: 192.168.0.1 / 255.255.255.0
  • DHCP y
  • DHCP start address 192.168.0.100
  • DHCP end address 192.168.0.200

[Bearbeiten] Setting up routers

...

[Bearbeiten] Using the pfSense Wizard

Grundlegende Einstellungen

  • hostname
  • domain
  • Primary DNS server
  • Secondary DNS server
  • Allow DNS server list to be overridden by DHCP/PPP on WAN

Hinweis, Es ist wichtig von jeder Internetverbindung einen zu nehmen, oder Öffentliche zu verwenden.

  • time server DNS name
  • Timezone

WAN configuration

  • Selected type
  • IP address
  • Gateway

password and reboot

Es ist zu beachten, daß der Loadbalancer nicht mit PPPoE-Verbindungen zusammenarbeitet. Ein einfaches DSL-Modem eignet sich nicht dafür, es muß also ein DSL-Router eingesetzt und statische IPs im Interface eingetragen werden.

[Bearbeiten] OPT1, OPT2.OPTn interface

  • Optional 1 (WAN2) set up for a MultiWAN configuration
  • Optional 2 (WAN3) set up for a MultiWAN configuration
  • Optional n (WANn) set up for a MultiWAN configuration

From the pfSense menu select Interfaces - OPT1 and set up as follows:

  • enable Optional 1 interface: checked
  • Type: Static - assumes you are not using an address assigned by your ISP
  • Bridge with: None
  • IP address
  • Gateway
  • Checking interfaces

[Bearbeiten] Interfaces set up for a MultiWAN configuration

  • From the pfsense menu select Interfaces - Assign and you should get an screen like the one of the right. Note your hex numbers (The MAC addresses) will be different.
  • Now to check that pfSense can see your modem routers you use Diagnostics - Ping. With WAN 1 selected, enter the IP address of your modem / router - 192.168.0.254 if you are using the guide values in this document.
  • If you are using using a modem / router without NAT, the check first that the WAN link is up and ping the DNS server address that you recorded earlier.
  • FTP helper: Check also that FTP helper is only enabled for the LAN interface. That is it should be disabled on all WAN interfaces

[Bearbeiten] Setting up Load Balancing pools

Fehler beim Erstellen des Vorschaubildes: Die Miniaturansicht konnte nicht am vorgesehenen Ort gespeichert werden


  • pools
  1. 3 pools for load balanced
  2. 3 pools for fail over
  • die "Monitor-IP's" sollten die primären DNS der einzelnen Provider sein.

[Bearbeiten] Firewall anpassen

  • Aliase erstellen
    • Einen für Protokolle, die kein sharing vertragen (22, 443, 444, 3389, 8448).
    • Einen für hosts, bei denen scharing aus irgend welchen Gründen (z.B. langsames ajax) nicht funktioniert, oder es zu Problemen kommt (kann später ergänzt werden).

[Bearbeiten] RRD

Für die RRD-Grafiken werden die IPs aus der config.xml geholt, die sich nicht direkt in der Weboberfläche konfigurieren lassen. Daher sind dort die use_rrd_gateway-Werte direkt in der Shell auf die Monitor-IPs der LoadBalancer-Konfiguration zu setzen.

/cf/conf/config.xml (Auszug):

       <interfaces>
               <lan>
                       ...
               </lan>
               <wan>
                       <if>xl2</if>
                       ...
                       <use_rrd_gateway>$MonitorIP-WAN</use_rrd_gateway>
               </wan>
               <opt1>
                       <if>xl1</if>
                       ...
                       <use_rrd_gateway>$MonitorIP-OPT1</use_rrd_gateway>
               </opt1>
               <opt2>
                       <if>xl0</if>
                       ...
                       <use_rrd_gateway>$MonitorIP-OPT2</use_rrd_gateway>
               </opt2>
       </interfaces>
Meine Werkzeuge