шпаргалка по mininet

Jan 27, 2016 16:01

1) Вносим записи openflow вручную.
root@yaa# yaourt -S --noconfirm mininet
root@yaa# mn --topo single,3 --mac --switch ovsk --controller remote

mininet> nodes
>>
available nodes are:
c0 h1 h2 h3 s1

mininet> xterm c0 h1 h2 h3 s1

root@yaa# ovs-ofctl show s1
>>
OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
 1(s1-eth1): addr:12:ee:2a:c6:b3:9a
     config:     0
     state:      0
     current:    10GB-FD COPPER
     speed: 10000 Mbps now, 0 Mbps max
 2(s1-eth2): addr:42:3c:1a:85:97:e2
     config:     0
     state:      0
     current:    10GB-FD COPPER
     speed: 10000 Mbps now, 0 Mbps max
 3(s1-eth3): addr:e2:f8:eb:96:6c:bb
     config:     0
     state:      0
     current:    10GB-FD COPPER
     speed: 10000 Mbps now, 0 Mbps max
 LOCAL(s1): addr:d6:30:25:e9:28:40
     config:     PORT_DOWN
     state:      LINK_DOWN
     speed: 0 Mbps now, 0 Mbps max
OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0
root@yaa# ovs-ofctl dump-flows s1
(или root@yaa# ovs-ofctl dump-flows tcp:127.0.0.1:6634)
>>
NXST_FLOW reply (xid=0x4):

mininet> pingall
*** Ping: testing ping reachability
h1 -> X X
h2 -> X X
h3 -> X X
*** Results: 100% dropped (0/6 received)

root@yaa# ovs-ofctl add-flow s1 in_port=1,actions=output:1,2,3
root@yaa# ovs-ofctl add-flow s1 in_port=2,actions=output:1,2,3
root@yaa# ovs-ofctl add-flow s1 in_port=3,actions=output:1,2,3
root@yaa# ovs-ofctl dump-flows s1
(или root@yaa# ovs-ofctl dump-flows tcp:127.0.0.1:6634
<=netstat -ntlp | grep ovs
tcp        0      0 0.0.0.0:6634            0.0.0.0:*               LISTEN      414/ovs-vswitchd  )
>>
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=73.552s, table=0, n_packets=16, n_bytes=1400, idle_age=61, in_port=1 actions=output:1,output:2,output:3
 cookie=0x0, duration=70.888s, table=0, n_packets=0, n_bytes=0, idle_age=70, in_port=2 actions=output:1,output:2,output:3
 cookie=0x0, duration=68.591s, table=0, n_packets=9, n_bytes=826, idle_age=61, in_port=3 actions=output:1,output:2,output:3

mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3
h2 -> h1 h3
h3 -> h1 h2
*** Results: 0% dropped (6/6 received)

2) Испольуем контроллер.
root@yaa# mn --topo single,3 --mac --controller remote --switch ovsk
yaa@yaa$ mkdir pox && cd pox && git clone http://github.com/noxrepo/pox
yaa@yaa$ ./pox.py log.level --DEBUG forwarding.l2_learning

mininet> pingall
>>
*** Ping: testing ping reachability
h1 -> h2 h3
h2 -> h1 h3
h3 -> h1 h2
*** Results: 0% dropped (6/6 received)

root@yaa# ovs-ofctl dump-flows tcp:127.0.0.1:6634
>>
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=1.663s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=10.0.0.1,nw_dst=10.0.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:2
 cookie=0x0, duration=1.661s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:02,dl_dst=00:00:00:00:00:01,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:1
 cookie=0x0, duration=1.656s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:03,nw_src=10.0.0.1,nw_dst=10.0.0.3,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:3
 cookie=0x0, duration=1.654s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=3,vlan_tci=0x0000,dl_src=00:00:00:00:00:03,dl_dst=00:00:00:00:00:01,nw_src=10.0.0.3,nw_dst=10.0.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:1
 cookie=0x0, duration=1.650s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:02,dl_dst=00:00:00:00:00:01,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1
 cookie=0x0, duration=1.648s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=10.0.0.1,nw_dst=10.0.0.2,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:2
 cookie=0x0, duration=1.643s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:02,dl_dst=00:00:00:00:00:03,nw_src=10.0.0.2,nw_dst=10.0.0.3,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:3
 cookie=0x0, duration=1.641s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=3,vlan_tci=0x0000,dl_src=00:00:00:00:00:03,dl_dst=00:00:00:00:00:02,nw_src=10.0.0.3,nw_dst=10.0.0.2,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:2
 cookie=0x0, duration=1.636s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=3,vlan_tci=0x0000,dl_src=00:00:00:00:00:03,dl_dst=00:00:00:00:00:01,nw_src=10.0.0.3,nw_dst=10.0.0.1,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1
 cookie=0x0, duration=1.634s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:03,nw_src=10.0.0.1,nw_dst=10.0.0.3,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3
 cookie=0x0, duration=1.630s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=3,vlan_tci=0x0000,dl_src=00:00:00:00:00:03,dl_dst=00:00:00:00:00:02,nw_src=10.0.0.3,nw_dst=10.0.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:2
 cookie=0x0, duration=1.628s, table=0, n_packets=1, n_bytes=98, idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:02,dl_dst=00:00:00:00:00:03,nw_src=10.0.0.2,nw_dst=10.0.0.3,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3

коммутация, ip, openvswitch, mininet

Previous post Next post
Up