=== Hello World Open Flow === In this tutorial we'll preform a simple test of OF concepts. We will be leveraging some existing software tools, specifically: * [http://mininet.org/ Mininet] * [http://www.projectfloodlight.org/floodlight/ floodlight] In this experiment Mininet will serve as the source of [https://www.opennetworking.org/about/onf-overview open flow traffic], floodlight will be the controller. Rather than build these tools from scratch, we will instead use two pre-made images with these tools already installed. ---- ''' 0. Setup ''' Preform the usual startup procedure: 1. [[CollapsibleStart(Create resource reservation")]][[Include(Documentation/Short/CreateRes)]][[CollapsibleEnd]] The user needs a set of nodes/resources from a domain to run the experiment on.For the rest of this tutorial we will assume that the the reserveation was made for sb1 domain. 2. [[CollapsibleStart(Login into reserved domain: "ssh username@sb1.orbit-lab.org")]][[Include(Documentation/Short/Login)]][[CollapsibleEnd]] After you receive the confirmation email, you can access the reserved domain by ssh to the corresponding domain console. 3. Load the controller on '''node1-1'''. The image name is ''OF-Tutorial-Floodlight-12-7-2014.ndz'' {{{ omf load -t node1-1 -i OF-Tutorial-Floodlight-12-7-2014.ndz }}} '''NOTE:''' All subsequent instructions assume the controller is running on '''node1-1''' 4. Load the Mininet instance on '''node1-2'''. The image name is ''OF-Tutorial-Mininet-12-7-2014.ndz'' {{{ omf load -t node1-2 -i OF-Tutorial-Mininet-12-7-2014.ndz }}} 5.Once loaded turn on both nodes: {{{ omf tell -a on -t all }}} ---- ''' 1. Running the Experiment ''' As a two-node example, we image the nodes on Sandbox8, as explained in [#imaging Section 1.1]. One is used for the controller, and the other, the Mininet network. 1. ''Bring up and assign addresses to eth0 of the nodes''. Both should be in the same IP block. If done from console, the commands look like this: {{{ $ ssh root@node1-1 "ifconfig eth0 inet 192.168.1.1 up" $ ssh root@node1-2 "ifconfig eth0 inet 192.168.1.2 up" }}} The nodes should now be able to ping eachother via eth0: {{{ $ ssh root@node1-1 "ping -c 1 192.168.1.2" PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. 64 bytes from 192.168.1.2: icmp_req=1 ttl=64 time=0.614 ms --- 192.168.1.2 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.614/0.614/0.614/0.000 ms }}} 2. Start the controller on '''node1-1'''. From a shell on node1-1, launch Floodlight: {{{ # cd floodlight # java -jar target/floodlight.jar }}} After you give it a few seconds, Floodlight should 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 on a separate terminal on node1-1 to begin capturing control messages: {{{ # tcpdump -i lo port 6633 }}} Alternatively, you can start `tcpdump` to write to a .pcap file for later analysis with `wireshark` with the !OpenFlow plugin. {{{ # tcpdump -w outfile.pcap -i lo port 6633 }}} 3. ''Launch Mininet''. From another shell on node1-2: {{{ # mn --topo=single,2 --controller=remote,ip=192.168.1.1 }}} 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: {{{ mininet> h1 ping h2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=8.19 ms 64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.164 ms 64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.025 ms 64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.024 ms ^C --- 10.0.0.2 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.024/2.101/8.193/3.517 ms }}} Notice how the first ping takes much longer. This is due to the flow installation process triggered by the first ping (Specifically, the ARPs sent by the hosts) as the switch suffers a flow table miss. At the same time, you should see (lots of) packets being captured by tcpdump in node1-1's terminal: {{{ root@node1-1:~/floodlight# tcpdump -i eth0 port 6633 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 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 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 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 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 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 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 20:18:30.224426 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [R], seq 3242563914, win 0, length 0 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 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 ... }}} ---- ''' 2. Next Steps ''' * Use a different controller image - e.g. Open Day Light * Use a real bare metal switch and real nodes - see NEXT TUTORIAL