Changes between Version 2 and Version 3 of Documentation/fSDN/bMininet
- Timestamp:
- Dec 22, 2014, 5:32:19 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/fSDN/bMininet
v2 v3 1 === Getting started with Mininet===1 ==== Mininet Documentation ==== 2 2 3 3 This page documents the usage/installation of mininet as well as it's interaction with OEDL. 4 4 The main source is the mininet homepage located at http://mininet.org/. 5 5 6 ==== 0. Installation ==== #install 6 ''' 0. Installation ''' 7 7 8 8 While 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] … … 55 55 }}} 56 56 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 126 64 In 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.: 127 65 {{{ … … 129 67 }}} 130 68 131 === 1.2.2 Using OpenVswitch directly === 69 ---- 70 ''' 1.2.2 Using OpenVswitch directly '''[[BR]] 71 132 72 Mininet'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. 133 73 … … 137 77 This section shows two examples of more complex SDN network setups - multiple controller instances and with !FlowVisor, a network hypervisor. 138 78 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 143 82 You may have multiple controllers in the same logical space of the control plane for various reasons - special applications, fail-over, distributed control planes, etc. 144 83 … … 204 143 }}} 205 144 206 ==== Launching multiple controllers ==== 145 ---- 146 ''' Launching multiple controllers '''[[BR]] 147 207 148 Each 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: 208 149 … … 221 162 This should launch three backgrounded instances of Floodlight. 222 163 223 ==== 2.2 Network virtualization/slicing ==== 164 ---- 165 ''' 2.2 Network virtualization/slicing '''[[BR]] 166 224 167 A more typical case you might encounter is a network that is sliced, or virtualized. 225 168 … … 228 171 * 2.2.3 On the same host 229 172 230 === 2.2.1 A brief intro to network virtualization === 173 ---- 174 ''' 2.2.1 A brief intro to network virtualization '''[[BR]] 175 231 176 A virtualized network is organized as below: 232 177 {{{ … … 246 191 247 192 248 249 ''' 2.2.2 Virtualization with multiple hosts ''' 193 ---- 194 ''' 2.2.2 Virtualization with multiple hosts '''[[BR]] 195 250 196 We begin by introducing a simple example of a virtualized topology: 251 197 {{{ … … 267 213 268 214 269 215 ---- 270 216 ''' 2.2.3 On the same host ''' 217 ---- 271 218 As 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. 272 219 273 ==== 3.3 Cbench ==== #cbench 220 ---- 221 ''' 3.3 Cbench '''[[BR]] 274 222 website: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench+(New) 275 223 276 === dependencies === 224 ---- 225 ''' dependencies '''[[BR]] 226 277 227 {{{ 278 228 sudo apt-get install autoconf automake libtool libsnmp-dev libpcap-dev 279 229 }}} 280 === installation/build === 230 ''' installation/build ''' 281 231 {{{ 282 232 git clone git://gitosis.stanford.edu/openflow.git … … 295 245 Where OF_PATH is where you had cloned the !OpenFlow repository to. 296 246 297 === run === 247 ---- 248 ''' run ''' [[BR]] 249 298 250 Run from the cbench directory under oflops: 299 251 {{{ … … 328 280 }}} 329 281 330 == 3.4 liboftrace (ofdump/ofstats) == #loft 282 --- 283 ''' 3.4 liboftrace (ofdump/ofstats) '''[[BR]] 284 331 285 docs: [[BR]] 332 286 https://github.com/capveg/oftrace/blob/master/README [[BR]] 333 287 http://www.openflow.org/wk/index.php/Liboftrace 334 288 335 === dependencies === 289 ---- 290 ''' dependencies '''[[BR]] 336 291 {{{ 337 292 sudo apt-get install libpcap-dev swig libssl-dev 338 293 }}} 339 === installation/build === 294 295 ---- 296 ''' installation/build '''[[BR]] 340 297 {{{ 341 298 git clone git://github.com/capveg/oftrace.git … … 345 302 make && make install 346 303 }}} 347 === run === 304 305 ---- 306 ''' run '''[[BR]] 307 348 308 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]): 349 309 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. … … 402 362 }}} 403 363 404 == 3.5 Wireshark == #ws 364 ---- 365 ''' 3.5 Wireshark '''[[BR]] 366 405 367 website(wireshark): http://www.wireshark.org [[BR]] 406 368 docs(plugin): https://bitbucket.org/barnstorm/of-dissector 407 369 408 === dependencies === 370 ---- 371 ''' dependencies '''[[BR]] 409 372 wireshark(source): 410 373 {{{ … … 416 379 }}} 417 380 418 === installation/build === 381 ---- 382 ''' installation/build '''[[BR]] 383 419 384 You need the source for Wireshark to build the plugin. At the time of this writing Wireshark is at v.1.10. 420 385 {{{ … … 442 407 Where ${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/ 443 408 444 === run === 409 ---- 410 ''' run '''[[BR]] 411 445 412 Run Wireshark as root: 446 413 {{{ … … 452 419 453 420 454 455 ==== Refrences ==== 421 ---- 422 ''' Refrences '''[[BR]] 456 423 457 424 ''' Floodlight '''