Question

In this assignment you will start with Python code that builds a 2 host network connected...

In this assignment you will start with Python code that builds a 2 host network connected by a legacy router. You will modify it such that the two hosts can send packets to each other. It requires that you understand subnet addressing and the function of a router. The network built using Miniedit on a Mininet virtual machine: python mininet/examples/miniedit.py. We need h1 to ping h2, but it gives an unreachable error. I believe that I just need the addlinks to work

This is the work that I have so far!!

#!/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


def myNetwork():
net = Mininet( topo=None, build=False,ipBase='10.0.0.0/24')
info( '*** Adding controller\n' )
c0=net.addController(name='c0',controller=Controller, protocol='tcp',port=6633)


s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)

info( '*** Add switches\n')
r5 = net.addHost('r5', cls=Node, ip=' 10.0.1.1/24', defaultRoute='via 192.168.56.1')
r5.cmd('sysctl -w net.ipv4.ip_forward=1')
r4 = net.addHost('r4', cls=Node, ip=' 10.0.2.1/24', defaultRoute='via 192.168.56.2')
r4.cmd('sysctl -w net.ipv4.ip_forward=1')
r3 = net.addHost('r3', cls=Node, ip=' 10.0.3.1/24', defaultRoute='via 192.168.56.3')
r3.cmd('sysctl -w net.ipv4.ip_forward=1')

info( '*** Add hosts\n')
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1',defaultRoute='via 10.0.3.1')
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2',defaultRoute='via 10.0.1.1')

info( '*** Add links\n')
net.addLink(h1, s1)
net.addLink(h2, s2)
net.addLink(s2, r5, intfName2='r5-eth1', params2={ 'ip' : '10.0.1.1/24'})
net.addLink(s1, r3, intfName2='r3-eth1', params2={ 'ip' : '10.0.3.1/24'})
net.addLink(r3, r4, intfName1='r3-eth2', params1={ 'ip' : '192.168.56.3'}, intfName1='r4-eth2', params0={'192.168.56.2'})
net.addLink(r4, r5, intfName1='r4-eth1', params1={ 'ip' : '10.0.2.1/24'}, intfName2='r5-eth2', params2={'192.168.56.1'})

info( '*** Starting network\n')
net.build()

info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()

info( '*** Starting switches\n')
net.get('s2').start([c0])
net.get('s1').start([c0])

info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()

Homework Answers

Answer #1

Part of your question:

Your problem statement states that start with Python code that builds a 2 host network connected by a legacy router.

I believe that I just need the addlinks to work

Answer:

Simply adding addlinks will not resolve the problem.

Explanation for my answer:

I beleive that you need to add the router and the addlink for the associated the routers. Then only it will work. Otherwise, you cannot ping.

------------------------------------------

Please do the following.

  • Modify the source code to add the router.
  • addlinks for that associated router.

Hence, it needs rework on the source code.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions