Note: Google Drive links may not work or might be expired. You can find the scripts here

Tutorial no 6

                                     This component (which started in the carp branch) is a simple TCP load balancer. It takes a service_ip and a list of server IP addresses. And the http requests from different clients will be directed to different pre-defined http servers. The server is chosen based on round robin scheduling

                                       New TCP flows to the service IP will be randomly redirected to one of the server IPs. Servers are periodically probed to see if they’re alive by sending them ARPs. By default, it will make the first switch that connects into a load balancer and ignore the other switches. If you have a topology with multiple switches, it probably makes more sense to specify which one should be the load balancer, and this can be done with the -dpid command line option. In this case, you probably want the rest of the switches to do something worthwhile (like forward traffic), and you may have to create a component that does this for you. For example, you might create a simple component which does the same thing as forwarding.l2_learning on all the switches besides the load balancer.

1) Here to request service from HTTP servers we need utility curl. To install curl in mininet we need internet. We can connect mininet to internet using NAT interface eth1. Before that lets check eth1 has got an ip address or not using command.

ifconfig -a


Here you can see my eth1 interface has no IP address. We can get it from DHCP pool by using command

sudo dhclient eth1


Now you can verify it.


2)Now lets install curl                                                                                                                                               sudo apt-get install curl


3)We will create topology with 6 hosts with one controller and ofswitch.


4)To run ip_loadbalancer we need pass arguments.

./pox.py misc.ip_loadbalancer –ip=<Service IP> –servers=<Server1 IP>,<Server2 IP>,… [–dpid=<dpid>]


Let host 1 and host 2 are the http servers with IP addresses, respectively. Also is service IP address.

5)Now with help of xterm utility we get interface to hosts and servers. For that we use command                                                                                                                                                                     Xterm h1 h2 h3 h4 h5 h6


6) Now we run simple server on host1 and host2 on port 8080 [HTTP] using command python –m SimpleHTTPServer 80


Now we have started our servers.

7) Now other hosts can request service from

curl                                                                                                                                                            Observe the traffic pattern on servers (host1, host2) and on controller.