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 | {{{ |
| 231 | curl -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 | {{{ |
| 236 | curl -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 | |
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 | {{{ |
| 248 | nc -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. |
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 | {{{ |
| 257 | curl -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 | {{{ |
| 263 | curl -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 | |