Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2014 Kenneth M. Chipps Ph.D. www.chipps.com Software Defined Networking Lab Using Mininet and the POX Controller Last Update 2014.02.04 2.1.0.

Similar presentations


Presentation on theme: "Copyright 2014 Kenneth M. Chipps Ph.D. www.chipps.com Software Defined Networking Lab Using Mininet and the POX Controller Last Update 2014.02.04 2.1.0."— Presentation transcript:

1 Copyright 2014 Kenneth M. Chipps Ph.D. Software Defined Networking Lab Using Mininet and the POX Controller Last Update

2 Sources This lab uses the OpenFlow Tutorial sample lab from penFlow_Tutorial#Download_Files and content from the book Software Defined Networking with OpenFlow by Siamak Azodolmolky Copyright 2014 Kenneth M. Chipps Ph.D. 2

3 The SDN Lab For this lab on SDN we will be using Mininet to create the SDN hardware and OpenFlow commands to define how the hardware acts Copyright 2014 Kenneth M. Chipps Ph.D. 3

4 What is Mininet Mininet is a network emulator, not a simulator It can be used to create virtual hosts, hubs, switches, controllers, and links The code used in Mininet can be used with no or minimal changes on real SDN OpenFlow networks Copyright 2014 Kenneth M. Chipps Ph.D. 4

5 Flow of the Lab In this lab you will –Simulate a multi-switch, multi-host network with Mininet –Create flow tables from the command line –Setup a controller to download the flow entries –View OpenFlow messages with Wireshark Copyright 2014 Kenneth M. Chipps Ph.D. 5

6 Flow of the Lab After the tutorial, you can apply what you've learned to physical networks based on software switches or SDN capable hardware switches at line rate Here are the steps we will go through Copyright 2014 Kenneth M. Chipps Ph.D. 6

7 Flow of the Lab –Download the virtual machine –Setup the virtual machine –Check the setup in Linux –Create the network –Examine the network –Work with basic OpenFlow commands –Add a controller Copyright 2014 Kenneth M. Chipps Ph.D. 7

8 Download the Virtual Machine For this lab a virtual machine appliance in ovf format must be downloaded from the OpenFlow Tutorial website here –https://github.com/downloads/mininet/mininet/ mininet amd64-ovf.zip Download this file Expand the zip file You should see these files Copyright 2014 Kenneth M. Chipps Ph.D. 8

9 Download the Virtual Machine Copyright 2014 Kenneth M. Chipps Ph.D. 9

10 Setup the Virtual Machine To import this appliance into VirtualBox –Select File –Import Appliance »Select the ovf image »Press the Import button This lab requires two virtual NICs –The first one should be set to host-only network –The second one to NAT Copyright 2014 Kenneth M. Chipps Ph.D. 10

11 Check Linux Mininet is a command line tool that runs in Linux The Mininet prompt looks like this –mininet> The Linux prompt ends with a $ for a normal user It ends in # for the root account Copyright 2014 Kenneth M. Chipps Ph.D. 11

12 Check Linux We will use the sudo command to run the Linux commands with root privileges at the normal user prompt Copyright 2014 Kenneth M. Chipps Ph.D. 12

13 Check Linux Start the virtual machine Login to Linux The login is –mininet The screen should look like this Copyright 2014 Kenneth M. Chipps Ph.D. 13

14 Check Linux Copyright 2014 Kenneth M. Chipps Ph.D. 14

15 Check Linux Let’s see if the two network interfaces are setup correctly At the Linux prompt enter –ifconfig Copyright 2014 Kenneth M. Chipps Ph.D. 15

16 Check Linux Three interfaces should appear Two physical interfaces called –eth0 –eth1 –And the loopback interface Copyright 2014 Kenneth M. Chipps Ph.D. 16

17 Check Linux One of the physical interfaces should have a 192 address and the other a 10 address We will access the virtual machine using a terminal program using the 192 address If either of the eth Ethernet interfaces are missing, run this command –sudo dhclient ethx Where the x in ethx is the number of the interface Copyright 2014 Kenneth M. Chipps Ph.D. 17

18 Check Linux Copyright 2014 Kenneth M. Chipps Ph.D. 18

19 Check Linux As you can see the eth1 interface is missing After the dhclient command is run this appears Copyright 2014 Kenneth M. Chipps Ph.D. 19

20 Check Linux Copyright 2014 Kenneth M. Chipps Ph.D. 20

21 Create the Network Pay close attention to the prompt shown for each command It makes a difference The basic network we will start with looks like this Copyright 2014 Kenneth M. Chipps Ph.D. 21

22 Create the Network Copyright 2014 Kenneth M. Chipps Ph.D. 22

23 Create the Network H2 H3 and H4 are just generic end devices In the real world they would be PCs, printers, VOIP telephones and so forth The others are the SDN devices - a switch and a controller Copyright 2014 Kenneth M. Chipps Ph.D. 23

24 Create the Network These commands can be entered in the VirtualBox window from the keyboard Or a terminal program such as Putty can be used so the commands can be pasted Let’s start Putty and connect to the virtual machine Use the 192 IP address Putty defaults to SSH Copyright 2014 Kenneth M. Chipps Ph.D. 24

25 Create the Network So just enter the address and click open The login in is the same as before –mininet Copyright 2014 Kenneth M. Chipps Ph.D. 25

26 Create the Network Copyright 2014 Kenneth M. Chipps Ph.D. 26

27 Create the Network To paste a command, copy it from here and right click on the command prompt shown in Putty The virtual machine is setup with Mininet installed and ready to run Issue this command to create the SDN devices and links for this lab Copyright 2014 Kenneth M. Chipps Ph.D. 27

28 Create the Network It all goes on one line in Linux –$ sudo mn --topo single,3 --mac --switch ovsk --controller remote This tells Mininet to start up a three host, single – openvSwitch based - switch topology, set the MAC address of each host equal to its IP, and point to a remote controller which defaults to the localhost The screen should look like this Copyright 2014 Kenneth M. Chipps Ph.D. 28

29 Create the Network Copyright 2014 Kenneth M. Chipps Ph.D. 29

30 Create the Network Here's what Mininet just did –Created three virtual hosts –Created a single OpenFlow software switch with three ports –Connected each virtual host to the switch with a virtual Ethernet cable –Set the MAC address of each host equal to its IP address –Configured the OpenFlow switch to connect to the controller Copyright 2014 Kenneth M. Chipps Ph.D. 30

31 Create the Network These devices do the following –An OpenFlow Controller The controller creates and transfer to the flow commands to the switches –An OpenFlow Switch This is a software based switch that takes commands from the controller that are used to handle the frames it receives Copyright 2014 Kenneth M. Chipps Ph.D. 31

32 Examine the Network Notice that the Linux prompt is gone This is the mininet prompt Let’s see what we made At the Mininet prompt enter –mininet>nodes This should appear Copyright 2014 Kenneth M. Chipps Ph.D. 32

33 Examine the Network Copyright 2014 Kenneth M. Chipps Ph.D. 33

34 Examine the Network We can also see the network using –mininet>net And see information about all the nodes with –mininet>dump Copyright 2014 Kenneth M. Chipps Ph.D. 34

35 Examine the Network Copyright 2014 Kenneth M. Chipps Ph.D. 35

36 Work With OpenFlow In OpenFlow to look at a switch’s flow table the dpctl – data path control command can be used Most OpenFlow switches start up with a passive listening port from which you can poll the switch, without having to add debugging code to the controller Copyright 2014 Kenneth M. Chipps Ph.D. 36

37 Work With OpenFlow For example the command –$ dpctl show tcp: :6634 will connect to the switch and dump out its port state and capabilities This command can be run from the Mininet prompt as well in this form –mininet>dpctl show I am going to open another Putty connection to do this Copyright 2014 Kenneth M. Chipps Ph.D. 37

38 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 38

39 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 39

40 Work With OpenFlow This command looks at the flow table –$ dpctl dump-flows tcp: :6634 –or –mininet>dpctl dump-flows Since we haven't started a controller yet, the flow-table should be empty Copyright 2014 Kenneth M. Chipps Ph.D. 40

41 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 41

42 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 42

43 Work With OpenFlow With the virtual hardware setup let’s check network connectivity from the Mininet console –mininet>h1 ping –c3 h2 The syntax for ping in mininet is –Ping from – h1 here –Number of pings – 3 times in this example –Ping to – h2 here Copyright 2014 Kenneth M. Chipps Ph.D. 43

44 Work With OpenFlow For a continuous ping h1 ping h2 CRTL c to stop the ping Copyright 2014 Kenneth M. Chipps Ph.D. 44

45 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 45

46 Work With OpenFlow Did you get any replies As you saw before, the switch flow table is empty Besides that, the controller is not yet configured to provide flow handling instructions to the switch and therefore the switch doesn't know what to do with incoming traffic, leading to ping failure Copyright 2014 Kenneth M. Chipps Ph.D. 46

47 Work With OpenFlow Let’s add some flows using dpctl first The dpctl command can do this on an individual switch without a controller These flows are meant to be transitory As we are working with this in a lab rather than in a realtime line rate network we need to increase the timeout before we add any flows or we will have to keep reentering the flows Copyright 2014 Kenneth M. Chipps Ph.D. 47

48 Work With OpenFlow To increase the timeout to 5 minutes enter this command –$dpctl add-flow tcp: :6634 in_port=1,idle_timeout=300,actions=output:2 Now we can add the flow commands This is an example of a proactive entry to the flow table as it will be added before the traffic it will handle has crossed the network In the other lab we will use reactive mode Copyright 2014 Kenneth M. Chipps Ph.D. 48

49 Work With OpenFlow Type this all on one line –$ dpctl add-flow tcp: :6634 in_port=1,actions=output:2 And this also all on one line –$ dpctl add-flow tcp: :6634 in_port=2,actions=output:1 Copyright 2014 Kenneth M. Chipps Ph.D. 49

50 Work With OpenFlow This will forward packets coming to port 1 to port 2 and vice-versa Verify this by checking the flow-table with –$ dpctl dump-flows tcp: :6634 Copyright 2014 Kenneth M. Chipps Ph.D. 50

51 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 51

52 Work With OpenFlow Run the ping command again in the mininet console –mininet> h1 ping -c3 h2 Did you get replies now Copyright 2014 Kenneth M. Chipps Ph.D. 52

53 Work With OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 53

54 Work With OpenFlow Check the flow-table again and look at the statistics for each flow entry Is this what you expected to see based on the ping traffic Copyright 2014 Kenneth M. Chipps Ph.D. 54

55 Activate Wireshark Wireshark is useful here to examine the traffic generated by OpenFlow The virtual machine being used for this lab has Wireshark already installed Let’s see how we get it working in this environment We will have to use a new SSH session using X11 as Wireshark uses a GUI interface Copyright 2014 Kenneth M. Chipps Ph.D. 55

56 Activate Wireshark To run an application that uses a GUI X11 is required This can be done at either end Under Windows, the Xming server must be running, and you must make an SSH connection with X11 forwarding enabled Copyright 2014 Kenneth M. Chipps Ph.D. 56

57 Activate Wireshark First, search the Internet for and download the Xming server Install it Start Xming Xming will not show any window, but you can verify that it is running by looking for its process in Window's task bar Copyright 2014 Kenneth M. Chipps Ph.D. 57

58 Activate Wireshark Second, make an SSH connection with X11 forwarding enabled If you are using Putty, you can connect to the lab by entering the VM's IP address for the 192 address NIC and enabling X11 forwarding Copyright 2014 Kenneth M. Chipps Ph.D. 58

59 Activate Wireshark To enable X11 forwarding from Putty's GUI, go to PuttyConnection | SSH | X11, then click on Enable X11 Forwarding, as shown in the following screenshot Copyright 2014 Kenneth M. Chipps Ph.D. 59

60 Activate Wireshark Copyright 2014 Kenneth M. Chipps Ph.D. 60

61 Activate Wireshark Or X11 can be added to the VM itself To install X11 and a simple window manager, from the VM console window enter –$ sudo apt-get update –$ sudo apt-get install xinit flwm Start an X11 session in the VM console window by typing –$ startx Copyright 2014 Kenneth M. Chipps Ph.D. 61

62 Activate Wireshark Now start Wireshark as a background process –$sudo wireshark $ Click on OK to clear any error messages Copyright 2014 Kenneth M. Chipps Ph.D. 62

63 Observe SDN Traffic Start a capture in Wireshark using the loopback interface Create and apply a filter for just the OpenFlow traffic by entering a display filter in Wireshark using the string –of Copyright 2014 Kenneth M. Chipps Ph.D. 63

64 Load the Controller To generate some traffic we will load a controller as that is the next step anyway There are a number of software based or hardware based controllers that can be used in an SDN In this example we will load the POX controller The developers of this controller say this about it Copyright 2014 Kenneth M. Chipps Ph.D. 64

65 POX Controller –POX is NOX‘s younger sibling –At its core, it’s a platform for the rapid development and prototyping of network control software using Python –Meaning, at a very basic level, it’s one of a growing number of frameworks (including NOX, Floodlight, Trema, etc., etc.) for helping you write an OpenFlow controller Copyright 2014 Kenneth M. Chipps Ph.D. 65

66 POX Controller –POX also goes beyond this –As well as being a framework for interacting with OpenFlow switches, we’re using it as the basis for some of our ongoing work to help build the emerging discipline of Software Defined Networking –We’re using it to explore and prototype distribution, SDN debugging, network virtualization, controller design, and programming models Copyright 2014 Kenneth M. Chipps Ph.D. 66

67 Load the Controller To start POX enter these commands –$cd pox –./pox.py forwarding.l2_learning If the command prompt does not appear after running this command, press enter Copyright 2014 Kenneth M. Chipps Ph.D. 67

68 Load the Controller Copyright 2014 Kenneth M. Chipps Ph.D. 68

69 Observe SDN Traffic Switch back to the Wireshark window to see the activity as the controller loads Copyright 2014 Kenneth M. Chipps Ph.D. 69

70 Observe SDN Traffic Copyright 2014 Kenneth M. Chipps Ph.D. 70

71 Summary We now have a complete Software Defined Network whose actions are defined by OpenFlow Copyright 2014 Kenneth M. Chipps Ph.D. 71


Download ppt "Copyright 2014 Kenneth M. Chipps Ph.D. www.chipps.com Software Defined Networking Lab Using Mininet and the POX Controller Last Update 2014.02.04 2.1.0."

Similar presentations


Ads by Google