neutron基础六(bridge fdb)

转发表

在三台机器上建立三个namespace
192.168.139.55 上namespace 10.1.0.5
192.168.139.186 上namespace 10.1.0.6
192.168.139.221 上namespace 10.1.0.7

每天机器上建立个namespace zou
建立个veth peer(zouveth0,zouveth1) 一个扔进namespace(zouveth1)
建立个桥接br-zou
把zouveth0 接到桥上
建立一个vxlan remote指向非自己的一台机器的ip
把这个vxlan街道桥上

55指向了186,186指向了55
这样设置后两台机器上的namespace能互相ping通

221也指向55 ,和55能互相ping通
但是221 ping  不了186
所以需要设置bridge fdb
bridge fdb append 00:00:00:00:00:00 dev vxlan-10 dst 192.168.139.186 via eth0
bridge fdb 查看
bridge fdb add是增加
bridge fdb del 是删除
bridge fdb append 是再原来的mac和vxlan名字形同的基础上增加

在192.168.139.55上
#!/bin/sh
ip netns add zou
ip link add zouveth0 type veth peer name zouveth1
brctl addbr br-zou
brctl addif br-zou zouveth0
ip link set zouveth1 netns zou
ip link add vxlan-10 type vxlan id 10 remote 192.168.139.186  dev eth0
brctl addif br-zou vxlan-10
ip netns exec zou ip a add dev zouveth1 10.1.0.5/24

ip link set zouveth0 up
ip netns exec zou ip link set zouveth1 up
ip netns exec zou ip link set lo up
ip link br-zou up
ip link set br-zou up
ip link set vxlan-10 up


在192.168.139.186上
#!/bin/sh
ip netns add zou
ip link add zouveth0 type veth peer name zouveth1
brctl addbr br-zou
brctl addif br-zou zouveth0
ip link set zouveth1 netns zou
ip link add vxlan-10 type vxlan id 10 remote 192.168.139.55  dev eth0
brctl addif br-zou vxlan-10
ip netns exec zou ip a add dev zouveth1 10.1.0.6/24

ip link set zouveth0 up
ip netns exec zou ip link set zouveth1 up
ip netns exec zou ip link set lo up
ip link br-zou up
ip link set br-zou up
ip link set vxlan-10 up


在192.168.139.221上
#!/bin/sh
ip netns add zou
ip link add zouveth0 type veth peer name zouveth1
brctl addbr br-zou
brctl addif br-zou zouveth0
ip link set zouveth1 netns zou
ip link add vxlan-10 type vxlan id 10 remote 192.168.139.55  dev eth0
brctl addif br-zou vxlan-10
ip netns exec zou ip a add dev zouveth1 10.1.0.7/24

ip link set zouveth0 up
ip netns exec zou ip link set zouveth1 up
ip netns exec zou ip link set lo up
ip link br-zou up
ip link set br-zou up
ip link set vxlan-10 up



最后

bridge fdb append 00:00:00:00:00:00 dev vxlan-10 dst 192.168.139.186 via eth0

可以保证三个都ping通
在221上
ip netns exec zou ping 10.1.0.5
ip netns exec zou ping 10.1.0.6

猜你喜欢

转载自haoningabc.iteye.com/blog/2274788