9 | | For people interested in installing these tools, they can visit the links above, or go to [#install Section] for a concise summary of each. |
10 | | |
11 | | == Installation == |
| 9 | This makes things easy since you can image multiple nodes with the same image, and pick and choose controllers, switches, etc. For people interested in installing these tools and/or Floodlight, they can refer to [#install Section II] for a concise summary of each and further links. |
| 10 | |
| 11 | == imaging == #imaging |
| 12 | The image is named `of-pkg.ndz`. `omf` can be used to image nodes with it: |
| 13 | {{{ |
| 14 | $ omf load -i of-pkg.ndz |
| 15 | }}} |
| 16 | The nodes will be off after it's imaged. Turn them on: |
| 17 | {{{ |
| 18 | $ omf tell -a on |
| 19 | }}} |
| 20 | Once on, you can log into them as root using their names, e.g. '''node1-1'''. |
| 21 | |
| 22 | == Setting up an OF network == #nw_setup |
| 23 | === general information === |
| 24 | ''' node/Sandbox layout ''' [[BR]] |
| 25 | When you log onto a Sandbox, you are logged into the '''console''' machine, from which you can use `omf` and the likes to image and log onto/manage the nodes. |
| 26 | |
| 27 | Each node (save those on sandbox4) have two interfaces. The first, eth1, connects to your console connection for managing the nodes, and is assigned an IP address of the form 10.1x.y.z, where x = sandbox number, and y and z = node number e.g. if your node is named node1-2, and is part of Sandbox8, it will be 10.18.1.2. '''Do not take down this interface or change its address - you will lose your connection'''. The second, eth0, is down by default, and is open to any kind of use. Both are gigabit links and can be used for experimentation, but in general, the second one should be used unless there are specific circumstances. |
| 28 | |
| 29 | ''' managing/configuring nodes ''' [[BR]] |
| 30 | This is done by using SSH to log into the nodes as root. Logging into each is okay, but can get cumbersome if you have many nodes, on which you have to do the exact same thing. In this case, commands may also be issued via SSH from the console, without manually logging into each node (and ending up with a dozen terminal windows): |
| 31 | {{{ |
| 32 | user@console.sb8:~$ ssh -o StrictHostKeyChecking="no" root@node1-1 "command_to_run_1;command_to_run_2" |
| 33 | }}} |
| 34 | This runs command_to_run_1 and command_to_run_2 on node1-1 as if you'd logged into it to issue it at the shell. |
| 35 | |
| 36 | Each command is delimited by a semicolon, and the full string is surrounded by double quotes. The `-o StrictHostKeyChecking="no"` stops SSH from checking host keys and is optional. [[BR]] |
| 37 | This can be used in a script to run from the console to quickly set up many nodes. We use it in some of the following examples to make it easier to show what is happening where. |
| 38 | |
| 39 | === setup - by example === |
| 40 | As a two-node example, we image the nodes on Sandbox8. One is used for the controller, and the other, the Mininet network. |
| 41 | |
| 42 | 1. ''Bring up and assign addresses to eth0 of the nodes''. Both should be in the same IP block. From console, the commands look like this: |
| 43 | {{{ |
| 44 | $ ssh root@node1-1 "ifconfig eth0 inet 192.168.1.1 up" |
| 45 | $ ssh root@node1-2 "ifconfig eth0 inet 192.168.1.2 up" |
| 46 | }}} |
| 47 | The nodes should now be able to ping eachother via eth0: |
| 48 | {{{ |
| 49 | $ ssh root@node1-1 "ping -c 1 192.168.1.2" |
| 50 | PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. |
| 51 | 64 bytes from 192.168.1.2: icmp_req=1 ttl=64 time=0.614 ms |
| 52 | |
| 53 | --- 192.168.1.2 ping statistics --- |
| 54 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms |
| 55 | rtt min/avg/max/mdev = 0.614/0.614/0.614/0.000 ms |
| 56 | }}} |
| 57 | |
| 58 | 2. ''Start the controller on one node''. We arbitrarily pick node1-1. On node1-1, launch Floodlight: |
| 59 | {{{ |
| 60 | # cd floodlight |
| 61 | # java -jar target/floodlight.jar |
| 62 | }}} |
| 63 | Floodlight should now be listening to port 6633 on all interfaces available on the node (eth0, 1, and lo). If you want, you can start up `tcpdump` or something similar to begin capturing on the same node: |
| 64 | {{{ |
| 65 | # tcpdump -i lo port 6633 |
| 66 | }}} |
| 67 | |
| 68 | 3. ''Launch Mininet''. On node1-2: |
| 69 | {{{ |
| 70 | # mn --topo=single,2 --controller=remote,ip=192.168.1.1 |
| 71 | }}} |
| 72 | This will give you a virtual network of two hosts and one switch pointed to the running Floodlight instance on node1-1. Once at the prompt, try pinging one host from the other (it should work): |
| 73 | {{{ |
| 74 | mininet> h1 ping h2 |
| 75 | PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. |
| 76 | 64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=8.19 ms |
| 77 | 64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.164 ms |
| 78 | 64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.025 ms |
| 79 | 64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.024 ms |
| 80 | ^C |
| 81 | --- 10.0.0.2 ping statistics --- |
| 82 | 4 packets transmitted, 4 received, 0% packet loss, time 2999ms |
| 83 | rtt min/avg/max/mdev = 0.024/2.101/8.193/3.517 ms |
| 84 | }}} |
| 85 | At the same time, you should see (lots of) packets being captured by tcpdump in node1-1's terminal: |
| 86 | {{{ |
| 87 | root@node1-1:~/floodlight# tcpdump -i eth0 port 6633 |
| 88 | tcpdump: verbose output suppressed, use -v or -vv for full protocol decode |
| 89 | listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes |
| 90 | 20:18:30.188181 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [S], seq 3242563912, win 14600, options [mss 1460,sackOK,TS val 699854 ecr 0,nop,wscale 4], length 0 |
| 91 | 20:18:30.188321 IP 192.168.1.1.6633 > 192.168.1.2.41631: Flags [S.], seq 2665849071, ack 3242563913, win 14480, options [mss 1460,sackOK,TS val 700809 ecr 699854,nop,wscale 4], length 0 |
| 92 | 20:18:30.188466 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [.], ack 1, win 913, options [nop,nop,TS val 699854 ecr 700809], length 0 |
| 93 | 20:18:30.188618 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [F.], seq 1, ack 1, win 913, options [nop,nop,TS val 699854 ecr 700809], length 0 |
| 94 | 20:18:30.190310 IP 192.168.1.1.6633 > 192.168.1.2.41631: Flags [.], ack 2, win 905, options [nop,nop,TS val 700810 ecr 699854], length 0 |
| 95 | 20:18:30.224204 IP 192.168.1.1.6633 > 192.168.1.2.41631: Flags [P.], seq 1:9, ack 2, win 905, options [nop,nop,TS val 700818 ecr 699854], length 8 |
| 96 | 20:18:30.224426 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [R], seq 3242563914, win 0, length 0 |
| 97 | 20:18:30.402564 IP 192.168.1.2.41632 > 192.168.1.1.6633: Flags [S], seq 1611313095, win 14600, options [mss 1460,sackOK,TS val 699908 ecr 0,nop,wscale 4], length 0 |
| 98 | 20:18:30.402585 IP 192.168.1.1.6633 > 192.168.1.2.41632: Flags [S.], seq 367168075, ack 1611313096, win 14480, options [mss 1460,sackOK,TS val 700863 ecr 699908,nop,wscale 4], length 0 |
| 99 | ... |
| 100 | }}} |
| 101 | |
| 102 | ---- |
| 103 | = II. Installation = #install |
267 | | ==== use ==== |
| 360 | === run === |
| 361 | There are two tools pre-packaged with liboftrace (as per a [https://mailman.stanford.edu/pipermail/openflow-discuss/2009-April/000133.html mailing-list entry]): |
| 362 | 1. ofstats: a program which calculates the controller processing delay, i.e., the difference in time between a packet_in message and the corresponding packet_out or flow_mod message. |
| 363 | 1. ofdump: a program that simply lists openflow message types with timestamps by switch/controller pair. |
| 364 | Both have the same syntax: |
| 365 | {{{ |
| 366 | [ofstats|ofdump] [controller IP] [OF port] |
| 367 | }}} |
| 368 | Without the arguments it defaults to localhost:6633. |
| 369 | |
| 370 | For example, with a pcap file named sample.pcap from a `tcpdump` session sniffing for traffic from a controller at 192.168.1.5, port 6637: [[BR]] |
| 371 | ofdump: |
| 372 | {{{ |
| 373 | # ofdump sample.pcap 192.168.1.5 6637 |
| 374 | DBG: tracking NEW stream : 192.168.1.5:6637-> 192.168.1.6:47598 |
| 375 | DBG: tracking NEW stream : 192.168.1.6:47598-> 192.168.1.5:6637 |
| 376 | FROM 192.168.1.5:6637 TO 192.168.1.6:47598 OFP_TYPE 0 LEN 8 TIME 0.000000 |
| 377 | FROM 192.168.1.6:47598 TO 192.168.1.5:6637 OFP_TYPE 0 LEN 8 TIME 0.026077 |
| 378 | FROM 192.168.1.5:6637 TO 192.168.1.6:47598 OFP_TYPE 5 LEN 8 TIME 0.029839 |
| 379 | FROM 192.168.1.6:47598 TO 192.168.1.5:6637 OFP_TYPE 6 LEN 128 TIME 0.1070415 |
| 380 | |
| 381 | ... |
| 382 | |
| 383 | FROM 192.168.1.6:47598 TO 192.168.1.5:6637 OFP_TYPE 10 LEN 60 TIME 0.2038485 |
| 384 | --- 2 sessions: 0 0 |
| 385 | FROM 192.168.1.5:6637 TO 192.168.1.6:47598 OFP_TYPE 13 LEN 24 TIME 0.2038523 |
| 386 | FROM 192.168.1.6:47598 TO 192.168.1.5:6637 OFP_TYPE 10 LEN 60 TIME 0.2038573 |
| 387 | FROM 192.168.1.5:6637 TO 192.168.1.6:47598 OFP_TYPE 13 LEN 24 TIME 0.2038614 |
| 388 | FROM 192.168.1.6:47598 TO 192.168.1.5:6637 OFP_TYPE 10 LEN 60 TIME 0.2038663 |
| 389 | FROM 192.168.1.5:6637 TO 192.168.1.6:47598 OFP_TYPE 13 LEN 24 TIME 0.2038704 |
| 390 | Total OpenFlow Messages: 20015 |
| 391 | }}} |
| 392 | ofstats: |
| 393 | {{{ |
| 394 | # ofstats sample.pcap 192.168.1.5 6637 |
| 395 | Reading from pcap file 1.pcap for controller 192.168.1.5 on port 6637 |
| 396 | DBG: tracking NEW stream : 192.168.1.5:6637-> 192.168.1.6:47598 |
| 397 | DBG: tracking NEW stream : 192.168.1.6:47598-> 192.168.1.5:6637 |
| 398 | 0.008088 secs_to_resp buf_id=333 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 0 queued |
| 399 | 0.000454 secs_to_resp buf_id=334 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 2 queued |
| 400 | 0.000437 secs_to_resp buf_id=335 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 1 queued |
| 401 | 0.000534 secs_to_resp buf_id=336 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 0 queued |
| 402 | 0.000273 secs_to_resp buf_id=337 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 2 queued |
| 403 | 0.000486 secs_to_resp buf_id=338 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 2 queued |
| 404 | 0.000379 secs_to_resp buf_id=339 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 1 queued |
| 405 | 0.000275 secs_to_resp buf_id=340 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 0 queued |
| 406 | ... |
| 407 | 0.000135 secs_to_resp buf_id=10330 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 1 queued |
| 408 | 0.000132 secs_to_resp buf_id=10331 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 1 queued |
| 409 | 0.000131 secs_to_resp buf_id=10332 in flow 192.168.1.5:6637 -> 192.168.1.6:47598 - packet_out - 0 queued |
| 410 | }}} |
| 411 | |
| 412 | Since the outputs are dumped to stdout it is probably best to redirect it to a file for parsing later, like so: |
| 413 | {{{ |
| 414 | # ofstats sample.pcap 192.168.1.5 6637 > outfile |
| 415 | }}} |