Single Legged Example

This very simple "single legged" example should give you a starting point for your own test setup. You should change the example network "172.16.1.0/24" to match your own network setup (and the server address too of course).

1. The initial network

Consider 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):

Figure 1: Network configuration without BalanceNG

What should be working:

  • You should be able to ping the default gateway 172.16.1.254 from the Web Server.
  • Clients from the Internet are able to initiate TCP connection to port 80 on the Web Server 172.16.1.10.

2. Load balancing to two targets with one single legged BalanceNG node

The key idea for BalanceNG in a single legged configuration is to introduce another layer 3 (IP) network on top of the existing layer 2 infrastructure. In this example we define this additional network to be 10.1.1.0/24 being an private network according to RFC 1918. BalanceNG is configured to represent the old web server IP address 172.16.1.10, load balancing to the two targets ("virtual servers") 10.1.1.1 and 10.1.1.2. The default gateway on the two targets points to 10.1.1.254, which is also represented by BalanceNG.


Figure 2: Network configuration BalanceNG single legged balancing to two targets

The BalanceNG config file

This is the BalanceNG configuration for this example. The BalanceNG box is connected to the switch with the eth0 interface. The "real" addresses in the network sections are the source addresses for ARP resolving. The "virt" addresses in the network sections are the routing endpoints represented by BalanceNG (the "virt" address of network 1 is not needed in this example, although it has to be specified as a different address).

Additionally, "nat outside" and "nat inside" enable the target machines to access the outer network 1 as well as the internet through the gateway 172.16.1.254.

Please note that "ping" is (unexpectedly) not working through the inside/outside NAT mechanism. This configuration runs with the free "basic trial license".

//        configuration taken Fri Sep 28 21:38:37 2007
//        BalanceNG 1.897 (created 2007/09/18)
set       ipforwarding 1
interface eth0
vrrp      {
          vrid 14
          priority 201
          network 2
}      
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 eth0
}
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 eth0
}
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

What should be working:

  • You should be able to ping the default gateway 10.1.1.254 from the targets.
  • You should be able to ping the virtual web server 172.16.1.10 from the router.
  • Clients from the Internet are able to initiate TCP connection to port 80 on the virtual Web Server 172.16.1.10 (now being represented by BalanceNG).
  • "show servers" and "show targets" in BalanceNG interactive mode should show everything up and operating.

Please contact us in case of further questions, errors or suggestions at info@inlab.de.

Copyright © 1991-2009,2010 by Inlab Software GmbH, All Rights Reserved - [Impressum] - [Widerrufsrecht] - [Sitemap]