You are on page 1of 9

Programming Assignment 4 – Mininet Routers

Team 1 - Brandon Mccarthy-Santos


, Luis Navarro, Andrew Paulino

Overview
This assignment required us to start with Python code that built a 2 host network
connected by a legacy router. We needed to modify it in order to allow the two hosts to
send packets to each other. To accomplish this task we need to understand subnet
addressing and the functions of a router.

How to run our files…


1. Give permission to our cascript.sh
a. Chmod +x ./cascript.sh
2. Run our script to generate CA Authority
a. Please be advised this may remove any CA authority installed in the
directories at the top of the script.
b. sudo ./cascript.sh
c. Enter www.webpa4.test as common name
3. Run sudo python3 legacy_network.py

Objectives
• Showcase understanding of subnetting
• Showcase understanding of router function
• Showcase python code understanding
Case Study
Consider h1, h2, s1 and r3 to be at a West Coast site and h3, h4, s2, and r5 to be at an
East Coast site. You will modify Level Two script such that all the hosts and routers can
ping each other. This requires that you understand subnet addressing, the function of a
router, and the configuration of static routes. Considering the given case, we developed
a topology using miniedit tool on mininet vm. The topology, along with interfaces and
ip-addresses, is given below.
Objective: 01

Figure 1: Topology for the give use-case

Objective: 02
We generated the level two script into legacy_network.py file. When the file is executed,
the following error is faced.
Figure 2: Error on executing initial level two script

Solution to the above error is moving the two lines instantiating switches s1 and s2
ahead of the legacy router instantiations. Thus, following is the execution of
legacy_network.py file after the mentioned fix.

Figure 3: Execution of level two script after minor fix

But this time the routers and switches were not set up. We read through the
linuxrouter.py file more thoroughly and started adjusting our generated
legacy_network.py file. After inspecting the linuxrouter.py code approach we also
tailored our’s to more appropriately match its specifications.
Objective: 03
Objective: 04

The above lines are changed as per the topology requirement. Some lines are updated
for router IP addresses which miniedit were not supporting. Some lines are updated for
links between switches and routers. Few lines are added for routing among the router
and to show routing table details.
The above lines are changed and added because miniedit has limitations for fixing routers.
To make the topology completely workable one needs to make changes in the level two
python script considering subnetting and other details of the topology.
Objective: 05
• What were any interesting findings and lessons learned?
The whole assignment was very practical. The challenging part was focusing on
dividing networks and allocating IP addresses considering the subnet masks. The
30 bit subnet mask was a bit more tricky in handling routers. Further the python
scripting part was difficult with no helpful material on the Internet. So studying the
linuxrouter.py file for completing our own task was a bit hard. It helped in
considering each line and understanding its value.
• Why didn’t the original program forward packets between the hosts?

Because of lack of routing information with proper IP addresses. Further lack of


connection configuration between switches and routers.
• Is the line ‘ r3.cmd('sysctl -w net.ipv4.ip_forward=1') ’ required?
The term IP Forwarding describes sending a network package from one network
interface to another one on the same device. It must be enabled to forward packets
among different networks. If It is not enabled in our program we wouldn’t be able to
communicate between r3 and r5 and nor hosts can access r4.
• 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.
When the IP address is changed from 10.0.1.4/24 for host1 to 10.0.5.4/24.
It failed to communicate with router1 with IP address 10.0.1.1/24 and
produced the following result.
mininet> h1 ping r3

connect: Network is unreachable

It is because the host1 with IP address 10.0.5.4/24 has the wrong IP network.

Objective: 06
Objective: 07
Objective: 08

You might also like