节点1
ip netns add ns1 ip link add veth1 type veth peer name eth0 netns ns1 ip netns exec ns1 ip link set eth0 up ip netns exec ns1 ip link set lo up ip netns exec ns1 ip addr add 3.3.3.3/24 dev eth0 ip link set up dev veth1 ip link add br1 type bridge ip link set br1 up ip link set veth1 master br1 #没有配置vxlan remote ip link add vxlan100 type vxlan id 100 dstport 4789 group 239.1.1.1 dev enahisic2i0 ip link set vxlan100 master br1 ip link set up vxlan100
[root@bogon ~]# ip netns exec ns1 ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether ba:d8:f4:bf:4f:f5 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 3.3.3.3/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::b8d8:f4ff:febf:4ff5/64 scope link valid_lft forever preferred_lft forever
[root@bogon ~]# bridge fdb | grep vxlan100 6e:fd:f1:35:d2:0e dev vxlan100 master br1 9e:63:b2:22:5c:a7 dev vxlan100 vlan 1 master br1 permanent 9e:63:b2:22:5c:a7 dev vxlan100 master br1 permanent 00:00:00:00:00:00 dev vxlan100 dst 239.1.1.1 via enahisic2i0 self permanent
ping 之后
[root@bogon ~]# bridge fdb | grep 6e:fd:f1:35:d2:0e 6e:fd:f1:35:d2:0e dev vxlan100 master br1 6e:fd:f1:35:d2:0e dev vxlan100 dst 10.10.16.82 self [root@bogon ~]# bridge fdb | grep vxlan100 9e:63:b2:22:5c:a7 dev vxlan100 vlan 1 master br1 permanent 9e:63:b2:22:5c:a7 dev vxlan100 master br1 permanent 00:00:00:00:00:00 dev vxlan100 dst 239.1.1.1 via enahisic2i0 self permanent 6e:fd:f1:35:d2:0e dev vxlan100 dst 10.10.16.82 self [root@bogon ~]#
节点2
root@ubuntu:/home/ubuntu# ip netns exec ns1 ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0@if131: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 6e:fd:f1:35:d2:0e brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 3.3.3.4/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::6cfd:f1ff:fe35:d20e/64 scope link valid_lft forever preferred_lft forever root@ubuntu:/home/ubuntu#
ip netns add ns1 ip link add veth1 type veth peer name eth0 netns ns1 ip netns exec ns1 ip link set eth0 up ip netns exec ns1 ip link set lo up ip netns exec ns1 ip addr add 3.3.3.4/24 dev eth0 ip link set up dev veth1 ip link add br1 type bridge ip link set br1 up ip link set veth1 master br1 ip link add vxlan100 type vxlan id 100 dstport 4789 group 239.1.1.1 dev enahisic2i0 ip link set vxlan100 master br1 ip link set up vxlan100
ubuntu@ubuntu:~$ bridge fdb | grep vxlan100 be:83:33:8e:a0:f9 dev vxlan100 vlan 1 master br1 permanent ba:d8:f4:bf:4f:f5 dev vxlan100 master br1 be:83:33:8e:a0:f9 dev vxlan100 master br1 permanent 00:00:00:00:00:00 dev vxlan100 dst 239.1.1.1 via enahisic2i0 self permanent
ping 之后
root@ubuntu:/home/ubuntu# bridge fdb | grep vxlan100 be:83:33:8e:a0:f9 dev vxlan100 vlan 1 master br1 permanent be:83:33:8e:a0:f9 dev vxlan100 master br1 permanent 00:00:00:00:00:00 dev vxlan100 dst 239.1.1.1 via enahisic2i0 self permanent ba:d8:f4:bf:4f:f5 dev vxlan100 dst 10.10.16.81 self root@ubuntu:/home/ubuntu# bridge fdb | grep ba:d8:f4:bf:4f:f5 ba:d8:f4:bf:4f:f5 dev vxlan100 dst 10.10.16.81 self root@ubuntu:/home/ubuntu#
删掉fdb表
[root@bogon ~]# bridge fdb del 6e:fd:f1:35:d2:0e dev vxlan100 dst 10.10.16.82 [root@bogon ~]# bridge fdb | grep 6e:fd:f1:35:d2:0e 6e:fd:f1:35:d2:0e dev vxlan100 master br1
有广播请求
再次删掉neigbbor和fdb
[root@bogon ~]# bridge fdb del 6e:fd:f1:35:d2:0e dev vxlan100 dst 10.10.16.82 [root@bogon ~]# ip netns exec ns1 ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether ba:d8:f4:bf:4f:f5 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 3.3.3.3/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::b8d8:f4ff:febf:4ff5/64 scope link valid_lft forever preferred_lft forever [root@bogon ~]# ip netns exec ns1 ip n 3.3.3.4 dev eth0 lladdr 6e:fd:f1:35:d2:0e STALE [root@bogon ~]# ip netns exec ns1 ip n del 3.3.3.4 dev eth0 lladdr 6e:fd:f1:35:d2:0e [root@bogon ~]# ip netns exec ns1 ping 3.3.3.4 PING 3.3.3.4 (3.3.3.4) 56(84) bytes of data. 64 bytes from 3.3.3.4: icmp_seq=1 ttl=64 time=0.685 ms 64 bytes from 3.3.3.4: icmp_seq=2 ttl=64 time=0.181 ms 64 bytes from 3.3.3.4: icmp_seq=3 ttl=64 time=0.118 ms ^C --- 3.3.3.4 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2078ms rtt min/avg/max/mdev = 0.118/0.328/0.685/0.253 ms [root@bogon ~]#
root@ubuntu:/home/ubuntu# tcpdump -i enahisic2i0 host 239.1.1.1 or host 10.10.16.81 -env tcpdump: listening on enahisic2i0, link-type EN10MB (Ethernet), capture size 262144 bytes 22:09:46.691807 48:57:02:64:ea:1b > 01:00:5e:01:01:01, ethertype IPv4 (0x0800), length 92: (tos 0x0, ttl 1, id 25712, offset 0, flags [none], proto UDP (17), length 78) 10.10.16.81.36550 > 239.1.1.1.4789: VXLAN, flags [I] (0x08), vni 100 ba:d8:f4:bf:4f:f5 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 3.3.3.4 tell 3.3.3.3, length 28 22:09:46.692019 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype IPv4 (0x0800), length 92: (tos 0x0, ttl 64, id 5036, offset 0, flags [none], proto UDP (17), length 78) 10.10.16.82.46741 > 10.10.16.81.4789: VXLAN, flags [I] (0x08), vni 100 6e:fd:f1:35:d2:0e > ba:d8:f4:bf:4f:f5, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Reply 3.3.3.4 is-at 6e:fd:f1:35:d2:0e, length 28 22:09:46.692158 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 14558, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.81.46930 > 10.10.16.82.4789: VXLAN, flags [I] (0x08), vni 100 ba:d8:f4:bf:4f:f5 > 6e:fd:f1:35:d2:0e, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 38719, offset 0, flags [DF], proto ICMP (1), length 84) 3.3.3.3 > 3.3.3.4: ICMP echo request, id 50045, seq 1, length 64 22:09:46.692335 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 5037, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.82.50225 > 10.10.16.81.4789: VXLAN, flags [I] (0x08), vni 100 6e:fd:f1:35:d2:0e > ba:d8:f4:bf:4f:f5, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 23465, offset 0, flags [none], proto ICMP (1), length 84) 3.3.3.4 > 3.3.3.3: ICMP echo reply, id 50045, seq 1, length 64 22:09:47.729836 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 14659, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.81.46930 > 10.10.16.82.4789: VXLAN, flags [I] (0x08), vni 100 ba:d8:f4:bf:4f:f5 > 6e:fd:f1:35:d2:0e, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 38780, offset 0, flags [DF], proto ICMP (1), length 84) 3.3.3.3 > 3.3.3.4: ICMP echo request, id 50045, seq 2, length 64 22:09:47.729927 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 5101, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.82.50225 > 10.10.16.81.4789: VXLAN, flags [I] (0x08), vni 100 6e:fd:f1:35:d2:0e > ba:d8:f4:bf:4f:f5, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 23672, offset 0, flags [none], proto ICMP (1), length 84) 3.3.3.4 > 3.3.3.3: ICMP echo reply, id 50045, seq 2, length 64 22:09:48.769820 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 14703, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.81.46930 > 10.10.16.82.4789: VXLAN, flags [I] (0x08), vni 100 ba:d8:f4:bf:4f:f5 > 6e:fd:f1:35:d2:0e, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 38867, offset 0, flags [DF], proto ICMP (1), length 84) 3.3.3.3 > 3.3.3.4: ICMP echo request, id 50045, seq 3, length 64 22:09:48.769842 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype IPv4 (0x0800), length 148: (tos 0x0, ttl 64, id 5116, offset 0, flags [none], proto UDP (17), length 134) 10.10.16.82.50225 > 10.10.16.81.4789: VXLAN, flags [I] (0x08), vni 100 6e:fd:f1:35:d2:0e > ba:d8:f4:bf:4f:f5, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 23820, offset 0, flags [none], proto ICMP (1), length 84) 3.3.3.4 > 3.3.3.3: ICMP echo reply, id 50045, seq 3, length 64 22:09:51.729781 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.16.82 tell 10.10.16.81, length 46 22:09:51.729789 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Reply 10.10.16.82 is-at 48:57:02:64:e7:ab, length 28 22:09:51.744001 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.16.81 tell 10.10.16.82, length 28 22:09:51.744014 48:57:02:64:e7:ab > 48:57:02:64:ea:1b, ethertype IPv4 (0x0800), length 92: (tos 0x0, ttl 64, id 5429, offset 0, flags [none], proto UDP (17), length 78) 10.10.16.82.46741 > 10.10.16.81.4789: VXLAN, flags [I] (0x08), vni 100 6e:fd:f1:35:d2:0e > ba:d8:f4:bf:4f:f5, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 3.3.3.3 tell 3.3.3.4, length 28 22:09:51.744040 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.10.16.81 is-at 48:57:02:64:ea:1b, length 46 22:09:51.744125 48:57:02:64:ea:1b > 48:57:02:64:e7:ab, ethertype IPv4 (0x0800), length 92: (tos 0x0, ttl 64, id 14907, offset 0, flags [none], proto UDP (17), length 78) 10.10.16.81.36550 > 10.10.16.82.4789: VXLAN, flags [I] (0x08), vni 100 ba:d8:f4:bf:4f:f5 > 6e:fd:f1:35:d2:0e, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Reply 3.3.3.3 is-at ba:d8:f4:bf:4f:f5, length 28