Programming Assignment 4 Steps 1 - 5
Programming Assignment 4 Steps 1 - 5
Bablu Banik
Javier Gonzalez
Jordan Guzman
Ashley Teraishi
Block 5 (static routes): In the old code, we did not add static
routes. We did this in the new code so that packets can be
forwarded between hosts.
Old Blocks of Code New/Changed Blocks of Code
net = Mininet( topo=None, net = Mininet(topo=None)
build=False,
ipBase='10.0.0.0/8')
info( '*** Add switches\n') info( '*** Add switches\n')
s1 = net.addSwitch('s1',
r3 = net.addHost('r3', cls=OVSKernelSwitch)
cls=Node, ip='0.0.0.0') s2 = net.addSwitch('s2',
cls=OVSKernelSwitch)
r3.cmd('sysctl -w
net.ipv4.ip_forward=1') info('*** Add routers\n')
r3 = net.addHost('r3',
s1 = net.addSwitch('s1', cls=Node, ip='10.0.5.1/24')
cls=OVSKernelSwitch)
r3.cmd('sysctl -w
r5 = net.addHost('r5', net.ipv4.ip_forward=1')
cls=Node, ip='0.0.0.0')
r4 = net.addHost('r4',
r5.cmd('sysctl -w cls=Node,
net.ipv4.ip_forward=1') ip='192.168.1.2/30')
s2 = net.addSwitch('s2', r4.cmd('sysctl -w
cls=OVSKernelSwitch) net.ipv4.ip_forward=1')
r4 = net.addHost('r4', r5 = net.addHost('r5',
cls=Node, ip='0.0.0.0') cls=Node, ip='10.0.6.1/24')
r4.cmd('sysctl -w r5.cmd('sysctl -w
net.ipv4.ip_forward=1') net.ipv4.ip_forward=1')
h2 = net.addHost('h2', h1 = net.addHost('h1',
cls=Host, ip='10.0.0.2', cls=Host, ip='10.0.5.2/24',
defaultRoute=None) defaultRoute='via 10.0.5.1')
h1 = net.addHost('h1', h2 = net.addHost('h2',
cls=Host, ip='10.0.0.1', cls=Host, ip='10.0.6.2/24',
defaultRoute=None) defaultRoute='via 10.0.6.1')
net.addLink(r4, r5,
intfName1='r4-eth1',
params1={ 'ip' :
'192.168.2.1/30'},
intfName2='r5-eth1',
params2={ 'ip' :
'192.168.2.2/30'} )
# Adds static routes
r3.cmd('route add -net
10.0.6.0/24 gw 192.168.1.2
r3-eth1')
knowledge of how to assign IPs among hosts, routers, switches, etc. It also requires
use custom IPs like PA#4, he needs to have net = Mininet( topo=None). The custom
2. Though we have not used it, we recommend using variables for all addresses
So one needs to adjust IP for one or more entities, he can do it in the variables
without touching the rest of the code.
3. Adding static routes are needed. One can add them manually or programmatically. If one
chooses to add programmatically, these routes persist as long as the program is running.
programmatic additions.
b) Why didn’t the original program forward packets between the hosts?
The original program does not forward packets between the hosts due to the following reasons:
2. For adding links between r3 and r4, the required r3-eth1 and r4-eth0 were not set
this line causes at least a 30 % drop and the packets do not get transmitted