This example extends the single legged DSR example by adding the following advanced techniques:
The configuration files as in this example are complete and are ready for production use.
Use the following commands to establish the Loopback-alias on the Targets:
# ifconfig lo:0netmask 255.255.255.255 -arp up ...
# ifconfig lo0:1 plumb ... # ifconfig lo0:1netmask 255.255.255.255 up ...
The commands above establish the loopback aliases temporarily. Making the aliases permanent and reboot-safe depends on the operating system and distribution on Linux. If the target server is a Windows system please have a look here, for Windows 2008 the loopback adapter additionally needs to be enabled, instructions for this are available here.
On Linux it’s required to disable unwanted ARP replies on the target server. This can be done temporarily as follows:
# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore # echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
To make this permanent, just add the following lines to /etc/sysctl.conf:
net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_announce=2
The BalanceNG feedback needs to be started on both targets listening on port 439 like this:
# /usr/local/bin/bngagent 439
There are many different ways to start bngagent atomatically on reboot, a nice method is a crontab entry like shown here (borrowed from the RBridge manual).
The default parameter settings of “vrrppreempt” and “sessionsync” are unchanged in order to enable session table synchronisation together with a master priority not equal to 255.
The server definition contains two ports, 80 and 443, which declares connections to either of them to be related to the same session. If two ports are specified in a server like this, the target definitions of the associated targets must not contain any specific port or protocol settings.
// configuration taken ... // BalanceNG ... hostname node1 remark "DSR configuration with dual node HA and session synchronisation" modules vrrp,arp,ping,hc,master,slb,tnat,nat,rt set { sessionautoresync 1 sessionsyncack 1 } interface 1 { name eth0 access raw } register interface 1 enable interface 1 vrrp { vrid 9 priority 200 network 1 } network 1 { name "local network" addr 172.16.1.0 mask 255.255.255.0 real 172.16.1.252 virt 172.16.1.253 syncpeer 172.16.1.251 interface 1 } register network 1 enable network 1 server 1 { ipaddr 172.16.1.10 ports 80,443 protocol tcp method agent targets 1,2 } register server 1 enable server 1 target 1 { ipaddr 172.16.1.100 agent 439,2,5 script "/usr/lib/mon/mon.d/http.monitor -p $port$ -u /index.html $ipaddr$",2,7 dsr enable } target 2 { ipaddr 172.16.1.101 agent 439,2,5 script "/usr/lib/mon/mon.d/http.monitor -p $port$ -u /index.html $ipaddr$",2,7 dsr enable } register targets 1,2 enable targets 1,2 // end of configuration
// configuration taken ... // BalanceNG ... hostname node2 remark "DSR configuration with dual node HA and session synchronisation" modules vrrp,arp,ping,hc,master,slb,tnat,nat,rt interface 1 { name eth0 access raw } register interface 1 enable interface 1 vrrp { vrid 9 priority 100 network 1 } network 1 { name "local network" addr 172.16.1.0 mask 255.255.255.0 real 172.16.1.251 virt 172.16.1.253 syncpeer 172.16.1.252 interface 1 } register network 1 enable network 1 server 1 { ipaddr 172.16.1.10 ports 80,443 protocol tcp method agent targets 1,2 } register server 1 enable server 1 target 1 { ipaddr 172.16.1.100 agent 439,2,5 script "/usr/lib/mon/mon.d/http.monitor -p $port$ -u /index.html $ipaddr$",2,7 dsr enable } target 2 { ipaddr 172.16.1.101 agent 439,2,5 script "/usr/lib/mon/mon.d/http.monitor -p $port$ -u /index.html $ipaddr$",2,7 dsr enable } register targets 1,2 enable targets 1,2 // end of configuration