|
Layer 2 Dual Legged Switching Mode Example (DEPRECATED)Note: This is example is deprecated, the "l2switch" configuration option will be removed with BalanceNG V3 (available Q2/2009). This example shows how to set up BalanceNG as a transparent load balancing layer 2 (Ethernet) switch. You should change the example network "172.16.1.0/24" to match your own network setup (and the server address too of course). This example is fully operational with the free BalanceNG Basic License.
1. The initial networkConsider this to be the simple initial network configuration before inserting the BalanceNG node (the network 172.16.1.0/24 should represent a public allocated address space):
What should be working:
2. Load balancing transparently to two targets in switching modeThe key idea for BalanceNG in transparent switching mode is to connect two layer 2 areas with identical layer 3 network parameters. BalanceNG is configured to represent the old web server IP address 172.16.1.10, load balancing to the two targets ("virtual servers") 172.16.1.100 and 172.16.1.101. There's no need to change either the default gateway or the network parameters on the target machines to something else. BalanceNG needs its own address for ARP resolving, this is specified as "real" address in the network section. Although this flavour of BalanceNG operation is very easy and simple to setup, it has one major disadvantage: High Availability (HA) with VRRP is not supported in Layer 2 Dual Legged Switching Mode operation of BalanceNG. This is because VRRP allows failover of "own" IP addresses from one node to another but does not offer any failover support of learned layer 2 MAC-Addresses of other machines (!). This is how the new network looks like:
The BalanceNG config file This is the BalanceNG configuration for this example. The BalanceNG box needs two interfaces which are both member of the same layer 3 network. The "real" address in the network section is the source address for ARP resolving. Layer 2 switching mode has to be enabled with the "l2switch" configuration keyword.
// configuration taken Tue Oct 10 16:43:01 2005
// BalanceNG 1.391 (created 2005/08/15)
interface eth0
interface eth1
network 1 {
name "local network"
addr 172.16.1.0
mask 255.255.255.0
real 172.16.1.252
interfaces eth0,eth1
}
register network 1
enable network 1
l2switch
server 1 {
ipaddr 172.16.1.10
targets 1,2
port 80
}
register server 1
enable server 1
target 1 {
ipaddr 172.16.1.100
tcpopen 80,3,10
}
target 2 {
ipaddr 172.16.1.101
tcpopen 80,2,10
}
register targets 1,2
enable targets 1,2
// end of configuration
What should be working:
Please contact us in case of further questions, errors or suggestions at info@inlab.de. |



