Changes between Version 12 and Version 13 of GENIExperimenter/Tutorials/OpenFlowOVS-Floodlight/Execute


Ignore:
Timestamp:
11/14/16 03:29:15 (7 years ago)
Author:
pjayanth@bbn.com
Comment:

--

Legend:

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

    v12 v13  
    159159=== 4f. Topology Details ===
    160160
    161 Before we insert flows into the Open vSwitch, we are going to need all the details regarding the topology such as the DPID of the Open vSwitch, MAC addresses of the hosts, the port numbers on which the Hosts are connected to the Open vSwitch etc. These details can be found out by issuing the command:
     161Before we insert flows into the Open vSwitch, we are going to need all the details regarding the topology such as the DPID of the Open vSwitch, MAC addresses of the hosts, the port numbers on which the Hosts are connected to the Open vSwitch etc. These details can be found out by issuing the following command in a new Controller terminal:
    162162
    163163{{{
     
    209209Now 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.
    210210
    211   1. Under the `/tmp/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.
    212 
    213   2. To test your controller we are going to use netcat. Go to the two terminals of host2. In one terminal run:
     211 
     212  1. To test your controller we are going to use netcat. Open two terminals of host2. In one terminal run:
    214213{{{
    215214nc -l 5000
     
    221220}}}
    222221
    223   3. Now, start the simple layer 2 forwarding controller. We are doing this to see what happens with a simple controller.
    224 {{{
    225 cd /tmp/pox
    226 ./pox.py --verbose forwarding.l2_learning
    227 }}}
    228 
    229   4. Go to the terminal of host1 and connect to host2 at port 5000:
     222  2. We will check the normal functionality before the flow for a Port Forwarding Controller is inserted. Go to the terminal of host1 and connect to host2 at port 5000:
    230223{{{
    231224nc 10.10.1.2 5000
    232225}}}
    233226   
    234   5. Type something and you should see it at the the terminal of host2 at port 5000.
    235 
    236   6. Now, stop the simple layer 2 forwarding controller:
    237 {{{
    238 DEBUG:forwarding.l2_learning:installing flow for 02:d4:15:ed:07:4e.3 -> 02:ff:be:1d:19:ea.2
    239 
    240 INFO:core:Going down...
    241 INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
    242 INFO:core:Down.
    243 }}}
    244 
    245   7. And start your port forwarding controller (if you have written your controller then use myPortForwarding in the following command):
    246 {{{
    247 ./pox.py --verbose PortForwarding
    248 }}}
    249 
    250   8. Repeat the netcat scenario described above. Now, your text should appear on the other terminal of host2 which is listening to port 6000.
    251 
    252 
    253   9. Stop your port forwarding controller:
    254 {{{
    255 DEBUG:myPortForwarding:Got a packet : [02:aa:a3:e8:6c:db>33:33:ff:e8:6c:db IPV6]
    256 
    257 INFO:core:Going down...
    258 INFO:openflow.of_01:[36-63-8b-d7-16-4b 1] disconnected
    259 INFO:core:Down.
    260 }}}
     227  3. Type something and you should see it at the the terminal of host2 at port 5000.
     228
     229  4. Now, we insert the flow for a Port Forwarding Controller:
     230{{{
     231curl -X POST -d '{"switch":"<DPID OF OPEN vSWITCH>","name":"flow-2","priority":"32768","in_port":"<PORT OF 10.0.0.1>","active":"true", "eth_type":"0x0800", "ip_proto":"0x06", "eth_src":"<MAC OF 10.0.0.1>", "eth_dst":"<MAC OF 10.0.0.2>", "tcp_dst":"5000", "ipv4_src":"10.0.0.1", "ipv4_dst":"10.0.0.2", "actions":"set_field=eth_dst-><MAC OF 10.0.0.2>,set_field=tcp_dst->6000,set_field=ipv4_dst->10.0.0.2,output=<PORT OF 10.0.0.2>"}' http://localhost:8080/wm/staticflowpusher/json
     232}}}
     233
     234  5. In the previous step, we inserted a flow to forward TCP traffic  from Host 1 destined to Host 2 at port 5000 to port 6000. But Host 1 still thinks it is speaking to Host 2 at port 5000. So we need to insert a flow to handle traffic from Host 2 Port 6000 for a seamless transition.
     235{{{
     236curl -X POST -d '{"switch":"<DPID OF OPEN vSWITCH>","name":"flow-3","priority":"32768","in_port":"<PORT OF 10.0.0.2>","active":"true", "eth_type":"0x0800", "ip_proto":"0x06", "eth_src":"<MAC OF 10.0.0.2>", "eth_dst":"<MAC OF 10.0.0.1>", "tcp_src":"6000", "ipv4_src":"10.0.0.2", "ipv4_dst":"10.0.0.1", "actions":"set_field=tcp_src->5000,output=<PORT OF 10.0.0.1>"}' http://localhost:8080/wm/staticflowpusher/json
     237}}}
     238
     239  6. Repeat the netcat scenario described above. Now, your text should appear on the other terminal of host2 which is listening to port 6000.
     240
    261241
    262242=== 4h. Run a Server Proxy Controller ===
     
    264244As our last exercise, instead of diverting the traffic to a different server running on the same host, we will divert the traffic to a server running on a different host and on a different port.
    265245
    266   1. Under the `/tmp/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.
    267 
    268   2. On the terminal of `host3` run a netcat server:
    269 {{{
    270 nc -l 7000
    271 }}}
    272 
    273   3. On your controller host, open the /tmp/pox/ext/myProxy.py file, and edit it to implement a controller that will divert traffic destined for `host2` to `host3`. Before you start implementing think about what are the side effects of diverting traffic to a different host.
     246  1.  On the terminal of `host3` run a netcat server:
     247{{{
     248nc -l 6000
     249}}}
     250
     251  3. On the controller host, we will insert a flow to implement a controller that will divert traffic destined for `host2` to `host3`. Before you start implementing think about what are the side effects of diverting traffic to a different host.
    274252     * Is it enough to just change the IP address?
    275253     * Is it enough to just modify the TCP packets?
    276 
    277    If you want to see the solution, it's available in file /tmp/pox/ext/Proxy.py file. 
    278254 
    279   4. To test your proxy controller run  (if you have written your controller then use myProxy in the following command)::
    280 {{{
    281 cd /tmp/pox
    282 ./pox.py --verbose Proxy
     255  4. Insert the following flow in the Controller terminal to implement a Server Proxy Controller:
     256{{{
     257curl -X POST -d '{"switch":"<DPID OF OPEN vSWITCH>","name":"flow-4","priority":"32768","in_port":"<PORT OF 10.0.0.1>","active":"true", "eth_type":"0x0800", "ip_proto":"0x06", "eth_src":"<MAC OF 10.0.0.1>", "eth_dst":"<MAC OF 10.0.0.2>", "tcp_dst":"5000", "ipv4_src":"10.0.0.1", "ipv4_dst":"10.0.0.2", "actions":"set_field=eth_dst-><MAC OF 10.0.0.3>,set_field=tcp_dst->6000,set_field=ipv4_dst->10.0.0.3,output=<PORT OF 10.0.0.3>"}' http://localhost:8080/wm/staticflowpusher/json
     258}}}
     259
     260
     261  5. In the previous step, we inserted a flow to forward TCP traffic  from Host 1 destined to Host 2 at port 5000 to Host 3 at port 6000. But Host 1 still thinks it is speaking to Host 2 at port 5000. So we need to insert a flow to handle traffic from Host 3 Port 6000 for a seamless transition.
     262{{{
     263curl -X POST -d '{"switch":"<DPID OF OPEN vSWITCH>","name":"flow-5","priority":"32768","in_port":"<PORT OF 10.0.0.3>","active":"true", "eth_type":"0x0800", "ip_proto":"0x06", "eth_src":"<MAC OF 10.0.0.3>", "eth_dst":"<MAC OF 10.0.0.1>", "tcp_src":"6000", "ipv4_src":"10.0.0.3", "ipv4_dst":"10.0.0.1", "actions":"set_field=eth_src-><MAC OF 10.0.0.2>,set_field=ipv4_src-10.0.0.2>set_field=tcp_src->5000,output=<PORT OF 10.0.0.1>"}' http://localhost:8080/wm/staticflowpusher/json
     264
    283265}}}
    284266