右側(cè)MGMT交換機(jī)為管理cumuls及ubuntu host用的
Cumulus-1的接口配置
root@cumulus-1:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
address 1.1.1.1/32
auto eth0
iface eth0 inet static
address 10.5.39.241
netmask 255.255.255.0
gateway 10.5.39.254
auto swp1
iface swp1 inet static
address 10.50.39.241
netmask 255.255.255.0
auto swp2
iface swp2
auto bridge
iface bridge
bridge-ports swp2 vxlan100 vxlan200
bridge-vids 100 200
bridge-vlan-aware yes
auto vlan100
iface vlan100
address 10.10.10.1/24
address-virtual 00:00:00:00:00:1a 10.10.10.254/24
vlan-id 100
vlan-raw-device bridge
auto vlan200
iface vlan200
address 20.20.20.1/24
address-virtual 00:00:00:00:00:2a 20.20.20.254/24
vlan-id 200
vlan-raw-device bridge
auto vxlan100
iface vxlan100
bridge-access 100
bridge-arp-nd-suppress on
bridge-learning off
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
vxlan-id 100
vxlan-local-tunnelip 1.1.1.1
auto vxlan200
iface vxlan200
bridge-access 200
bridge-arp-nd-suppress on
bridge-learning off
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
vxlan-id 200
vxlan-local-tunnelip 1.1.1.1
Cumulus-2的接口配置
root@cumulus-2:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
address 2.2.2.2/32
auto eth0
iface eth0 inet static
address 10.5.39.242
netmask 255.255.255.0
gateway 10.5.39.254
auto swp1
iface swp1 inet static
address 10.50.39.242
netmask 255.255.255.0
auto swp2
iface swp2
auto bridge
iface bridge
bridge-ports swp2 vxlan100 vxlan200
bridge-vids 100 200
bridge-vlan-aware yes
auto vlan100
iface vlan100
address 10.10.10.1/24
address-virtual 00:00:00:00:00:1a 10.10.10.254/24
vlan-id 100
vlan-raw-device bridge
auto vlan200
iface vlan200
address 20.20.20.1/24
address-virtual 00:00:00:00:00:2a 20.20.20.254/24
vlan-id 200
vlan-raw-device bridge
auto vxlan100
iface vxlan100
bridge-access 100
bridge-arp-nd-suppress on
bridge-learning off
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
vxlan-id 100
vxlan-local-tunnelip 2.2.2.2
auto vxlan200
iface vxlan200
bridge-access 200
bridge-arp-nd-suppress on
bridge-learning off
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
vxlan-id 200
vxlan-local-tunnelip 2.2.2.2
Cumulus-1的VXLAN及MP-IBGP配置
net add vlan 100 ip address-virtual 00:00:00:00:00:1a 10.10.10.254/24
net add vlan 100 ip address 10.10.10.1/24
net add vxlan vxlan100 vxlan id 100
net add vxlan vxlan100 vxlan local-tunnelip 1.1.1.1
net add vxlan vxlan100 bridge access 100
net add vxlan vxlan100 bridge learning off
net add vxlan vxlan100 bridge arp-nd-suppress on
net add vlan 200 ip address-virtual 00:00:00:00:00:2a 20.20.20.254/24
net add vlan 200 ip address 20.20.20.1/24
net add vxlan vxlan200 vxlan id 200
net add vxlan vxlan200 vxlan local-tunnelip 1.1.1.1
net add vxlan vxlan200 bridge access 200
net add vxlan vxlan200 bridge learning off
net add vxlan vxlan200 bridge arp-nd-suppress on
net add bgp router-id 1.1.1.1
net add bgp autonomous-system 65000
net add bgp neighbor swp1 remote-as internal
net add bgp neighbor swp1 update-source swp1
net add bgp ipv4 unicast network 1.1.1.1/32
net add bgp evpn neighbor swp1 activate
net add bgp evpn advertise-all-vni
net add bridge bridge ports swp2 #添加向下的業(yè)務(wù)接口,封裝為802.1Q
net pending
net commit
形成以下/etc/frr/frr.conf配置
root@cumulus-1:~# cat /etc/frr/frr.conf
router bgp 65000
bgp router-id 1.1.1.1
neighbor swp1 interface remote-as internal
address-family ipv4 unicast
network 1.1.1.1/32
exit-address-family
address-family l2vpn evpn
neighbor swp1 activate
advertise-all-vni
exit-address-family
Cumulus-2的VXLAN及MP-IBGP配置
net add vlan 100 ip address-virtual 00:00:00:00:00:1a 10.10.10.254/24
net add vlan 100 ip address 10.10.10.1/24
net add vxlan vxlan100 vxlan id 100
net add vxlan vxlan100 vxlan local-tunnelip 2.2.2.2
net add vxlan vxlan100 bridge access 100
net add vxlan vxlan100 bridge learning off
net add vxlan vxlan100 bridge arp-nd-suppress on
net add vlan 200 ip address-virtual 00:00:00:00:00:2a 20.20.20.254/24
net add vlan 200 ip address 20.20.20.1/24
net add vxlan vxlan200 vxlan id 200
net add vxlan vxlan200 vxlan local-tunnelip 2.2.2.2
net add vxlan vxlan200 bridge access 200
net add vxlan vxlan200 bridge learning off
net add vxlan vxlan200 bridge arp-nd-suppress on
net add bgp router-id 2.2.2.2
net add bgp autonomous-system 65000
net add bgp neighbor swp1 remote-as internal
net add bgp neighbor swp1 update-source swp1
net add bgp ipv4 unicast network 2.2.2.2/32
net add bgp evpn neighbor swp1 activate
net add bgp evpn advertise-all-vni
net add bridge bridge ports swp2 #添加向下的業(yè)務(wù)接口,封裝為802.1Q
net pending
net commit
形成以下/etc/frr/frr.conf配置
root@cumulus-2:~# cat /etc/frr/frr.conf
router bgp 65000
bgp router-id 2.2.2.2
neighbor swp1 interface remote-as internal
address-family ipv4 unicast
network 2.2.2.2/32
exit-address-family
address-family l2vpn evpn
neighbor swp1 activate
advertise-all-vni
exit-address-family
計(jì)算節(jié)點(diǎn)HOST1和HOST2的接口配置
root@host-1:~# cat /etc/network/interfaces.d/50-cloud-init.cfg
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
address 10.5.39.248
netmask 255.255.255.0
gateway 10.5.39.254
dns-nameservers 10.5.17.36
auto ens4
iface ens4
root@host-2:~# cat /etc/network/interfaces.d/50-cloud-init.cfg
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
address 10.5.39.249
netmask 255.255.255.0
gateway 10.5.39.254
dns-nameservers 10.5.17.36
auto ens4
iface ens4
HOST1上netns testA及testB配置
root@host-1:~# cat /root/test.sh
ip link add link ens4 name ens4.100 type vlan id 100
ip link add link ens4 name ens4.200 type vlan id 200
ip link set ens4 up
ip link add vethA type veth peer name vethAA
ip link set vethA up
ip netns add testA
ip link set vethAA netns testA
ip netns exec testA ip link set dev vethAA address 00:01:01:01:01:01
ip netns exec testA ip add add 10.10.10.10/24 dev vethAA
ip netns exec testA ip link set vethAA up
ip netns exec testA ip link set lo up
brctl addbr br100
brctl stp br100 off
ip link set br100 up
brctl addif br100 vethA
brctl addif br100 ens4.100
ip link add vethB type veth peer name vethBB
ip link set vethB up
ip netns add testB
ip link set vethBB netns testB
ip netns exec testB ip link set dev vethBB address 00:02:02:02:02:02
ip netns exec testB ip add add 20.20.20.20/24 dev vethBB
ip netns exec testB ip link set vethBB up
ip netns exec testB ip link set lo up
brctl addbr br200
brctl stp br200 off
ip link set br200 up
brctl addif br200 vethB
brctl addif br200 ens4.200
ip netns exec testA ip route add default via 10.10.10.254
ip netns exec testB ip route add default via 20.20.20.254
HOST2上netns testA及testB配置
root@host-2:~# cat /root/test.sh
ip link add link ens4 name ens4.100 type vlan id 100
ip link add link ens4 name ens4.200 type vlan id 200
ip link set ens4 up
ip link add vethA type veth peer name vethAA
ip link set vethA up
ip netns add testA
ip link set vethAA netns testA
ip netns exec testA ip link set dev vethAA address 00:01:01:01:01:88
ip netns exec testA ip add add 10.10.10.88/24 dev vethAA
ip netns exec testA ip link set vethAA up
ip netns exec testA ip link set lo up
brctl addbr br100
brctl stp br100 off
ip link set br100 up
brctl addif br100 vethA
brctl addif br100 ens4.100
ip link add vethB type veth peer name vethBB
ip link set vethB up
ip netns add testB
ip link set vethBB netns testB
ip netns exec testB ip link set dev vethBB address 00:02:02:02:02:88
ip netns exec testB ip add add 20.20.20.88/24 dev vethBB
ip netns exec testB ip link set vethBB up
ip netns exec testB ip link set lo up
brctl addbr br200
brctl stp br200 off
ip link set br200 up
brctl addif br200 vethB
brctl addif br200 ens4.200
ip netns exec testA ip route add default via 10.10.10.254
ip netns exec testB ip route add default via 20.20.20.254
測(cè)試
root@host-2:~# ip netns exec testB ping 20.20.20.20 -c 2
PING 20.20.20.20 (20.20.20.20) 56(84) bytes of data.
64 bytes from 20.20.20.20: icmp_seq=1 ttl=64 time=1.34 ms
64 bytes from 20.20.20.20: icmp_seq=2 ttl=64 time=1.32 ms
--- 20.20.20.20 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.321/1.331/1.341/0.010 ms
root@host-2:~#
root@host-2:~#
root@host-2:~# ip netns exec testB ping 10.10.10.10 -c 2
PING 10.10.10.10 (10.10.10.10) 56(84) bytes of data.
64 bytes from 10.10.10.10: icmp_seq=1 ttl=63 time=1.18 ms
64 bytes from 10.10.10.10: icmp_seq=2 ttl=63 time=1.39 ms
--- 10.10.10.10 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.181/1.286/1.392/0.111 ms
注意測(cè)試arp和nd的抑制