ovs 流表机制(一)

ip netns add ns1
ip netns add ns2
ip link add tap0 type veth peer name tap0_br
ip link add tap3 type veth peer name tap3_br
ip link set tap0 netns ns1
ip link set tap3 netns ns2
ovs-vsctl add-br vswitch0
# 启动tap0和tap3、lo及它们的对端
ip netns exec ns1 ip link set tap0 up
ip netns exec ns1 ip link set lo up
ip netns exec ns2 ip link set lo up
ip netns exec ns2 ip link set tap3 up
ip link set tap0_br up
ip link set tap3_br up

# 设置tap0和tap3的ip地址
ip netns exec ns1 ip addr add 192.168.1.100 dev tap0
ip netns exec ns2 ip addr add 192.168.1.200 dev tap3

# 添加路由
ip netns exec ns1 route add -net 192.168.1.0 netmask 255.255.255.0 dev tap0
ip netns exec ns2 route add -net 192.168.1.0 netmask 255.255.255.0 dev tap3

ovs-vsctl add-port vswitch0 tap0_br
ovs-vsctl add-port vswitch0 tap3_br
 

rtt min/avg/max/mdev = 0.024/0.779/1.534/0.755 ms
[root@kunpeng82 devuser]# ovs-vsctl list interface tap0_br | grep "ofport "
ofport              : 1
[root@kunpeng82 devuser]# ovs-vsctl list interface tap3_br | grep "ofport "
ofport              : 2
[root@kunpeng82 devuser]# ovs-vsctl get Interface tap0_br ofport1[root@kunpeng82 devuser]# ovs-vsctl get Interface tap3_br  ofport2
查看vswitch0的flow
[root@kunpeng82 devuser]# ovs-ofctl dump-flows vswitch0
 cookie=0x0, duration=1256.469s, table=0, n_packets=9, n_bytes=630, priority=0 actions=NORMAL

[root@kunpeng82 devuser]# ovs-ofctl dump-flows vswitch0
 cookie=0x0, duration=3554.662s, table=0, n_packets=32, n_bytes=2352, priority=0 actions&
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值