codeblock

2016年4月11日 星期一

Mininet OpenFlow Tutorial - Learn Development Tools

https://github.com/mininet/openflow-tutorial/wiki

- Start with a topology with 3 hosts and 1 switch (and 1 controller)
  • "sudo mn --topo single,3 --mac --switch ovsk --controller remote"
  • --switch ovsk: Open vSwitch 
  • --mac: set the MAC address to hosts' IP address
- Mininet Brief Intro: skipped(the same as WalkThrough)
- ovs-ofctl Example
  • "sudo ovs-ofctl show s1": to show the ports info of switch s1
  • "ovs-ofctl dump-flows s1": to show flows of s1
  • other commands: see "ovs-ofctl -h"
- Accessing remote OVS instances or the Stanford reference switch
  • connect to remote ovs by: "ovs-ofctl dump-flows tcp:{IP}:{port}"
  • e.g., "ovs-ofctl dump-flows tcp:127.0.0.1:6634" is the same as "ovs-ofctl dump-flows s1", where the port of local switches are "6633+switch number"
- Ping test
  • Directly pingall will fail because the flow table is empty. Why did it work when we test in the walkthrough? See the message when the network set up: "Unable to contact the remote controller at 127.0.0.1:6653..."
  • Add flows: "ovs-ofctl add-flow s1 in_port=1,actions=output:2" and "ovs-ofctl add-flow s1 in_port=2,actions=output:1", then ping again. 
  • Use dump-flow to see the packets, and found that when I just pinged once, 3 packets showed  up. Still don't know why, seems it sent some control packets automatically??
- Start Wireshark: skipped(the same as WalkThrough)
- Start Controller and view Startup messages in Wireshark
  • "controller ptcp:" starts a controller acts as a learning switch, so I could use ping command without installing any flow rules use ovs-optcl command
- View OpenFlow Messages for Ping
  • Try to filter out echo message: "of and not (of10.echo_request.type or of10.echo_reply.type)"
  • Still my filter could not accept this command
  • Instead, I used "openflow_v1 and openflow_1_0.type != 2 and openflow_1_0.type != 3" to achieved the same consequence
  • Flush ARP table by: "hx ip -s -s neigh flush all" where x is the host number
  • Delete flow rules in switch: "sudo ovs-ofctl del-flows s1" 
  • Ping again
    • The first time will show a broadcast message in wireshark which contains an ARP message
    • Then the flow rule will be installed automatically in s1
    • The time needed of following ping messages will shorter then the first one
    • The following messages need no broadcast message to find the other host's MAC address 
- Benchmark Controller w/iperf
  • "sudo mn --topo single,3 --mac --controller remote --switch user" and use iperf, but an unknown error showed up
  • It seems h1 is not connected to s1, because h2 and h3 can ping each other, but h1 cannot (still don't know why)
  • But, if I remove the "--mac", it works......
  • ovsk switch: 19.0 Gbits/sec
  • user sapce switch: 1.64 Mbits/sec
  • ovsk switch is more faster than user-space switch 

沒有留言:

張貼留言