In this assignment you will use MiniEdit on a Mininet VM to create a Python Level Two script that builds two hosts and two switches connected to each other by three legacy routers. (The command to start MiniEdit on a Mininet virtual machine is: mininet@mininet-vm~$ python ~/mininet/examples/miniedit.py) The two end routers represent the border routers for a company at two locations; the third router represents the Internet. Consider h1, s1 and r3 to be at a West Coast site and h2, s2, and r5 to be at an East Coast site. You will modify Level Two script such that the two hosts can ping each other. This requires that you understand subnet addressing, the function of a router, and the configuration of static routes.
Subnet addressing in Mininet In this assignment you will use MiniEdit on a Mininet VM to create a Python Level Two script that builds two hosts and two switches connected to each other by three legacy routers. (The command to start MiniEdit on a Mininet virtual machine is: mininet@mininet-vm~$ python ~/mininet/examples/miniedit.py) The two end routers represent the border routers for a company at two locations; the third router represents the Internet. Consider h1, s1 and r3 to be at a West Coast site and h2, s2, and r5 to be at an East Coast site. You will modify Level Two script such that the two hosts can ping each other. This requires that you understand subnet addressing, the function of a router, and the configuration of static routes. "INTERNET" r3 r4 r5 East Coast West Coast Network Network si s2 hi h2 In order to run miniedit.py, you must start an X11 server program (XQuartz for MAC and XMing for Windows), and set up X11 forwarding on your machine. The code that is generated by exporting this network as a Level 2 Script in MiniEdit: #!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController, OVSController from mininet.node import Host, Node from mininet.node import OVSKernelSwitch, UserSwitch from mininet.node import IVSSwitch from mininet.cli import CLI from mininet.log import setLogLevel, info from mininet.link import TCLink, Intf from subprocess import call Smp def myNetwork(): net = Mininet ( topo=None, build=False, ipBase='10.0.0.0/24'). info ( '*** Adding controller ') co=net.addController (name='co', controller=Controller, protocol='top', port=6633) info( '*** Add switches ') r5 = net.addHost('r5', cls=Node, ip='0.0.0.0') r5.cmd ('sysctl -w net.ipv4.ip_forward=1') s2 = net.addSwitch('82', cls=OVSKernel Switch) sl = net.addSwitch('sl', cls=OVSKernelSwitch) r4 = net.addHost ('r4', cls=Node, ip='0.0.0.0') r4.cmd ('sysctl -w net.ipv4.ip_forward=1') r3 = net.addHost('r3', cls=Node, ip='0.0.0.0') r3.cmd ('sysctl -w net.ipv4.ip_forward=1') info ( '*** Add hosts ') h1 = net.addHost('hl', cls=Host, ip='10.0.0.1', defaultRoute=None) h2 = net.addHost ('h2', cls=Host, ip='10.0.0.2', defaultRoute=None) info ( '*** Add links ') net.addLink (hi, sl) net.addLink (h2, s2) net.addLink (s2, r5) net.addLink (sl, r3) net.addLink (r3, r4) net.addLink (r4, r5) info( '*** Starting network ') net.build() info( '*** Starting controllers ') for controller in net.controllers: controller.start() info ( '*** Starting switches ') net.get ('52').start([00]) net.get('sl').start([CO]) info('*** Post configure switches and hosts ') CLI (net) net.stop() She if name == ': main setLogLevel( 'info' myNetwork() ) Executing this code mininet@mininet-vm~$: sudo python legacy_routers.py results in: *** *** Adding controller *** Add switches Add hosts *** Add links *** Starting network *** Configuring hosts r3 r4 r5 h1 h2 *** Starting controllers *** Starting switches Traceback (most recent call last): File "legacy_routers.py", line 64, in
myNetwork() File "legacy_routers.py", line 54, in myNetwork net.get('s2').start([CO]) File "build/bdist.linux-i686/egg/mininetode.py", line 1165, in start File "build/bdist.linux-i686/egg/mininetode.py", line 1166, in File "build/bdist.linux-i686/egg/mininetode.py", line 1132, in int fopts File "build/bdist.linux-i686/egg/mininetode.py", line 1075, in isoldovs AttributeError: type object 'OVSSwitch' has no attribute 'OVSVersion' Your task is to modify this program (perhaps using different IP addresses) such that the legacy routers can forward packets between the two hosts. But first, you must get rid of the "build errors". These errors occur because of the order that MiniEdit creates the switches and legacy routers. To get rid of these errors, move the two lines instantiating switches 51 and 52 ahead of the legacy router instantiations in the section of code labeled info ( '*** Add switches ') Now to continue with the assignment, you will need to understand Internet addressing, subnets, and the function of a router as described in the "IPv4 Addressing" Section of Kurose and Ross (4.3.3 in 7th Edition). There are certain rules you must follow for this assignment: a. Host h1 and the router r3 interface connected to s1 will be on a 254-host network with the private IPv4 address of 10.0.x.0/24. (You choose the value of x.) b. Host h2 and the router r5 interface connected to s2 will be on a network with the private IPv4 address of 10.0.y.0/24. (You choose the value of y.) The link between router r3 and router r4 will be a 2-host network with the C. IPv4 address of 192.168.a.b. (You choose the values of a and b.) Hint: Remember a 2-host network must also include the IP address of the network number and the broadcast address. d. The link between router r4 and router r5 will be a 2-host network with the IPv4 address of 192.168.c.d. (You choose the values of c and d.) e. The Level Two script has already inserted the commands to make r3, r4, and r5 routers. You will have to add six static routes to make this network work. You may want to go to this link to see the Linux commands for adding and deleting static routes. There are two different valid commands for adding and deleting static routes; you may use either one. https://www.poftut.com/add-new-route-ubuntu-linux/ 192.168.2.e/30 192.168.c.f/30 ethl R3 110.0.X-4/24 etho eth! 1 R4 192.168.c-b30 192,148.Ced/30 Cethi R5 10.04.1/24 poco SI S2 NAV 610.0.x. 1/24 hl 10.0.4.9/24 h2 ADD SWITCH SI ADD SWITCH S2 R3- IP ADD HOST 10.0. ADD HOST - 192.168.--- IP R4 - R5 ADD HOST - 10.0. IP hi ADD HOST 10.0.x.- IP - DEFAULT ROUTE R3's 10.0.- IP h2 - ADD HOST 10.0.4..... IP DE FAULT ROUTE R5's 10.0 - IP hl-SI - ADD LINK h2 s2 - ADD LINK. SI - R3 ADD LINK 32 - RS ADD LINK R3-R4 ADD LINK - CR3, RU, int namel= params] = {'p': netmask gw dev ') Subnet addressing in Mininet In this assignment you will use MiniEdit on a Mininet VM to create a Python Level Two script that builds two hosts and two switches connected to each other by three legacy routers. (The command to start MiniEdit on a Mininet virtual machine is: mininet@mininet-vm~$ python ~/mininet/examples/miniedit.py) The two end routers represent the border routers for a company at two locations; the third router represents the Internet. Consider h1, s1 and r3 to be at a West Coast site and h2, s2, and r5 to be at an East Coast site. You will modify Level Two script such that the two hosts can ping each other. This requires that you understand subnet addressing, the function of a router, and the configuration of static routes. "INTERNET" r3 r4 r5 East Coast West Coast Network Network si s2 hi h2 In order to run miniedit.py, you must start an X11 server program (XQuartz for MAC and XMing for Windows), and set up X11 forwarding on your machine. The code that is generated by exporting this network as a Level 2 Script in MiniEdit: #!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController, OVSController from mininet.node import Host, Node from mininet.node import OVSKernelSwitch, UserSwitch from mininet.node import IVSSwitch from mininet.cli import CLI from mininet.log import setLogLevel, info from mininet.link import TCLink, Intf from subprocess import call Smp def myNetwork(): net = Mininet ( topo=None, build=False, ipBase='10.0.0.0/24'). info ( '*** Adding controller ') co=net.addController (name='co', controller=Controller, protocol='top', port=6633) info( '*** Add switches ') r5 = net.addHost('r5', cls=Node, ip='0.0.0.0') r5.cmd ('sysctl -w net.ipv4.ip_forward=1') s2 = net.addSwitch('82', cls=OVSKernel Switch) sl = net.addSwitch('sl', cls=OVSKernelSwitch) r4 = net.addHost ('r4', cls=Node, ip='0.0.0.0') r4.cmd ('sysctl -w net.ipv4.ip_forward=1') r3 = net.addHost('r3', cls=Node, ip='0.0.0.0') r3.cmd ('sysctl -w net.ipv4.ip_forward=1') info ( '*** Add hosts ') h1 = net.addHost('hl', cls=Host, ip='10.0.0.1', defaultRoute=None) h2 = net.addHost ('h2', cls=Host, ip='10.0.0.2', defaultRoute=None) info ( '*** Add links ') net.addLink (hi, sl) net.addLink (h2, s2) net.addLink (s2, r5) net.addLink (sl, r3) net.addLink (r3, r4) net.addLink (r4, r5) info( '*** Starting network ') net.build() info( '*** Starting controllers ') for controller in net.controllers: controller.start() info ( '*** Starting switches ') net.get ('52').start([00]) net.get('sl').start([CO]) info('*** Post configure switches and hosts ') CLI (net) net.stop() She if name == ': main setLogLevel( 'info' myNetwork() ) Executing this code mininet@mininet-vm~$: sudo python legacy_routers.py results in: *** *** Adding controller *** Add switches Add hosts *** Add links *** Starting network *** Configuring hosts r3 r4 r5 h1 h2 *** Starting controllers *** Starting switches Traceback (most recent call last): File "legacy_routers.py", line 64, in myNetwork() File "legacy_routers.py", line 54, in myNetwork net.get('s2').start([CO]) File "build/bdist.linux-i686/egg/mininetode.py", line 1165, in start File "build/bdist.linux-i686/egg/mininetode.py", line 1166, in File "build/bdist.linux-i686/egg/mininetode.py", line 1132, in int fopts File "build/bdist.linux-i686/egg/mininetode.py", line 1075, in isoldovs AttributeError: type object 'OVSSwitch' has no attribute 'OVSVersion' Your task is to modify this program (perhaps using different IP addresses) such that the legacy routers can forward packets between the two hosts. But first, you must get rid of the "build errors". These errors occur because of the order that MiniEdit creates the switches and legacy routers. To get rid of these errors, move the two lines instantiating switches 51 and 52 ahead of the legacy router instantiations in the section of code labeled info ( '*** Add switches ') Now to continue with the assignment, you will need to understand Internet addressing, subnets, and the function of a router as described in the "IPv4 Addressing" Section of Kurose and Ross (4.3.3 in 7th Edition). There are certain rules you must follow for this assignment: a. Host h1 and the router r3 interface connected to s1 will be on a 254-host network with the private IPv4 address of 10.0.x.0/24. (You choose the value of x.) b. Host h2 and the router r5 interface connected to s2 will be on a network with the private IPv4 address of 10.0.y.0/24. (You choose the value of y.) The link between router r3 and router r4 will be a 2-host network with the C. IPv4 address of 192.168.a.b. (You choose the values of a and b.) Hint: Remember a 2-host network must also include the IP address of the network number and the broadcast address. d. The link between router r4 and router r5 will be a 2-host network with the IPv4 address of 192.168.c.d. (You choose the values of c and d.) e. The Level Two script has already inserted the commands to make r3, r4, and r5 routers. You will have to add six static routes to make this network work. You may want to go to this link to see the Linux commands for adding and deleting static routes. There are two different valid commands for adding and deleting static routes; you may use either one. https://www.poftut.com/add-new-route-ubuntu-linux/ 192.168.2.e/30 192.168.c.f/30 ethl R3 110.0.X-4/24 etho eth! 1 R4 192.168.c-b30 192,148.Ced/30 Cethi R5 10.04.1/24 poco SI S2 NAV 610.0.x. 1/24 hl 10.0.4.9/24 h2 ADD SWITCH SI ADD SWITCH S2 R3- IP ADD HOST 10.0. ADD HOST - 192.168.--- IP R4 - R5 ADD HOST - 10.0. IP hi ADD HOST 10.0.x.- IP - DEFAULT ROUTE R3's 10.0.- IP h2 - ADD HOST 10.0.4..... IP DE FAULT ROUTE R5's 10.0 - IP hl-SI - ADD LINK h2 s2 - ADD LINK. SI - R3 ADD LINK 32 - RS ADD LINK R3-R4 ADD LINK - CR3, RU, int namel= params] = {'p': netmask gw dev ')