Changes between Version 2 and Version 3 of Documentation/fSDN/bMininet


Ignore:
Timestamp:
Dec 22, 2014, 5:32:19 PM (10 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/fSDN/bMininet

    v2 v3  
    1 === Getting started with Mininet ===
     1==== Mininet Documentation ====
    22
    33This page documents the usage/installation of mininet as well as it's interaction with OEDL.
    44The main source is the mininet homepage located at http://mininet.org/.
    55
    6 ==== 0. Installation ==== #install
     6''' 0. Installation '''
    77
    88While mininet can be installed via an apt-package, the version that is in the repository is very old and does not have some important features so we will instead install by source. References can be found [http://mininet.org/download/ here]
     
    5555}}}
    5656
    57 
    58 ==== 1. Running the network ==== #nw_setup
    59 
    60 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.
    61 
    62  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:
    63  {{{
    64 $ ssh root@node1-1 "ifconfig eth0 inet 192.168.1.1 up"
    65 $ ssh root@node1-2 "ifconfig eth0 inet 192.168.1.2 up"
    66  }}} 
    67  The nodes should now be able to ping eachother via eth0:
    68  {{{
    69 $ ssh root@node1-1 "ping -c 1 192.168.1.2"
    70 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
    71 64 bytes from 192.168.1.2: icmp_req=1 ttl=64 time=0.614 ms
    72 
    73 --- 192.168.1.2 ping statistics ---
    74 1 packets transmitted, 1 received, 0% packet loss, time 0ms
    75 rtt min/avg/max/mdev = 0.614/0.614/0.614/0.000 ms
    76  }}}
    77 
    78  2. ''Start the controller on one node''. We arbitrarily pick node1-1. From a shell on node1-1, launch Floodlight:
    79  {{{
    80 # cd floodlight
    81 # java -jar target/floodlight.jar
    82  }}}
    83  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:
    84  {{{
    85 # tcpdump -i lo port 6633
    86  }}}
    87  Alternatively, you can start `tcpdump` to write to a .pcap file for later analysis with `wireshark` with the !OpenFlow plugin.
    88  {{{
    89 # tcpdump -w outfile.pcap -i lo port 6633
    90  }}}
    91  3. ''Launch Mininet''. From another shell on node1-2:
    92  {{{
    93 # mn --topo=single,2 --controller=remote,ip=192.168.1.1
    94  }}}
    95  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:
    96  {{{
    97 mininet> h1 ping h2
    98 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
    99 64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=8.19 ms
    100 64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.164 ms
    101 64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.025 ms
    102 64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.024 ms
    103 ^C
    104 --- 10.0.0.2 ping statistics ---
    105 4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    106 rtt min/avg/max/mdev = 0.024/2.101/8.193/3.517 ms
    107  }}}
    108 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:
    109  {{{
    110 root@node1-1:~/floodlight# tcpdump -i eth0 port 6633
    111 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    112 listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
    113 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
    114 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
    115 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
    116 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
    117 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
    118 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
    119 20:18:30.224426 IP 192.168.1.2.41631 > 192.168.1.1.6633: Flags [R], seq 3242563914, win 0, length 0
    120 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
    121 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
    122 ...
    123  }}}
    124 
    125 === 1.2.1 Using Wireshark ===
     57''' Example Usage '''
     58
     59[wiki:/Internal/HelloOF see here]
     60
     61----
     62''' 1.2.1 Using Wireshark '''[[BR]]
     63
    12664In the above example, `tcpdump` can be replaced by `wireshark`. Wireshark is "friendlier" in that it has a GUI and an !OpenFlow dissector plugin is available for it. In order to use Wireshark, you must enable X11 forwarding from your workstation to the node, with the -X or -Y flag for `ssh` e.g.:
    12765{{{
     
    12967}}}
    13068
    131 === 1.2.2 Using OpenVswitch directly ===
     69----
     70''' 1.2.2 Using OpenVswitch directly '''[[BR]]
     71
    13272Mininet's datapaths are backed by OVS. Therefore, if you have a Mininet install, you get OVS for "free". You can use OVS directly for your data plane.
    13373
     
    13777This section shows two examples of more complex SDN network setups - multiple controller instances and with !FlowVisor, a network hypervisor.
    13878
    139 === Sections ===
    140  [#multi 2.1 Multiple Controllers ][[BR]]
    141  [#fv 2.2 Network virtualization/slicing ][[BR]]
    142 ==== 2.1 Multiple Controllers ==== #multi
     79----
     80''' 2.1 Multiple Controllers '''[[BR]]
     81
    14382You may have multiple controllers in the same logical space of the control plane for various reasons - special applications, fail-over, distributed control planes, etc.
    14483 
     
    204143}}}
    205144
    206 ==== Launching multiple controllers ====
     145----
     146''' Launching multiple controllers '''[[BR]]
     147
    207148Each instance of the controller run on the same host can be pointed to its own .properties file with the `-cf` flag, with different port value parameters. Begin by making as many copies of the default .properties file as you will have controllers. Going with a similar example as earlier, you can have one host A and three Floodlight instances 1,2, and 3, configured as below:
    208149
     
    221162This should launch three backgrounded instances of Floodlight.
    222163
    223 ==== 2.2 Network virtualization/slicing ====
     164----
     165''' 2.2 Network virtualization/slicing '''[[BR]]
     166
    224167A more typical case you might encounter is a network that is sliced, or virtualized.
    225168
     
    228171 * 2.2.3 On the same host
    229172
    230 === 2.2.1 A brief intro to network virtualization ===
     173----
     174''' 2.2.1 A brief intro to network virtualization '''[[BR]]
     175
    231176A virtualized network is organized as below:
    232177{{{
     
    246191
    247192
    248 
    249 ''' 2.2.2 Virtualization with multiple hosts '''
     193----
     194''' 2.2.2 Virtualization with multiple hosts '''[[BR]]
     195
    250196We begin by introducing a simple example of a virtualized topology:
    251197{{{
     
    267213
    268214
    269 
     215----
    270216''' 2.2.3 On the same host '''
     217----
    271218As with the case of multiple controllers on the same VM/host, you must be careful that neither !FlowVisor nor the controllers listen on the same sets of ports. For the multiple controllers, this can be avoided as described in [#s2_1_2 Section 2.1.2]. !FlowVisor and Floodlight conflict on ports 6633 and 8080.     
    272219
    273 ==== 3.3 Cbench ==== #cbench
     220----
     221''' 3.3 Cbench '''[[BR]]
    274222website: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench+(New)
    275223
    276 === dependencies ===
     224----
     225''' dependencies '''[[BR]]
     226
    277227{{{
    278228sudo apt-get install autoconf automake libtool libsnmp-dev libpcap-dev
    279229}}}
    280 === installation/build ===
     230''' installation/build '''
    281231{{{
    282232git clone git://gitosis.stanford.edu/openflow.git
     
    295245Where OF_PATH is where you had cloned the !OpenFlow repository to.
    296246
    297 === run ===
     247----
     248''' run ''' [[BR]]
     249
    298250Run from the cbench directory under oflops:
    299251{{{
     
    328280}}}
    329281
    330 == 3.4 liboftrace (ofdump/ofstats) == #loft
     282---
     283''' 3.4 liboftrace (ofdump/ofstats) '''[[BR]]
     284
    331285docs: [[BR]]
    332286 https://github.com/capveg/oftrace/blob/master/README [[BR]]
    333287 http://www.openflow.org/wk/index.php/Liboftrace
    334288
    335 === dependencies ===
     289----
     290''' dependencies '''[[BR]]
    336291{{{
    337292sudo apt-get install libpcap-dev swig libssl-dev
    338293}}}
    339 === installation/build ===
     294
     295----
     296''' installation/build '''[[BR]]
    340297{{{
    341298git clone git://github.com/capveg/oftrace.git
     
    345302make && make install
    346303}}}
    347 === run ===
     304
     305----
     306''' run '''[[BR]]
     307
    348308There are two tools pre-packaged with liboftrace (as per a [https://mailman.stanford.edu/pipermail/openflow-discuss/2009-April/000133.html mailing-list entry]):
    349309 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.
     
    402362}}}
    403363
    404 == 3.5 Wireshark == #ws
     364----
     365''' 3.5 Wireshark '''[[BR]]
     366
    405367website(wireshark): http://www.wireshark.org [[BR]]
    406368docs(plugin): https://bitbucket.org/barnstorm/of-dissector
    407369
    408 === dependencies ===
     370----
     371''' dependencies '''[[BR]]
    409372wireshark(source):
    410373{{{
     
    416379}}}
    417380
    418 === installation/build ===
     381----
     382''' installation/build '''[[BR]]
     383
    419384You need the source for Wireshark to build the plugin. At the time of this writing Wireshark is at v.1.10. 
    420385{{{
     
    442407Where ${WS_ROOT} is the directory you've untarred the Wireshark source to. The plugin directory may also differ depending on if you installed Wireshark from source or not - if you did, the path will be something similar to /usr/local/lib/wireshark/plugins/1.10.0/
    443408
    444 === run ===
     409----
     410''' run '''[[BR]]
     411
    445412Run Wireshark as root:
    446413{{{
     
    452419
    453420
    454 
    455 ==== Refrences ====
     421----
     422''' Refrences '''[[BR]]
    456423
    457424''' Floodlight '''