SFC(Service Function Chaining),即服务功能链,该功能可将不同网络服务灵活的连接起来。可以任意改变网络链路路径,控制云主机的网络流向,一般配合NFV(网络功能虚拟化)使用。
Mininet环境准备
VTN的SFC功能试验场景:通过mininet模拟虚拟主机和虚拟服务,调用VTN接口修改网络链路及下发流表策略。试验拓扑如下:
如图构建该场景,srvc1虚拟服务作用是延迟200ms,srvc2虚拟服务作用是延迟300ms。拓扑脚本如下sfc.py:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#!/usr/bin/python from mininet.topo import Topo class MyTopo2( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." # Initialize topology Topo.__init__( self ) # Add hosts and switches Switch1 = self.addSwitch( 's1' ) Switch2 = self.addSwitch( 's2' ) Switch3 = self.addSwitch( 's3' ) Switch4 = self.addSwitch( 's4' ) Host11 = self.addHost( 'h11' ) Host12 = self.addHost( 'h12' ) Host21 = self.addHost( 'h21' ) Host22 = self.addHost( 'h22' ) Host23 = self.addHost( 'h23' ) Service1 = self.addHost( 'srvc1' ) Service2 = self.addHost( 'srvc2' ) # Add links self.addLink( Host11, Switch1 ) self.addLink( Host12, Switch1 ) self.addLink( Host21, Switch2 ) self.addLink( Host22, Switch2 ) self.addLink( Host23, Switch2 ) self.addLink( Switch1, Switch2 ) self.addLink( Switch2, Switch4 ) self.addLink( Switch4, Switch3 ) self.addLink( Switch3, Switch1 ) self.addLink( Switch3, Service1 ) self.addLink( Switch4, Service1 ) self.addLink( Switch3, Service2 ) self.addLink( Switch4, Service2 ) topos = { 'mytopo2': ( lambda: MyTopo2() ) } |
构建mininet拓扑:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
sudo mn --controller=remote,ip=172.31.2.70 --custom sfc.py --topo mytopo2 mininet> net h11 h11-eth0:s1-eth1 h12 h12-eth0:s1-eth2 h21 h21-eth0:s2-eth1 h22 h22-eth0:s2-eth2 h23 h23-eth0:s2-eth3 srvc1 srvc1-eth0:s3-eth3 srvc1-eth1:s4-eth3 srvc2 srvc2-eth0:s3-eth4 srvc2-eth1:s4-eth4 s1 lo: s1-eth1:h11-eth0 s1-eth2:h12-eth0 s1-eth3:s2-eth4 s1-eth4:s3-eth2 s2 lo: s2-eth1:h21-eth0 s2-eth2:h22-eth0 s2-eth3:h23-eth0 s2-eth4:s1-eth3 s2-eth5:s4-eth1 s3 lo: s3-eth1:s4-eth2 s3-eth2:s1-eth4 s3-eth3:srvc1-eth0 s3-eth4:srvc2-eth0 s4 lo: s4-eth1:s2-eth5 s4-eth2:s3-eth1 s4-eth3:srvc1-eth1 s4-eth4:srvc2-eth1 |
添加流规则:
1 2 3 4 |
mininet@ubuntu:~$ sudo ovs-ofctl add-flow s2 priority=0,actions=output:CONTROLLER mininet@ubuntu:~$ sudo ovs-ofctl add-flow s2 priority=0,actions=output:CONTROLLER mininet@ubuntu:~$ sudo ovs-ofctl add-flow s3 priority=0,actions=output:CONTROLLER mininet@ubuntu:~$ sudo ovs-ofctl add-flow s4 priority=0,actions=output:CONTROLLER |
安装brctl工具:sudo apt-get install bridge-utils配置mininet(主要是配置srvc1延迟200ms,srvc2延迟300ms):
1 2 3 4 5 6 7 8 9 10 11 12 |
mininet> srvc1 ip addr del 10.0.0.6/8 dev srvc1-eth0 mininet> srvc1 brctl addbr br0 mininet> srvc1 brctl addif br0 srvc1-eth0 mininet> srvc1 brctl addif br0 srvc1-eth1 mininet> srvc1 ifconfig br0 up mininet> srvc1 tc qdisc add dev srvc1-eth1 root netem delay 200ms mininet> srvc2 ip addr del 10.0.0.7/8 dev srvc2-eth0 mininet> srvc2 brctl addbr br0 mininet> srvc2 brctl addif br0 srvc2-eth0 mininet> srvc2 brctl addif br0 srvc2-eth1 mininet> srvc2 ifconfig br0 up mininet> srvc2 tc qdisc add dev srvc2-eth1 root netem delay 300ms |
配置VTN
VTN的虚拟网络拓扑如下图所示:
修改VTN的拓扑
1 2 |
curl -i --user admin:admin -H 'Accept: application/json' -H 'content-type: application/json' -X PUT http://172.31.2.70:8181/restconf/config/vtn-static-topology:vtn-static-topology/static-edge-ports -d '{"static-edge-ports": {"static-edge-port": [ {"port": "openflow:3:3"}, {"port": "openflow:3:4"}, {"port": "openflow:4:3"}, {"port": "openflow:4:4"}]}}' HTTP/1.1 200 OK |
创建vtn
1 2 |
curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vtn" : {"vtn_name":"vtn_one","description":"test VTN" }}' http://172.31.2.70:8083/vtn-webapi/vtns HTTP/1.1 201 Created |
创建控制器
1 2 |
curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"controller": {"controller_id": "controller1", "ipaddr":"172.31.2.70", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://172.31.2.70:8083/vtn-webapi/controllers HTTP/1.1 201 Created |
创建虚拟桥
1 2 |
curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vbridge" : {"vbr_name":"vbr_one","controller_id":"controller1","domain_id":"(DEFAULT)" }}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges HTTP/1.1 201 Created |
创建虚拟接口
1 2 3 4 5 6 7 8 |
curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"interface": {"if_name": "if1","description": "if_desc1"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces HTTP/1.1 201 Created curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"interface": {"if_name": "if2","description": "if_desc2"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces HTTP/1.1 201 Created curl -i --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"interface": {"if_name": "if3","description": "if_desc3"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces HTTP/1.1 201 Created |
创建接口映射
1 2 3 4 5 6 7 8 |
curl -i --user admin:adminpass -H 'content-type: application/json' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:openflow:3-s3-eth1"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces/if1/portmap HTTP/1.1 204 No Content curl -i --user admin:adminpass -H 'content-type: application/json' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:openflow:2-s2-eth1"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces/if2/portmap HTTP/1.1 204 No Content curl -i --user admin:adminpass -H 'content-type: application/json' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:openflow:2-s2-eth3"}}' http://172.31.2.70:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_one/interfaces/if3/portmap HTTP/1.1 204 No Content |
创建流条件:dst=host22
1 2 |
curl -i --user admin:admin -H 'content-type: application/json' -X PUT -d '{"name": "flowcond_1","match": [{"index": 1, "inetMatch": {"inet4": {"dst": "10.0.0.4"}}}]}' http://172.31.2.70:8282/controller/nb/v2/vtn/default/flowconditions/flowcond_1 HTTP/1.1 201 Created |
为流条件设置属性为drop
1 2 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vbridges/vbr_one/interfaces/if1/flowfilters/in/10 -d '{"index": 10,"condition": "flowcond_1","filterType": {"drop": {}}}' HTTP/1.1 201 Created |
服务链设置
在之前的基础上,为主机添加服务链,使得主机的流量通过srvc1_1及srvc1_2。服务链流向拓扑如下图所示:
下面调用接口来实现。
创建虚拟终端,srvc1_1对应srvc1主机的进终端,srvc1_2对应srvc1主机的出终端。
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_1 -d '{"description": "vterminal for service1"}' HTTP/1.1 201 Created curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_2 -d '{"description": "vterminal for service2"}' HTTP/1.1 201 Created |
为虚拟终端创建接口
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_1/interfaces/IF -d '{"description": "Description about IF-1","enabled": true}' HTTP/1.1 201 Created curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_2/interfaces/IF -d '{"description": "Description about IF-2","enabled": true}' HTTP/1.1 201 Created |
创建接口映射,和实际的of交换机接口映射。
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_1/interfaces/IF/portmap -d '{"vlan": 0,"node": {"type": "OF","id": "00:00:00:00:00:00:00:03"},"port": {"type": "OF","id": "3","name": "s3-eth3"}}' HTTP/1.1 200 OK curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_2/interfaces/IF/portmap -d '{"vlan": 0,"node": {"type": "OF","id": "00:00:00:00:00:00:00:04"},"port": {"type": "OF","id": "3","name": "s4-eth3"}}' HTTP/1.1 200 OK |
创建流条件:目标为host22
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/flowconditions/cond_1 -d '{"name": "cond_1","match": [{"index": 1,"inetMatch": {"inet4": {"dst": "10.0.0.4"}}}]}' HTTP/1.1 201 Created |
创建流条件,所有匹配cond_1数据包,即目标地址为10.0.0.4(h22)。
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/flowconditions/cond_any -d '{"name": "cond_any","match": [{"index": 1}]}' HTTP/1.1 201 Created |
创建流过滤规则,这里的作用是将srvc1_2的流量重定向到h22主机,即从srvc1出来的流量将到达h22主机,这里还有匹配条件为cond_any,即只有目标地址为h22的数据包才匹配该流表项。
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_2/interfaces/IF/flowfilters/in/10 -d '{"index": 10,"condition": "cond_any","filterType": {"redirect": {"destination": {"bridge": "vbr_one","interface": "if2"},"output": true}}}' HTTP/1.1 201 Created |
创建流过滤规则,这里将h12的流量重定向到srvc1_1,条件是如果数据包的目标地址是h22。
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vbridges/vbr_one/interfaces/if1/flowfilters/in/10 -d '{"index": 10,"condition": "cond_1","filterType": {"redirect": {"destination": {"terminal": "vt_srvc1_1","interface": "IF"},"output": true}}}' HTTP/1.1 201 Created |
此时sfc引流已经成功,进行测试:
引流前:
1 2 3 4 |
mininet> h12 ping h22 PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data. 64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=13.8 ms 64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=0.379 ms |
引流后:
1 2 3 4 |
mininet> h12 ping h22 PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data. 64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=215 ms 64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=201 ms |
可以看到time多了200ms,因为srvc1的作用就是延迟200ms。
查看流表项,进行分析:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x7f56000000000018, duration=108.259s, table=0, n_packets=0, n_bytes=0, idle_timeout=300, idle_age=108, priority=11,arp,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:3 cookie=0x0, duration=58954.140s, table=0, n_packets=24230, n_bytes=2030285, idle_age=0, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000015, duration=113.442s, table=0, n_packets=2, n_bytes=196, idle_timeout=300, idle_age=111, priority=12,ip,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a,nw_dst=10.0.0.4 actions=output:4 cookie=0x7f56000000000017, duration=113.268s, table=0, n_packets=3, n_bytes=238, idle_age=108, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=ae:33:fc:c2:05:3a,dl_dst=02:21:37:91:ac:c0 actions=output:2 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s2 NXST_FLOW reply (xid=0x4): cookie=0x7f56000000000018, duration=139.244s, table=0, n_packets=0, n_bytes=0, idle_age=139, priority=11,arp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:2 cookie=0x0, duration=58980.529s, table=0, n_packets=24873, n_bytes=2057889, idle_age=1, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000016, duration=144.257s, table=0, n_packets=2, n_bytes=196, idle_age=142, priority=10,in_port=5,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:2 cookie=0x7f56000000000017, duration=144.249s, table=0, n_packets=3, n_bytes=238, idle_timeout=300, idle_age=139, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=ae:33:fc:c2:05:3a,dl_dst=02:21:37:91:ac:c0 actions=output:4 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s3 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=58978.201s, table=0, n_packets=46961, n_bytes=3991621, idle_age=2, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000015, duration=145.474s, table=0, n_packets=2, n_bytes=196, idle_age=143, priority=12,ip,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a,nw_dst=10.0.0.4 actions=output:3 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s4 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=58976.595s, table=0, n_packets=46959, n_bytes=3991464, idle_age=3, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000016, duration=146.734s, table=0, n_packets=2, n_bytes=196, idle_timeout=300, idle_age=144, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:1 |
其中02:21:37:91:ac:c0是h12的mac,ae:33:fc:c2:05:3a是h22的mac。s1的2号端口是s1-eth2(连接h12),3号端口是s1-eth3(连接s2-eth4),4号端口是s1-eth4(连接s3-eth2),由此可分析s1的流表,第一条的作用是从2号口进来(h12出去)的访问h22的数据包,将从3号口出去,即被发送到s2交换机,这条流表的优先级是11(这是之前遗留的流表,即还没有添加重定向规则的)。第三条流表和第一条基本相同,但是其优先级高是12,并且多了条件如果目标地址是10.0.0.4(h22),将被发送到4号口(s3-eth2),这就是重定向的规则。
查看s3交换机的流表,s3的2号口是s3-eth2(连接s1-eth4),3号口是s3-eth3(连接srvc1-eth0),第二条流表的作用是入口是2号口,源mac是h12,目标mac是h22,且目标地址是10.0.0.4的数据包,被发送到3号口,即到达srvc1主机,这样就完成了1阶段的重定向。这里srvc1-eth0和srvc1-eth1是桥接模式,所以流量将会到达srvc1-eth1(连接s4-eth3)。
查看s4交换机的流表,s4的3号口是s4-eth3(连接srvc1-eth1),1号口是s4-eht1(连接s2-eth5),第二条流表的作用是入口是3号口,源mac是h12,目标mac是h22被发送到1号口,即到达s2交换机。
查看s2交换机的流表,s2的4号口是s2-eth4(连接s1-eth3),2号口是s2-eth2(连接h22-eth0),第一条流表的作用就是将s2-eth4进入且源mac是h12目的mac是h22的数据包发送给h22主机。
这些流表项的过期时间都是300秒,过期后会重新向sdn控制器请求规则。
添加第二个服务srvc2进入sfc链路,即h12->srvc1->srvc2->h22。
创建虚拟终端,srvc2_1对应srvc2主机的进终端,srvc2_2对应srvc2主机的出终端。
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_1 -d '{"description": "vterminal for service2"}' HTTP/1.1 201 Created curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_2 -d '{"description": "vterminal for service2_2"}' HTTP/1.1 201 Created |
为虚拟终端创建接口
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_1/interfaces/IF -d '{"description": "Description about IF-2","enabled": true}' HTTP/1.1 201 Created curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_2/interfaces/IF -d '{"description": "Description about IF-2_2","enabled": true}' HTTP/1.1 201 Created |
创建接口映射,和实际的of交换机接口映射。
1 2 3 4 5 |
curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_1/interfaces/IF/portmap -d '{"vlan": 0,"node": {"type": "OF","id": "00:00:00:00:00:00:00:03"},"port": {"type": "OF","id": "4","name": "s3-eth4"}}' HTTP/1.1 200 OK curl -i --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_2/interfaces/IF/portmap -d '{"vlan": 0,"node": {"type": "OF","id": "00:00:00:00:00:00:00:04"},"port": {"type": "OF","id": "4","name": "s4-eth4"}}' HTTP/1.1 200 OK |
创建流过滤规则,这里的作用是将srvc2_2的流量重定向到h22主机,即从srvc2出来的流量将到达h22主机,这里还有匹配条件为cond_any,即只有目标地址为h22的数据包才匹配该流表项。
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc2_2/interfaces/IF/flowfilters/in/10 -d '{"index": 10,"condition": "cond_any","filterType": {"redirect": {"destination": {"bridge": "vbr_one","interface": "if2"},"output": true}}}' HTTP/1.1 201 Created |
修改流过滤规则,这里将srvc1_2的流量重定向到srvc2_1,条件是如果数据包的目标地址是h22。
1 2 |
curl -i --user "admin":"admin" -H "Content-type: application/json" -X PUT http://172.31.2.70:8282/controller/nb/v2/vtn/default/vtns/vtn_one/vterminals/vt_srvc1_2/interfaces/IF/flowfilters/in/10 -d '{"index": 10,"condition": "cond_any","filterType": {"redirect": {"destination": {"terminal": "vt_srvc2_1","interface": "IF"},"output": true}}}' HTTP/1.1 201 Created |
这样就把服务srvc2也加入到sfc中,验证发现延迟变成500ms。
1 2 3 4 5 |
mininet> h12 ping h22 PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data. 64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=509 ms 64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=502 ms 64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=502 ms |
h12到h23不会受到任何影响。
1 2 3 4 5 |
mininet> h12 ping h23 PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data. 64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=0.185 ms 64 bytes from 10.0.0.5: icmp_seq=2 ttl=64 time=0.039 ms 64 bytes from 10.0.0.5: icmp_seq=3 ttl=64 time=0.053 ms |
查看流表
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
sudo ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x7f5600000000002b, duration=28.848s, table=0, n_packets=0, n_bytes=0, idle_timeout=300, idle_age=28, priority=11,arp,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:3 cookie=0x0, duration=67409.877s, table=0, n_packets=27709, n_bytes=2322109, idle_age=1, hard_age=65534, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000027, duration=34.357s, table=0, n_packets=2, n_bytes=196, idle_timeout=300, idle_age=32, priority=12,ip,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a,nw_dst=10.0.0.4 actions=output:4 cookie=0x7f5600000000002a, duration=33.851s, table=0, n_packets=3, n_bytes=238, idle_age=28, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=ae:33:fc:c2:05:3a,dl_dst=02:21:37:91:ac:c0 actions=output:2 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s2 NXST_FLOW reply (xid=0x4): cookie=0x7f5600000000002b, duration=29.975s, table=0, n_packets=0, n_bytes=0, idle_age=29, priority=11,arp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:2 cookie=0x0, duration=67406.409s, table=0, n_packets=28426, n_bytes=2352305, idle_age=2, hard_age=65534, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000029, duration=34.982s, table=0, n_packets=2, n_bytes=196, idle_age=32, priority=10,in_port=5,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:2 cookie=0x7f5600000000002a, duration=34.976s, table=0, n_packets=3, n_bytes=238, idle_timeout=300, idle_age=29, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=ae:33:fc:c2:05:3a,dl_dst=02:21:37:91:ac:c0 actions=output:4 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s3 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=67404.347s, table=0, n_packets=53701, n_bytes=4564521, idle_age=3, hard_age=65534, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000027, duration=36.797s, table=0, n_packets=2, n_bytes=196, idle_age=34, priority=12,ip,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a,nw_dst=10.0.0.4 actions=output:3 cookie=0x7f56000000000028, duration=36.598s, table=0, n_packets=2, n_bytes=196, idle_age=34, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:4 mininet@ubuntu:~$ sudo ovs-ofctl dump-flows s4 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=67402.486s, table=0, n_packets=53703, n_bytes=4564756, idle_age=4, hard_age=65534, priority=0 actions=CONTROLLER:65535 cookie=0x7f56000000000028, duration=37.775s, table=0, n_packets=2, n_bytes=196, idle_timeout=300, idle_age=35, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:2 cookie=0x7f56000000000029, duration=37.472s, table=0, n_packets=2, n_bytes=196, idle_timeout=300, idle_age=35, priority=10,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=02:21:37:91:ac:c0,dl_dst=ae:33:fc:c2:05:3a actions=output:1 |