Changes between Version 43 and Version 44 of GENIExperimenter/Tutorials/OpenFlowOVS/Execute


Ignore:
Timestamp:
10/03/13 12:51:15 (10 years ago)
Author:
lnevers@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/OpenFlowOVS/Execute

    v43 v44  
    9999
    100100In this example we going to run a very simple learning switch controller to forward traffic between host1 and host2.
    101 
    102 1. First we are going to start a ping from  `host1` to `host2`, which should timeout, since there is no controller running. Leave this ping running.
    103 {{{
    104 ping host2 -c 10
    105 }}}
    106 
    107 2. We have installed the POX controller under `/local/pox` on the OVS host. POX comes with a set of example modules that you can use out of the box. One of the modules is a learning switch.  Let's start the learning switch controller which is already available:
    108 
    109 {{{
    110 cd /local/pox
    111 ./pox.py --verbose forwarding.l2_learning
    112 }}}
    113 
    114 3. Now go to terminal of `host1` and ping `host2`:
    115 
    116 {{{
    117 [experimenter@host1 ~]$ ping host2
    118 PING host2-lan1 (10.10.1.2) 56(84) bytes of data.
    119 From host1-lan0 (10.10.1.1) icmp_seq=2 Destination Host Unreachable
    120 From host1-lan0 (10.10.1.1) icmp_seq=3 Destination Host Unreachable
    121 From host1-lan0 (10.10.1.1) icmp_seq=4 Destination Host Unreachable
    122 64 bytes from host2-lan1 (10.10.1.2): icmp_req=5 ttl=64 time=23.9 ms
    123 64 bytes from host2-lan1 (10.10.1.2): icmp_req=6 ttl=64 time=0.717 ms
    124 64 bytes from host2-lan1 (10.10.1.2): icmp_req=7 ttl=64 time=0.654 ms
    125 64 bytes from host2-lan1 (10.10.1.2): icmp_req=8 ttl=64 time=0.723 ms
    126 64 bytes from host2-lan1 (10.10.1.2): icmp_req=9 ttl=64 time=0.596 ms
    127 }}}
     101 
     102  1. First we are going to start a ping from  `host1` to `host2`, which should timeout, since there is no controller running. Leave this ping running.
     103  {{{
     104  ping host2 -c 10
     105  }}}
     106
     107  2. We have installed the POX controller under `/local/pox` on the OVS host. POX comes with a set of example modules that you can use out of the box. One of the modules is a learning switch.  Let's start the learning switch controller which is already available:
     108  {{{
     109  cd /local/pox
     110  ./pox.py --verbose forwarding.l2_learning
     111  }}}
     112
     113 3. Now go to terminal of `host1` and ping `host2`:
     114  {{{
     115  [experimenter@host1 ~]$ ping host2
     116  PING host2-lan1 (10.10.1.2) 56(84) bytes of data.
     117  From host1-lan0 (10.10.1.1) icmp_seq=2 Destination Host Unreachable
     118  From host1-lan0 (10.10.1.1) icmp_seq=3 Destination Host Unreachable
     119  From host1-lan0 (10.10.1.1) icmp_seq=4 Destination Host Unreachable
     120  64 bytes from host2-lan1 (10.10.1.2): icmp_req=5 ttl=64 time=23.9 ms
     121  64 bytes from host2-lan1 (10.10.1.2): icmp_req=6 ttl=64 time=0.717 ms
     122  64 bytes from host2-lan1 (10.10.1.2): icmp_req=7 ttl=64 time=0.654 ms
     123  64 bytes from host2-lan1 (10.10.1.2): icmp_req=8 ttl=64 time=0.723 ms
     124  64 bytes from host2-lan1 (10.10.1.2): icmp_req=9 ttl=64 time=0.596 ms
     125  }}}
    128126
    129127  Now the ping should work.
    130128
    131 4. Go back to your OVS host and take a look at the print outs. You should see that your controller installed flows based on the mac addresses of your packets.
    132 
    133 5. Kill your POX controller by pressing `Ctrl-C`:
    134 
    135 {{{
    136 DEBUG:forwarding.l2_learning:installing flow for 02:c7:e8:a7:40:65.1 -> 02:f1:ae:bb:e3:a8.2
    137  ^C
    138 INFO:core:Going down...
    139 INFO:openflow.of_01:[3a-51-a1-ab-c3-43 1] disconnected
    140 INFO:core:Down.
    141 ovs:/local/pox%
    142 }}}
    143 
    144 6. Notice what will happen to your ping on host1.
     129  4. Go back to your OVS host and take a look at the print outs. You should see that your controller installed flows based on the mac addresses of your packets.
     130
     131  5. Kill your POX controller by pressing `Ctrl-C`:
     132  {{{
     133  DEBUG:forwarding.l2_learning:installing flow for 02:c7:e8:a7:40:65.1 -> 02:f1:ae:bb:e3:a8.2
     134  ^C
     135  INFO:core:Going down...
     136  INFO:openflow.of_01:[3a-51-a1-ab-c3-43 1] disconnected
     137  INFO:core:Down.
     138  ovs:/local/pox%
     139  }}}
     140
     141  6. Notice what will happen to your ping on host1.
    145142
    146143==== Soft vs Hard Timeouts ====
     
    191188       ii. !DuplicateTraffic.py : this has the actual solution you can just run this if you don't want to bother with writing a controller.
    192189
    193  4. Run your newly written controller on the <data_interface_name> that corresponds to ''OVS:if1'':
    194 {{{
    195 cd /local/pox
    196 ./pox.py --verbose myDuplicateTraffic --duplicate_port=<data_interface_name>
    197 }}}
     190  4. Run your newly written controller on the <data_interface_name> that corresponds to ''OVS:if1'':
     191  {{{
     192  cd /local/pox
     193  ./pox.py --verbose myDuplicateTraffic --duplicate_port=<data_interface_name>
     194  }}}
    198195   
    199  5. To test it go to the terminal of host1 and try to ping host2:
    200 {{{
    201 ping 10.10.1.2
    202 }}}
    203     If your controller is working, your packets will register in both terminals running tcpdump.
    204 
    205  6. Stop the POX controller:
    206    {{{
    207     DEBUG:myDuplicateTraffic:Got a packet : [02:f1:ae:bb:e3:a8>02:c7:e8:a7:40:65 IP]
    208     DEBUG:SimpleL2Learning:installing flow for 02:f1:ae:bb:e3:a8.2 -> 02:c7:e8:a7:40:65.[1, 2]
    209     ^C
    210     INFO:core:Going down...
    211     INFO:openflow.of_01:[3a-51-a1-ab-c3-43 1] disconnected
    212     INFO:core:Down.
    213     ovs:/local/pox%
    214 }}}
    215 
    216 
     196  5. To test it go to the terminal of host1 and try to ping host2:
     197  {{{
     198  ping 10.10.1.2
     199  }}}
     200  If your controller is working, your packets will register in both terminals running tcpdump.
     201
     202  6. Stop the POX controller:
     203  {{{
     204  DEBUG:myDuplicateTraffic:Got a packet : [02:f1:ae:bb:e3:a8>02:c7:e8:a7:40:65 IP]
     205  DEBUG:SimpleL2Learning:installing flow for 02:f1:ae:bb:e3:a8.2 -> 02:c7:e8:a7:40:65.[1, 2]
     206  ^C
     207  INFO:core:Going down...
     208  INFO:openflow.of_01:[3a-51-a1-ab-c3-43 1] disconnected
     209  INFO:core:Down.
     210  ovs:/local/pox%
     211  }}}
    217212
    218213=== 3d. Run a port forward Controller ===
     
    220215Now let's do a slightly more complicated controller. OpenFlow gives you the power to overwrite fields of your packets at the switch, for example the TCP source or destination port and do port forwarding. You can have clients trying to contact a server at port 5000, and the OpenFlow switch can redirect your traffic to a service listening on port 6000.
    221216
    222 1. Under the `/loca/pox/ext` directory there are two files !PortForwarding.py and myPortForwarding.py that are similar like the previous exercise. Both of these controller are configured by a configuration file at `ext/port_forward.config`. Use myPortForwarding.py to write your own port forwarding controller.
    223 
    224 2. To test your controller we are going to use netcat. Go to the two terminals of host2. In one terminal run:
    225 {{{
    226 nc -l 5000
    227 }}}
    228 
    229 and in the other terminal run
    230 {{{
    231 nc -l 6000
    232 }}}
    233 
    234 3. Now, start the simple layer 2 forwarding controller. We are doing this to seen what happens with a simple controller.
    235 {{{
    236 cd /local/pox
    237 ./pox.py --verbose forwarding.l2_learning
    238 }}}
    239 
    240 4. Go to the terminal of host1 and connect to host2 at port 5000:
    241 {{{
    242 nc 10.10.1.2 5000
    243 }}}
     217  1. Under the `/loca/pox/ext` directory there are two files !PortForwarding.py and myPortForwarding.py that are similar like the previous exercise. Both of these controller are configured by a configuration file at `ext/port_forward.config`. Use myPortForwarding.py to write your own port forwarding controller.
     218
     219  2. To test your controller we are going to use netcat. Go to the two terminals of host2. In one terminal run:
     220  {{{
     221  nc -l 5000
     222  }}}
     223
     224  and in the other terminal run
     225  {{{
     226  nc -l 6000
     227  }}}
     228
     229  3. Now, start the simple layer 2 forwarding controller. We are doing this to seen what happens with a simple controller.
     230  {{{
     231  cd /local/pox
     232  ./pox.py --verbose forwarding.l2_learning
     233  }}}
     234
     235  4. Go to the terminal of host1 and connect to host2 at port 5000:
     236  {{{
     237  nc 10.10.1.2 5000
     238  }}}
    244239   
    245 5. Type something and you should see it at the the terminal of host2 at port 5000.
    246 
    247 6. Now, stop the simple layer 2 forwarding controller:
    248 {{{
    249 DEBUG:forwarding.l2_learning:installing flow for 02:d4:15:ed:07:4e.3 -> 02:ff:be:1d:19:ea.2
    250  ^C
    251 INFO:core:Going down...
    252 INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
    253 INFO:core:Down.
    254 ovs:/local/pox%
    255 }}}
    256 
    257 7. And start your port forwarding controller:
    258 {{{
    259 ./pox.py --verbose myPortForwarding
    260 }}}
    261 
    262 8. Repeat the netcat scenario described above. Now, your text should appear on the other terminal of host2 which is listenign to port 6000.
    263 
    264 
    265 9. Stop your port forwarding controller:
    266 {{{
    267 DEBUG:myPortForwarding:Got a packet : [02:aa:a3:e8:6c:db>33:33:ff:e8:6c:db IPV6]
    268  ^C
    269 INFO:core:Going down...
    270 INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
    271 INFO:core:Down.
    272 ovs:/local/pox%
    273 }}}
     240  5. Type something and you should see it at the the terminal of host2 at port 5000.
     241
     242  6. Now, stop the simple layer 2 forwarding controller:
     243  {{{
     244  DEBUG:forwarding.l2_learning:installing flow for 02:d4:15:ed:07:4e.3 -> 02:ff:be:1d:19:ea.2
     245  ^C
     246  INFO:core:Going down...
     247  INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
     248  INFO:core:Down.
     249  ovs:/local/pox%
     250  }}}
     251
     252  7. And start your port forwarding controller:
     253  {{{
     254  ./pox.py --verbose myPortForwarding
     255  }}}
     256
     257  8. Repeat the netcat scenario described above. Now, your text should appear on the other terminal of host2 which is listenign to port 6000.
     258
     259
     260  9. Stop your port forwarding controller:
     261  {{{
     262  DEBUG:myPortForwarding:Got a packet : [02:aa:a3:e8:6c:db>33:33:ff:e8:6c:db IPV6]
     263  ^C
     264  INFO:core:Going down...
     265  INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
     266  INFO:core:Down.
     267  ovs:/local/pox%
     268  }}}
    274269
    275270=== 3e. Run a Server Proxy Controller ===
     
    277272As our last exercise, instead of diverging the traffic to a different server running on the same host, we will diverge the traffic to a server running on a different host and on a different port.
    278273
    279 1. Under the `/loca/pox/ext` directory there are two files Proxy.py and myProxy.py that are similar like the previous exercise. Both of these controllers are configured by the configuration file `proxy.config`. Use myProxy.py to write your own proxy controller.
    280 
    281 2. On the terminal of `host3` run a netcat server:
    282 {{{
    283 nc -l 7000
    284 }}}
    285 
    286 3. On your OVS host open the /local/pox/ext/myProxy.py file, and edit it to implement a controller that will diverge traffic destined for `host2` to `host3`. Before you start implementing think about what are the side effects of diverging traffic to a different host.
     274  1. Under the `/loca/pox/ext` directory there are two files Proxy.py and myProxy.py that are similar like the previous exercise. Both of these controllers are configured by the configuration file `proxy.config`. Use myProxy.py to write your own proxy controller.
     275
     276  2. On the terminal of `host3` run a netcat server:
     277  {{{
     278  nc -l 7000
     279  }}}
     280
     281  3. On your OVS host open the /local/pox/ext/myProxy.py file, and edit it to implement a controller that will diverge traffic destined for `host2` to `host3`. Before you start implementing think about what are the side effects of diverging traffic to a different host.
    287282     * Is it enough to just change the IP address?
    288283     * Is it enough to just modify the TCP packets?
    289284
    290   If you want to see the solution, it's available in file /local/pox/ext/Proxy.py file. 
     285   If you want to see the solution, it's available in file /local/pox/ext/Proxy.py file. 
    291286 
    292 4. To test your proxy controller run:
    293 {{{
    294 cd /local/pox
    295 ./pox.py --verbose myProxy
    296 }}}
    297 
    298 5. Go back to the terminal of `host1` and try to connect netcat to `host2` port 5000
    299 {{{
    300 nc 10.10.1.2 5000
    301 }}}
    302 
    303 6. If your controller works correctly, you should see your text showing up on the terminal of `host3`.
     287  4. To test your proxy controller run:
     288  {{{
     289  cd /local/pox
     290  ./pox.py --verbose myProxy
     291  }}}
     292
     293  5. Go back to the terminal of `host1` and try to connect netcat to `host2` port 5000
     294  {{{
     295  nc 10.10.1.2 5000
     296  }}}
     297
     298  6. If your controller works correctly, you should see your text showing up on the terminal of `host3`.
    304299
    305300----