wiki:Tutorials/m0SDN/aHelloOF

Version 1 (modified by ssugrim, 9 years ago) ( diff )

1. Running the network

As a two-node example, we image the nodes on Sandbox8, as explained in 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
    
  1. Start the controller on one node. We arbitrarily pick 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 
    
  2. 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
...
Note: See TracWiki for help on using the wiki.