联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2020-09-07 10:48

CS5229 - Advanced Computer

Networks - HW 2

Due : Sep 9, 2020 2359 Hrs

Total: 50 points (10% of Grade)

Overview

This HW exposes you to Software Defined Networking (SDN) concepts and the related toolsets. The

SDN architecture decouples network control and forwarding functions such that the network

control is programmable and also abstracting the network infrastructure. You can further refer to

the following references on SDNand OpenFlow.

Software Tools

1) You will be using a Virtual Machine for the assignment. The VM (LUbuntu 16.04) comes

with all the necessary software installed. Download the VM from

comp.nus.edu.sg/~ghadi/CS5229/CS5229.ova (Size: 2.82 GB).

1) The software you will be using are:

? Floodlight SDN Controller 1

? Mininet 2 network emulator

? CBench 3 benchmarking program for OpenFlow Controller

? Network utilities such as iperf3 and ping.

2) To run the VM, you will to download a hypervisor. Install VirtualBox4 in your PC. VirtualBox

supportsWindows/Linux/MacOS.

Running the Programs

2) Goto VirtualBox UI, and do “Import Appliance”, and specify the location of the downloaded

“cs5229.ova” file in order to import the VM.

3) Start the VM once it is imported.

4) You can login to the vm using :

username :cs5229

password: cs5229


1 https://floodlight.atlassian.net/wiki/spaces/floodlightcontroller/overview

2 http://mininet.org/overview/

3 https://floodlight.atlassian.net/wiki/spaces/floodlightcontroller/pages/1343657/Cbench+New

4 https://www.virtualbox.org/wiki/Downloads

Getting System to work:

1. We will be using Mininet to emulate the network uses OpenvSwitch to emulate the

switches, and containers for the hosts connecting to the network. Start your mininet

topology specify in the file Topology1.py. Open a terminal (LXTerminal) and run the

following:

? sudo ~/CS5229/Topology1.py

The topology described in the “Topology1.py” file is shown below.

2. Start the SDN Controller, Floodlight(a java based SDN controller). Open a new terminal, run the

following:

i. cd ~/CS5229/floodlight-1.2

ii. java -Dlogback.configurationFile=logback.xml -jar target/floodlight.jar

Verify the switches are connected to the floodlight controller. You must see the below logs in your floodlight console:

WARN [n.f.c.i.C.s.notification:main] Switch 00:00:00:00:00:00:00:01 connected. WARN [n.f.c.i.C.s.notification:main]

Switch 00:00:00:00:00:00:00:02 connected.

Where, 00:00:00:00:00:00:00:01 is the fixed Datapath ID of Switch S1 and 00:00:00:00:00:00:00:02 is the ID of Switch

S2.

Part I: Validating your mininet Setup

1. Verify the static routing using the ping program. Start a terminal on host h1 by running the

command “xterm h1” in the mininet console. Similarly, start a terminal for host h2 and h3.

Note that the IP addresses of h1, h2 and h3 are 10.0.0.1, 10.0.0.2 and 10.0.0.3 respectively.

From terminal h1, run “ping 10.0.02” and from terminal h2, run “ping 10.0.0.3”

a. Note down the ping latency between h1 and h2

b. Note down the ping latency between h2 and h3.

2. Measure the throughput achievable using the iperf3 program. On h2, run “iperf3 -s”.

a. On h1, run “iperf3 –c 10.0.0.2”. Observe the throughput achievable on server h2.

b. On h3, run “iperf3 –c 10.0.0.2”. Observe the throughput achievable on server h2.

3. Increase the link bandwidth between switch S1 to S2 to 100Gbps. Measure the throughput

achievable between host h2 and h3 using the iperf3 program. You need to restart mininet

with the new Topology1.py configuration.

4. Measure the performance of the OpenFlow controller using the CBench program.

a. Terminate the mininet console to avoid conflicts by typing ”quit”

b. cd ~/CS5229/oflops/cbench

c. run “./cbench –c localhost –p 5229 –m 10000 –l 5 –S 8 –M 1000 –D 600 -t” and observe the

throughput

d. You can find explanations of each argument by run ./cbench –h

Write down the answers for the following: (15pts)

a. What is the ping latency between h1 and h2 in (1a)?

b. What is the ping latency between h2 and h3 in (1b)?

c. What is the throughput achieved from h1 to h2 using iperf3 in (2a)? Explain your

observations?

d. What is the throughput achieved from h3 to h2 using iperf3 in (2b)? Explain your

observations?

e. What is the throughput achieved from h3 to h2 using iperf in (3)? when the link

bandwidth is set to 100Gbps? Explain your observations?

f. What is the throughput of the controller in (4)?

Part II: Setting SDN Policies

You have recently joined as a Network engineer at an Organization. The organization has three

internal departments, namely, Sales, Marketing and R&D as shown in Figure 1. They are

interconnected by a network where the edge switches S1, S2 and S3 respectively are SDN Switches.

The Organization has a specific policy on how the communication between the three departments

should be maintained. As a network engineer, you have to ensure that the networking policies meet

the overall company policy. Being adventurous, you wanted to implement the network using SDN

(Software Defined Networking) . The advantage of using SDN to implement the network is that : 1)

Networks are easily programmable, 2) Centrally Controlled, 3) Network entities can be abstracted

to optimize various resources, and 4) Usage of Open Standards (E.g. OpenFlow). Now, in order to

implement the policies, you plan to write an application on top of a standard SDN Controller which

talks to each of the edge switches(S1/S2/S3) as shown in Figure 1. Consider just 3 hosts operating

in the respective departments (Sales, Marketing and R&D) namely, H1, H2 and H3.

Figure 2: Network Topology

Setting up the Environment

1. The network topology, policy scripts needed for Part II can be found in “~/CS5229/Topology2.py”.

Run

? sudo ./Topology2.py

2. Start the SDN Controller, Floodlight(a java based SDN controller). Open a new terminal, run the

following:

o cd ~/CS5229/floodlight-1.2

o java -Dlogback.configurationFile=logback.xml -jar target/floodlight.jar

3. Now, we will be running our policies as an application over the floodlight controller. Before

anything, we first setup static forwarding in our policy, so that communication happens via the

shortest path. To run this policy file, open a new terminal, run the following:

? ~/CS5229/Policy.py

The Organizational Network Policies to be implemented by you are:

1) Communication between H2 to H3 and vice-versa: (10 points)

Block all traffic using destination UDP ports from 1000-1100.

2) Communication from H1 to H2: (10 points)

Rate limit traffic to 1 Mbps.

3) Communication from H1 to H3: (15 points) Regulate HTTP traffic using the below logic:

? When the total transfer is less than 20Mb, rate limit Traffic to 1Mbps

? If total transfer is between 20Mb to 30Mb, rate limit to 512Kbps

? If total transfer is more than 30Mb, drop packets.

1. Now, it is your turn to implement the company policies in “Policy.py”. Generally, policies are

implemented in the switches in terms of <Match, Action> rules, where a rule matches on

certain header entries of a packet, and takes the corresponding action based on the rule(eg.

Output to a certain port/drop, etc) This file contains basic things/layout needed to write a

policy . You will need to fill(code) in the functions for the appropriatepolicies:

S1toS2()

S2toS3()

S1toS3()

The file is well-commented for you to figure out what is happening in “Policy.py”

Please refer to

https://floodlight.atlassian.net/wiki/display/floodlightcontroller/Static+Entry+Pusher+AP I

for the components and their pre-requisite matches. Typically, a policy string should contain :

1) Switch DPID, 2) Unique Policy Name, 2) Optional Cookie id, 3) Priority, 4) Matching Header

components like eth_type/ipv4_src/ip_proto, etc, 5) actions.

Other resources:

? https://www.opennetworking.org/sdn-resources/sdn-definition

? https://www.opennetworking.org/images/stories/downloads/sdn-resources/onfspecifications/openflow/openflow-spec-v1.3.0.pdf

Some Hints:

a) Make sure you add in your policies with a higher priority than the default static

forwarding rules.

b) For Policy 2, and 3, Make sure you read the Topology2.py completely to get an idea.

c) You need to use queues defined using Topology2.py to implement policy 2 and3

d) You are supposed to use the keys supported for OpenFlow 1.3.

2. Once, you write in your functions in “Policy.py”, you can run it, and verify if the flows are

added to apply the policy by executing the below command, which lists the flows in the

switch :

Curl http://localhost:8080/wm/core/switch/all/flow/json | python -m json.tool

Alternatively, you can open the firefox browser, and type url as “localhost:8080/ui/index.html” to view

all controller information regarding the topology.

How to Test your policies?

1. You will have to generate traffic from the hosts (h1,h2,h3) in order to test the policies.

2. Initially, you can run a terminal on h1,h2 or h3. Run the following in mininet console :

a. xterm h1

b. xterm h2

c. xterm h3

3. Generating TCP/ UDP Packets :

a. You can use iperf3 tool to generate TCP/UDP packets between a pair of nodes, and measure the

link bandwidth.

b. TCP session between h1 and h2 for example :

i. First, start server on h2 by running “iperf3 -s -p <port no.>”

ii. Next, start the client on h1 to connect to h2 by running “iperf3 -c 10.0.0.2 –p <port no.>”

c. UDP session between h1 and h2 for example :

i. First, start server on h2 by running “iperf3 -s -p <port no.>”

ii. Next, start the client on h1 to connect to h2 by running “iperf3 -c 10.0.0.2 –p <port no.> -u”

Submission Instruction

Please zip your completed

1) “PartI.pdf” a PDF file for your answers to Part I,

2) “Policy.py” your policy file

3) “README” file, which explains how you configured the policies and iperf3 logs which

show your solution actually working. Please note that we will be running the code to make sure, the

iperf3 reflects the logs.

Make sure, Policy.py and README also have your NAME/Student No. filled in. Please name your zip

file as <StudentNumber>_HW2.zip and submit to LumiNUS “Student Submission-HW2”.


版权所有:留学生编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。