VXLAN实现数据中心大二层互联互通

一、VXLAN拓扑

VXLAN实现数据中心大二层互联互通

适合有网络基础的朋友进行阅读

二、 基本Underlay网络配置

配置OSPF实现DC1下面的N9K可以学到DC2下面N9K环回口路由反之亦然!

1、OSPF配置:

DC1配置:

interface Ethernet0/1

ip address 10.1.12.1 255.255.255.252

ip ospf 1 area 0

interface Ethernet0/0

ip address 20.1.1.2 255.255.255.252

ip ospf 1 area 0

DC2配置:

DC2#show run int e 0/0

interface Ethernet0/0

ip address 30.1.1.2 255.255.255.252

ip ospf 1 area 0

interface Ethernet0/2

ip address 10.1.23.2 255.255.255.252

ip ospf 1 area 0

duplex auto

SP配置:

SP#show run | s r ospf

router ospf 1

interface Ethernet0/1

ip address 10.1.12.2 255.255.255.252

ip ospf 1 area 0

interface Ethernet0/2

ip address 10.1

.23.1 255.255.255.252

ip ospf 1 area 0

数据中心N9K设备(NXOS1)配置:

feature ospf //开启OSPF功能

switch(config)# router ospf 1

//进入OSPF进程1

switch(config-router)# router-id 1.1.1.1 //配置RID

interface Ethernet1/1

no switchport

ip address 20.1.1.1/30

ip router ospf 1 area 0.0.0.0 //接口发布进OPSF区域0

no shutdown

数据中心N9K设备(NXOS2)配置:

switch(config)# feature ospf

switch(config)# router ospf 1

switch(config-router)# router-id 2.2.2.2

switch(config)# int e 1/1

switch(config-if)# no switchport

switch(config-if)# ip address 30.1.1.1 255.255.255.252

switch(config-if)# ip router ospf 1 area 0

三、验证OSPF邻居关系

1、SP:

SP#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface

30.1.1.1 1 FULL/BDR 00:00:32 10.1.23.2 Ethernet0/2

20.1.1.2 1 FULL/BDR 00:00:37 10.1.12.1 Ethernet0/1

2、N9K1(N

XOS1)

switch# show ip ospf neighbors

OSPF Process ID 1 VRF default

Total number of neighbors: 1

Neighbor ID Pri State Up Time Address Interface

20.1.1.2 1 FULL/DR 00:09:00 20.1.1.2 Eth1/1

VXLAN实现数据中心大二层互联互通

3、N9K2(NXOS2)

switch# show ip ospf neighbors

OSPF Process ID 1 VRF default

Total number of neighbors: 1

Neighbor ID Pri State Up Time Address Interface

30.1.1.1 1 FULL/DR 00:03:51 30.1.1.2 Eth1/1

VXLAN实现数据中心大二层互联互通

4、查看N9K设备互相学到对端路由

N9K1(NXOS1)设备学到对端2.2.2.2的路由:

VXLAN实现数据中心大二层互联互通

N9K2(NXOS2)设备学到对端1.1.1.1的路由:

VXLAN实现数据中心大二层互联互通

N9K1可以Ping通N9K2

VXLAN实现数据中心大二层互联互通

N9K1基本VLAN配置:

VLAN 10

interface Ethernet1/2

switchport access vlan 10

spanning-tree port type edge

N9K2基本VLAN配置:

VLAN 10

interface Ethernet1/2

switchport access vlan 10

spanning-tree port type edge

三、配置Overlay VXLAN

N9K1 VXLAN配置

N9K-1(config)# feature nv overlay //启用vxlan

N9K-1(config)# feature v

n-segment-vlan-based //全局启动vxlan桥域

N9K-1(config)# vlan 10 //配置VLAN10

N9K-1(config-vlan)# vn-segment 10010 //配置vxlan vnid

N9K

-1(config-vlan)# interface nve 1 //创建Vxlan nve接口,用于传输vxlan隧道

Warning: Enable double-wide arp-ether tcam carving if igmp snooping/Hsrp over vx lan is enabled. Ignore if tcam carving is already configured.

N9K-1(config-if-nve)# no shutdown

N9K-1(config-if-nve)# source-interface loopback 0 //配置用于去和对端互联的接口

N9K-1(config-if-nve)# member vni 10010 //绑定nve接口和vni

N9K-1(config-if-nve-vni)# ingress-replication protocol static //**static ingress replication for the VN

N9K-1(config-if-nve-vni-ingr-rep)# peer-ip 2.2.2.2 //配置Vxlan peer

N9K2 VXLAN配置

N9K-2(config)# feature nv overlay

N9K-2(config)# feature vn-segment-vlan-based

N9K-2(config)# vlan 10

N9K-2(config-vlan)# vn-segment 10010

N9K-2(config-vlan)# interface nv1

 

N9K-2(config-if-nve)# no sh

N9K-2(config-if-nve)# source-interface loo0

N9K-2(config-if-nve)# member vni 10010

N9K-2(config-if-nve-vni)# ingress-replication protocol static

N9K-2(config-if-nve-vni-ingr-rep)# peer-ip 1.1.1.1

四、测试及抓包

VPCS> ping 192.168.1.2

84 bytes from 192.168.1.2 icmp_seq=1 ttl=64 time=27.095 ms

84 bytes from 192.168.1.2 icmp_seq=2 ttl=64 time=21.109 ms

PC之间可以实现互通

在DC1 E0/1进行抓包查看:

VXLAN实现数据中心大二层互联互通

可以查看到VXLAN报文,VNI:10010, 使用UDP 目标端口4789

 

每天关注的前10名小伙伴关注分享该WX Gongzhonghao: 

 华亿网络实验室 或   huayinetwork 进行资料下载

 

VXLAN实现数据中心大二层互联互通