This repository is lab for NCTU course "Introduction to Computer Networks 2018".
In this lab we are going to learn how to use Scapy - a powerful interactive packet manipulation program, which can forge or decode packets of a wide number of protocols, send them on wire, capture them, match requests and replies, and much more. By using Scapy, we are going to define our own protocol to compute Fibonacci number through packets sending and receiving.
This lab aims to learn how we use Scapy and Python to program a simple network protocol and observe the behavior of packet sending and receiving via Wireshark.
- Basic knowledge of Docker
- Linux networking
- Python with Scapy
- Wireshark
- Git & GitHub
- In lab course (Oct. 11 @EC-315, 316)
- Environment Setup
- Define protocol via Scapy
- Send packets
- Sniff packets
- Run sender and receiver
- Push your files to remote
- Homework
- Load PCAP via Wireshark
- Filter the target packet
- Decode the secret key
- Report
This repository is inspired by Kevin Cyu. He gave me lots of advices and supports during preparation.
GNU GENERAL PUBLIC LICENSE Version 3
This repository is lab for NCTU course "Introduction to Computer Networks 2018".
In this lab, we are going to write a Python program which can generate a network topology using Mininet and use iPerf to measure the bandwidth of the topology.
- Learn how to create a network topology with Mininet
- Learn how to measure the bandwidth in your network topology with iPerf
TODO:
- Describe how you finish this work step-by-step in detail
-
Environment Setup
This step is easy because Lab1 did the same thing before. First, we join the Lab2-class and connect to the docker container. Furthermore, clone your lab2 assignment to your container to modify. Last, try command "mn" to test if we can execute it successfully. Then we finished the first step.
-
Example of Mininet
In the file we clone from github-Lab2, there is a file named "example.py". Step 2 is mainly to test if we can execute the program successfully. "example.py" is a basic topology that one controller, one switch, and two host that connect to the switch.
After executing "example.py", we get some useful information such as the host and switch we create and links between host and switch. Furthermore, we can see every links' state. In this case, there is no missing packet. Last but not least, if we met the error "...File exists", we input the command "[sudo]mn -c" to clear. If we understand the program "example.py", then we go to the next step.
-
Topology Generator
Step 3, First, find out the correct topology picture we need. In my case, I get 0616225mod3 = 1, so I use topo1 picture as my Lab2.
Second, we should write a python program to simulate the topo1.picture shown below.
We can refer to example.py to finish our program named "topology.py". Actually, it is not difficult if we understand every code in "example.py". All we need to modify is add host, switch, link respcetively and set parameters such as delay, bandwidth, and loss according to topology picture1. Furthermore, add function dumpnodeconnection() and CLI() to get more detailed information. If we met the same error "...File exists", refer to the troubleshooting above. After finishing "topology.py", we can go to the last step.
-
Measurement
The last step is to use "iperf" command to measure the topology we build. According to the introduction to LAB2, we connect host4(server) and host2(client) to measure the connectivity between them in this topology. After testing my topology, I get the similar outcome with the outcome the introduction provided. Furthermore, the command we type will send the final report to a folder we assign. We can check whether the outcome is similar to the outcome introduction provieded. If they are similar, we get the correct outcome and finish Lab2.
TODO:
- Please add your references in the following
- Markdown CheatSheet
- Mininet
- Python
- Others
TODO:
- Please replace "YOUR_NAME" and "YOUR_GITHUB_LINK" into yours
GNU GENERAL PUBLIC LICENSE Version 3
This repository is a lab for NCTU course "Introduction to Computer Networks 2018".
In this lab, we are going to write a Python program with Ryu SDN framework to build a simple software-defined network and compare the different between two forwarding rules.
- Learn how to build a simple software-defined networking with Ryu SDN framework
- Learn how to add forwarding rule into each OpenFlow switch
1. Environment Setup
This Step is the easiest. I first joined the class in Github and successfully connected to my containter with putty. After that, I clone the lab3 document from github then try to run mininet. When I try to execute mininet, I met some error. However, I followed the troubleshooting in slides and solved the problem.
2. Example of Ryu SDN
In Task2, I follow the slides running SimpleTopo.py
with mininet, and then open another terminal to execute SimpleController.py
. After doing Task2, I realize that these two files are relevant. SimpleController.py
can affect SimpleTopo.py
using Ryu command.
3. Mininet Topology
Task3 started to enter the main topic of Lab3. First, I modified SimpleTopo.py
, add some constraint between links refer to topo.png
and save as topo.py
. Because of the experience of Lab2, I didn't meet problem in task3.
4. Ryu Controller
In Task4, I modified SimpleController.py
and save as controller.py
. After observing SimpleController.py
carefully, I realize that the code we should modified in controller.py
is the port number. We should modified the port number of links between switches and hosts according to the picture's forwarding rules in slides page 35. As for how did I know the port number of every links? I observed that there are some information in topo.py
. When creating every links in topo.py
, it added the source port number and destination port nubmer. Furthermore, we can type links
in minnet CLI, it will show that every links' state and the port numbers they use. With these information, I finished the Task4.
5. Measurement
In Task5, First I execute topo.py
using mininet in one terminal and execute SimpleController.py
using ryu-manager in another terminal. Then, I input iperf command in mininet CLI in topo.py
. The iperf command are used to measure the connection condtion between host1 and host2. After finishing measurement, I execute topo.py
again. Then, I execute controller.py
in another terminal and then using iperf command in mininet CLI. After measuring, I got two results of connection condition of different forwarding rules. Then I can compare their difference.
- Ryu SDN
- Python
- Others
GNU GENERAL PUBLIC LICENSE Version 3