Installation and Simple test configuration

This test configuration uses 4 computers within the same network to test the load balacing service of two FTP/Web servers, using direct server return (DSR) setting of BalanceNG.

Overall layout



Hardware

 Role
Device Name  IP address
Ethernet port  Status
 Switch gsw4 -  
 Actual server
 web1 192.168.10.220 eth0 active FTP/web server
 Actual server
 web2 192.168.10.213 eth0 active FTP/web server
 Load balancer
 archie 192.168.10.119 eth0, eth1
 active command line Linux OS
 Visitor (client)
 wendy 192.168.10.201 eth0 active with web browser



Server setting

    HTTP server setting

    Web page location:        /var/www/http/index.html  
    Change file permission:  chmod -R a+r *
    Start the server:             service httpd start
    More about Web server configuration check here

    FTP server setting

    Start the server: service vsftpd start
    More about FTP config check here

    Test connections

        HTTP: using web browser and key in the IP address of the particular web server
        FTP:   using ftp or lftp, the commend line FTP, and key in the IP address of the particular FTP server

Download and Installation of BalanceNG

BalanceNG Dowland page: https://www.inlab.de/balanceng/download.html
The BalanceNG package is download on archie at the root folder

Version:
BalanceNG Release 2.130 (Linux "tarball" distribution)
MD5: 709b822babdac68046fb52a6138eaa1a

Installation example on Linux (please consult manual for details):

# tar xvfz BalanceNG-2.130-Linux-x86.tar.gz
# cp ./BalanceNG-2.094/bng /bin       (copy to bin so by key in bng it will excute)
# ln -s /bin/bng /etc/rc5.d/S11bng   (make link, so the file run when boot)
# ln -s /bin/bng /etc/init.d/bng      (make link, recommended by the manual)


Start BalanceNG

Now we are ready to start BalanceNG just by key in the following line:
# bng start
BalanceNG: starting up ...

Other command, refer to BalanceNG cheatsheet.

Configuration: Direct Server Return (DSR) double nodes setup

This simple "Direct Server Return" example is modified from BalanceNG website example DSR single node setup. It is the starting point of test setup. This example is fully operational with the free BalanceNG Basic Trial License.

Configuration at both actural server

1. Set up virtural server
At web1:
ifconfig lo:0 192.168.10.20 netmask 255.255.255.255 -arp up
At web2:
ifconfig lo:0 192.168.10.20 netmask 255.255.255.255 -arp up

(after that ifconfig show they(lo:0) are up. This IP address is the virtural server address. )

2. ARP setting
At both (Normally the arp_ignore file has the value 0, and arp_annouce file has the value 0.)
# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

Note if the above is not appropriate, when start bng there might be various errors occurs in the log file.

Configuration at balancer

1. Naming convention of bng.conf
BlanceNG allows multiple instances (setting) in one balancer. Therefore by naming the configuration files differently you can balance different network traffic.

By default, bng.conf is instance 0. Use
bng start
to start it.

bng1.conf is instance 1. So when this configuration is needed, we can use
bng start 1
to start it.

2. Web server balancing at port 80
Copy the configuration file bng1.conf to /etc
The content of bng.conf is as following:

//  Configuration taken on 05 June 2008 by Weiwei
interface eth0
network 1 {
          name "Weiwei's test network"
          addr 192.168.10.0
          mask 255.255.255.0
          real 192.168.10.252
          interface eth0
}
register  network 1
enable    network 1
server    1 {
          ipaddr 192.168.10.20
          port 80
          protocol tcp
          targets 1,2
}
register  server 1
enable    server 1
target    1 {
          ipaddr 192.168.10.220
          port 80
          protocol tcp
          tcpopen 80,3,10
          dsr enable
}
target    2 {
          ipaddr 192.168.10.213
          port 80
          protocol tcp
          tcpopen 80,3,10
          dsr enable
}
register  targets 1,2
enable    targets 1,2
//        end of configuration

Some more explanation on the General Configuration guide.

3. FTP server balancing at port 20, 21
Note: Here we specify the port is 20 and 21 where 21 is the command port and 20 is the data port. This is an active FTP mood.  Therefore in the FTP configuration file we must have passive mood disable. The sample FTP config file:
/etc/vsftpd/vsftpd.conf

Copy the configuration file bng2.conf to /etc
The content of bng.conf is as following:

// Configuration taken on 11 June 2008 by Weiwei
// Remark    "test configuration, DSR to two target, FTP on port 20 21"
// Ref:      http://www.inlab.de/balanceng/configs.html conf005.txt One node DSR load balancing SMTP on port 25 to two targets
interface eth1
network   1 {
          name "Test FTP port20,21"
          addr 192.168.10.0
          mask 255.255.255.0
          real 192.168.10.250
          interface eth1
}
register  network 1
enable    network 1

server    1 {
          ipaddr 192.168.10.20
          protocol tcp
          port 20,21
          targets 1,2
}
register  server 1
enable    server 1
target    1 {
          ipaddr 192.168.10.220
          dsr enable
}
target    2 {
          ipaddr 192.168.10.213
          dsr enable
}
register  targets 1,2
enable    targets 1,2
//        end of configuration



Testing

Now start bng and show configuration:
# bng start 1
BalanceNG: starting up ...
# bng control 1
bng# show conf

Get into bng control and we can do:
bng# show target
192.168.10.220 ....operational
192.168.10.213 ... operational

Other commands:
bng# show servers
bng# show ifstat
bng# show network


The server is virtural. And we can ping it from wendy, web1 and web2.
And if key in 192.168.10.20 from wendy, you can see either web1 page or web2 page.

Similarly, we can start the FTP balancing configuration by using:
# bng start 2
BalanceNG: starting up ...
# bng control 2
bng# show conf
ċ
bng1.conf
(1k)
Weiwei Luo,
Nov 5, 2008, 1:37 AM
ċ
bng2.conf
(1k)
Weiwei Luo,
Nov 5, 2008, 1:37 AM
ċ
vsftpd.conf
(0k)
Weiwei Luo,
Nov 5, 2008, 1:37 AM
Comments