Day 11: Distributed SDN controller Master-Slave Architecture
In the previous post we had seen how to simulate a 2 controller network. There were few problems I had faced even after setting it up.
One major problem was that I couldn't use my VM (Oracle VirtualBox where I had installed Ubuntu 18.04 on Windows 10) as part of the external network of controllers. In today's post I shall be revealing that and setting up a 3 controller network with master-slave architecture.
To resolve the former issue, do the following:
- Go to VirtualBox Settings -> Network tab -> choose Host-only Adapter in "Attached-to" input - > in the "name" input, "VirtualBox Host-Only Ethernet Adapter" is automatically selected.
- Go to Windows Network Settings
- Choose both "Ethernet" and "VirtualBox Host-Only Ethernet Adapter" -> right click -> click on Bridge Network
- An acknowledgement message is displayed that the connection is bridged.
The above process is done to essentially take care of how the network traffic from your VM is also passed to the outside network through your host internal network. By doing this, you give your VM all capabilities that a server possesses. Now when you connect the D-link switch to the VM, the other hosts on the network will be able to identify the VM as another host on the network.
Now, let's start from where we left off in the previous simulation experiment. Alongside the two Linux hosts, I have now connected my VM as a third controller. I tried to build a master-slave architecture by keeping the VM as the master controller and other two hosts as normal controllers.
You can follow the below code for the same:
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def emptyNet():
net = Mininet(controller=RemoteController, switch=OVSKernelSwitch)
c1 = net.addController('c1', controller=RemoteController, ip="10.0.0.2", port=6633)
c2 = net.addController('c2', controller=RemoteController, ip="10.0.0.1", port=6633)
c3 = net.addController('c3', controller=RemoteController, ip="10.0.0.3", port=6633)
h1 = net.addHost( 'h1', ip='10.1.0.1' )
h2 = net.addHost( 'h2', ip='10.1.0.2' )
h3 = net.addHost( 'h3', ip='10.1.0.3' )
h4 = net.addHost( 'h4', ip='10.1.0.4' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
s1.linkTo( h1 )
s1.linkTo( h2 )
s1.linkTo( s2 )
s2.linkTo( h3 )
s2.linkTo( h4 )
net.build()
c1.start()
c2.start()
c3.start()
s1.start([c1,c3])
s2.start([c2,c3])
net.start()
net.staticArp()
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
emptyNet()
One problem I faced in the above code is that s1 and s2 are not limited to taking flows from c1, c3 and c2, c3 respectively. You can try all combination of active and inactive controllers that control S1 and S2 and you will observe that any 1 active controller in the network is enough to forward packets throughout the architecture built.
If you can think of any mistakes, do let me know. Tomorrow we shall dig in deeper to fix these errors and work on the master-slave architecture.
Comments
Post a Comment