0% found this document useful (0 votes)
107 views

Programming Assignment 4 Documentation

This programming assignment document outlines changes made to a Python network program to enable communication between two hosts through a router, including assigning IP addresses and default routes to hosts and router interfaces and enabling IP forwarding on the router. Screenshots confirm the updated program allows successful ping tests between the two hosts. The document also discusses lessons learned and troubleshooting steps taken.

Uploaded by

api-524693197
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views

Programming Assignment 4 Documentation

This programming assignment document outlines changes made to a Python network program to enable communication between two hosts through a router, including assigning IP addresses and default routes to hosts and router interfaces and enabling IP forwarding on the router. Screenshots confirm the updated program allows successful ping tests between the two hosts. The document also discusses lessons learned and troubleshooting steps taken.

Uploaded by

api-524693197
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Programming Assignment #4

February 29, 2020

John Fleischli
Levi Remington
Erik Stanton

1. Network Design from each team member:


a. John

b. Levi
c. Erik

2. A list of lines that were changed and why (highlighted were changed):
#!/usr/bin/python
# File: legacy_router.py

from mininet.net import Mininet


from mininet.node import Host, Node
from mininet.cli import CLI
from mininet.log import setLogLevel, info

def myNetwork():
net = Mininet( topo=None,
build=False,
​ipBase='192.168.1.1/24') # Changed ipBase
info( '*** Adding controller\n' )
info( '*** Add switches\n')
r1 = net.addHost('r1', cls=Node) # Removed IP parameter
r1.cmd('sysctl -w net.ipv4.ip_forward=1')

info( '*** Add hosts\n')


h2 = net.addHost('h2', cls=Host, ip='192.168.2.100/24',
defaultRoute='via 192.168.2.1') # Changed ip and defaultRoute
h1 = net.addHost('h1', cls=Host, ip='192.168.1.100/24',
defaultRoute='via 192.168.1.1') # Changed ip and defaultRoute

info( '*** Add links\n')


net.addLink(h1, r1, params2={ 'ip' : '192.168.1.1/24' }) #
Added ip param linking to default route for host
net.addLink(h2, r1, params2={ 'ip' : '192.168.2.1/24' }) #
Added ip param linking to default route for host

info( '*** Starting network\n')


net.build()

CLI(net)
net.stop()

if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()

ipBase was changed to add the subnet ‘/24’ and establish an ip address for the router.
IP parameter was removed for r1 because it was interfering with our hosts’ ability to ping
one another.
Ip and defaultRoute were changed for hosts to assign them to subnets and configure an
acceptable route for successful pinging.
IP param was added to links to match the corresponding defaultRoute of the hosts.

3. Screen capture of program running with no Python errors (needed only if Step 4
and Step 5 below do not work)
Our steps 4 and 5 did work, so no screenshot is included here.

4. Screen capture of successful ‘h1 ping h2’ command at the mininet> prompt

5. Screen capture of successful ‘h2 ping h1’ command at the mininet> prompt

6. Answer questions:
a. What were any interesting findings and lessons learned?
During research for the assignment and from clarification from the Professors, we
found that using the router address as the address for the first host is actually
common practice in the industry. We find it interesting that the router must have
its own address in its routing table so that it pushes it to the host even though it
technically could be perceived as the destination.
b. Why didn’t the original program forward packets between the hosts?
Without declaring interface addresses for each link and default routes for each
host, the hosts had no way to ping one another without switches.
c. Is the line “ r1.cmd(‘sysctl -w net.ipv4.ip_forward=1’) ” required?
Yes, because this line enables the r1 router to be able to forward packets from
port to port. When removing this line from the program, the hosts are unable to
ping one another.
d. Intentionally break your working program, e.g.: change a subnet length, IP
address, or default route for a host. Explain why your change caused the
network to break.
If one was to alter the default route of the hosts or the ip params of the
host-router links to the point that the links are no longer corresponding to the
appropriate host’s default route, then it would interfere with the hosts’ ability to
ping one another.

You might also like