transl action

 

 

1、ovs-vsctl set port tap0_br tag=100

2、添加几条flow

[root@kunpeng82 devuser]# ovs-ofctl dump-flows vswitch0 cookie=0x0, duration=2352.210s, table=0, n_packets=407, n_bytes=17262, priority=3,in_port="tap4_br",vlan_tci=0x0000 actions=mod_vlan_vid:100,NORMAL cookie=0x0, duration=2155.729s, table=0, n_packets=111, n_bytes=4858, priority=3,in_port="tap3_br",vlan_tci=0x0000 actions=mod_vlan_vid:100,NORMAL cookie=0x0, duration=2499.930s, table=0, n_packets=387, n_bytes=16422, priority=1,in_port="tap0_br" actions=strip_vlan,output:"tap3_br" cookie=0x0, duration=8697.389s, table=0, n_packets=114, n_bytes=6244, priority=0 actions=NORMAL

But ip netns exec ns2 ping 192.168.1.100 ping through

[root@kunpeng82 devuser]# ip netns exec ns4 ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
^C
--- 192.168.1.100 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2058ms

But ip netns exec ns4 ping 192.168.1.100 can not ping

[root@kunpeng82 devuser]# ip netns exec ns2 ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time=0.306 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time=0.023 ms
^C
--- 192.168.1.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1048ms
rtt min/avg/max/mdev = 0.023/0.164/0.306/0.142 ms

 

 

tcpdump actually found arp response packet on tap3_br, no hair found on tap4_br arp response packet

[root@kunpeng82 devuser]# tcpdump -i tap3_br
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap3_br, link-type EN10MB (Ethernet), capture size 262144 bytes
14:21:53.729020 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:21:53.729147 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:21:54.787148 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:21:54.787173 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:21:55.827157 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:21:55.827176 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:21:56.867251 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:21:56.867270 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:21:57.907144 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:21:57.907163 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
^C
10 packets captured
10 packets received by filter
0 packets dropped by kernel
[root@kunpeng82 devuser]# tcpdump -i tap4_br
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap4_br, link-type EN10MB (Ethernet), capture size 262144 bytes
14:22:09.598737 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:22:10.627128 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:22:11.667130 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
^C
3 packets captured
3 packets received by filter
0 packets dropped by kernel

 

ovs-appctl ofproto/trace vswitch0 in_port=1诊断
[root@kunpeng82 devuser]# ovs-appctl ofproto/trace vswitch0 in_port=1
Flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000

bridge("vswitch0")
------------------
 0. in_port=1, priority 1
    strip_vlan
    output:2

Final flow: unchanged
Megaflow: recirc_id=0,eth,in_port=1,dl_type=0x0000
Datapath actions: 3
 删除 这条flow: cookie=0x0, duration=2499.930s, table=0, n_packets=387, n_bytes=16422, priority=1,in_port="tap0_br" actions=strip_vlan,output:"tap3_br"
[root@kunpeng82 devuser]# ovs-ofctl del-flows vswitch0 in_port="tap0_br"
[root@kunpeng82 devuser]#  ovs-ofctl add-flow vswitch0 priority=1,in_port=1,actions=strip_vlan,normal
[root@kunpeng82 devuser]# ip netns exec ns4 ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
From 192.168.1.44 icmp_seq=1 Destination Host Unreachable
From 192.168.1.44 icmp_seq=2 Destination Host Unreachable
From 192.168.1.44 icmp_seq=3 Destination Host Unreachable
From 192.168.1.44 icmp_seq=4 Destination Host Unreachable
From 192.168.1.44 icmp_seq=5 Destination Host Unreachable

tcpdump能抓到包了

[root@kunpeng82 devuser]# tcpdump -i tap4_br
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap4_br, link-type EN10MB (Ethernet), capture size 262144 bytes
14:28:26.387130 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:26.387165 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:27.427221 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:27.427245 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:28.467130 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:28.467165 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:29.507129 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:29.507169 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:30.547224 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:30.547247 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:31.587131 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:31.587162 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
14:28:32.627130 ARP, Request who-has 192.168.1.100 tell 192.168.1.44, length 28
14:28:32.627164 ARP, Reply 192.168.1.100 is-at ca:03:87:45:02:90 (oui Unknown), length 28
^C
14 packets captured
14 packets received by filter
0 packets dropped by kernel
[root@kunpeng82 devuser]#

还是不通哦
[root@kunpeng82 devuser]# ip netns exec ns4 ping 192.168.1.100 PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data. ^C --- 192.168.1.100 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2118ms [root@kunpeng82 devuser]#

 

Guess you like

Origin www.cnblogs.com/dream397/p/12634866.html