A typical network configuration of a web server connected to the Internet looks like this (switches not shown):
For this example let’s assume the following IPv4 network parameters are valid within the local network:
Network address: 172.16.1.0/24 Broadcast address: 172.16.1.255 Netmask: 255.255.255.0
The Web server has the IP address 172.16.1.10 with a web server program like Apache listening on Port 80. The default route of this box is set to 172.16.1.254, which is the address that the router offers as a routing endpoint address towards the local network.
The key point of the approach in this example is that a second IPv4 network is being added on the same Layer 2 infrastructure. At the first glance one might feel uncomfortable with this, which is unnecessary. The switches in the LAN simply don’t care about the higher level protocol layers with the IPv4 or IPv6 addresses contained in the packets.
Let’s imagine we are adding the following network parameters:
Network address: 10.1.1.0/24 Broadcast address: 10.1.1.255 Netmask: 255.255.255.0
After adding an extra BalanceNG machine the new network looks like this:
The BalanceNG configuration bng.conf looks like this:
// configuration taken ... // BalanceNG ... modules vrrp,arp,ping,hc,master,slb,tnat,nat,rt set ipforwarding 1 interface 1 { name eth0 access raw } register interface 1 enable interface 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 nat outside interface 1 } network 2 { name "target network" addr 10.1.1.0 mask 255.255.255.0 real 10.1.1.253 virt 10.1.1.254 nat inside interface 1 } register networks 1,2 enable networks 1,2 gateway { ipaddr 172.16.1.254 ping 3,8 } server 1 { ipaddr 172.16.1.10 port 80 protocol tcp targets 1,2 } register server 1 enable server 1 target 1 { ipaddr 10.1.1.1 port 80 protocol tcp tcpopen 80,3,10 } target 2 { ipaddr 10.1.1.2 port 80 protocol tcp tcpopen 80,2,10 } register targets 1,2 enable targets 1,2 // end of configuration
Let’s have a look at some of the important parts: