关键词:vtep spine leaf
vxlan vni vsi vsi-interface
1,配置undlay,用ospf将spine和所以leaf都打通,所以节点上都要1.1.1.1、2.2.2.2、3.3.3.3、4.4.4.4的路由。
2,在leaf1、leaf2、leaf3上创建隧道。leaf1上创建隧道12(leaf1到leaf2,后面类似命名),13;在leaf2上创建隧道21、23;在leaf3上创建隧道31。
leaf1:
interface Tunnel12 mode vxlan
source 1.1.1.1
destination 2.2.2.2
#
interface Tunnel13 mode vxlan
source 1.1.1.1
destination 3.3.3.3
leaf2:
interface Tunnel21 mode vxlan
source 2.2.2.2
destination 1.1.1.1
#
interface Tunnel23 mode vxlan
source 2.2.2.2
destination 3.3.3.3
leaf3:
interface Tunnel31 mode vxlan
source 3.3.3.3
destination 1.1.1.1
#
interface Tunnel32 mode vxlan
source 3.3.3.3
destination 2.2.2.2
3,在leaf1上创建vsi a1、a2、a3,在leaf2上创建vsi b1、b2、b3,在leaf3上创建c1、c4。并关联到相应的vxlan,绑定到对应的隧道。
leaf1:
vsi a1
vxlan 100
tunnel 12
tunnel 13
#
vsi a2
vxlan 200
tunnel 12
#
vsi a3
vxlan 300
tunnel 12
leaf2:
vsi b1
vxlan 100
tunnel 21
tunnel 23
#
vsi b2
vxlan 200
tunnel 21
#
vsi b3
vxlan 300
tunnel 21
leaf3:
vsi c1
vxlan 100
tunnel 31
tunnel 32
#
vsi c4
vxlan 400
由于vxlan 400只有leaf3上有,所以它没有绑定其它隧道。
4,在各leaf上配置感兴趣的数据流。
leaf1:
interface GigabitEthernet0/1
xconnect vsi a1
leaf1的端口g0/2下还接了一台交换机sw1,这样在sw1上需要配置vlan,将下面的两个虚拟机添加到对应的vlan,在sw1的g1/0/1上配置trunk,让虚拟机的数据包带着vlan id到leaf1,在leaf1的g0/2接口上配置子接口,让后配置感兴趣的数据流。
interface GigabitEthernet0/2.1
vlan-type dot1q vid 10
xconnect vsi a2
interface GigabitEthernet0/2.2
vlan-type dot1q vid 20
xconnect vsi a3
leaf2:
leaf2是一台交换机,在g1/0/2端口上配置服务实例时,感兴趣的数据流是不带标签包。在g1/0/3端口下连接了一台交换机sw2,sw2上也要配置vlan,将虚拟机放入对应的vlan。在sw2的g1/0/1接口上让数据包带着vlan 标签到leaf2的g1/0/3口。
interface GigabitEthernet1/0/2
#
service-instance 1
encapsulation untagged
xconnect vsi b3
interface GigabitEthernet1/0/3
port link-type trunk
port trunk permit vlan 1 10 20
#
service-instance 2
encapsulation s-vid 10
xconnect vsi b2
#
service-instance 3
encapsulation s-vid 20
xconnect vsi b1
leaf3:
interface GigabitEthernet0/2
xconnect vsi c1
5,经过上面的配置,各个leaf之间,同一个vxlan内的虚拟机相通了。但是不同vxlan之间的虚拟机还不能通讯。vxlan是一个二层的概念,本质上还是一个大二层。不同的二层之间要相互通讯,需要借助网关,类似vlan一样。vlan有vlan-if接口,vxlan也同样需要类似接口,这就是vsi接口。
leaf1:
创建vsi接口
interface Vsi-interface100
ip address 192.168.1.254 255.255.255.0
distributed-gateway local
#
interface Vsi-interface200
ip address 192.168.2.254 255.255.255.0
distributed-gateway local
#
interface Vsi-interface300
ip address 192.168.3.254 255.255.255.0
distributed-gateway local
将接口关联到vsi
vsi a1
gateway vsi-interface 100
vsi a2
gateway vsi-interface 200
vsi a3
gateway vsi-interface 300
leaf2、leaf3也要做同样的配置。
leaf2:
interface Vsi-interface100
ip address 192.168.1.254 255.255.255.0
distributed-gateway local
#
interface Vsi-interface200
ip address 192.168.2.254 255.255.255.0
distributed-gateway local
#
interface Vsi-interface300
ip address 192.168.3.254 255.255.255.0
distributed-gateway local
vsi b1
gateway vsi-interface 100
vsi b2
gateway vsi-interface 200
vsi b3
gateway vsi-interface 300
leaf3:
interface Vsi-interface100
ip address 192.168.1.254 255.255.255.0
distributed-gateway local
#
interface Vsi-interface400
ip address 172.16.1.254 255.255.255.0
distributed-gateway local
vsi c1
gateway vsi-interface 100
vsi c4
gateway vsi-interface 400
配置以上网关,并关联到vsi后,不同的vxlan之间就可以通讯了。