侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

N9K配置Vxlan

2023-02-18 星期六 / 0 评论 / 0 点赞 / 47 阅读 / 24480 字

Vxlan是什么VXLAN(Virtual eXtensible Local Area Network)虚拟可扩展局域网。Vxlan是传输于跨越三层路由网络传输的第二层连接扩展。CiscoNexus

.

Vxlan是什么

VXLAN(Virtual eXtensible Local Area Network)虚拟可扩展局域网。
Vxlan是传输于跨越三层路由网络传输的第二层连接扩展。

CiscoNexus 9000交换机是为基于硬件的VXLAN功能而设计的.它提供跨第三层边界的第二层连接扩展,并在VXLAN和非VXLAN基础设施之间集成。这可以在共享的公共物理基础结构上启用虚拟化和多租户数据中心的设计。VXLAN提供了一种在第三层基础设施上扩展第二层网络的方法,使用的是在UDP中的MAC封装和隧道。VXLAN使用第二层扩展支持灵活的工作负载放置。它还可以通过将租户层2层与共享传输网络分离来构建多租户数据中心。当作为VXLAN网关部署时,Cisco Nexus 9000交换机可以连接VXLAN和经典VLAN段以创建公共转发域,以便租户设备可以驻留在这两种环境中。

Vxlan有以下优点

VXLAN有以下优点:•   在整个数据中心中灵活地放置多租户段。它提供了一种在底层共享网络基础设施上扩展第二层(layer 2)的方法,以便租户工作负载可以跨数据中心的物理节点放置。•   更高的可伸缩性,以解决更多的第二层段。VXLAN使用24位段ID,即VXLAN网络标识符(VNID).这允许最多1600万VXLAN段在同一管理域中共存。(相比之下,传统的VLAN使用12位段ID,最多支持4096个VLAN。)•   基础架构中可用网络路径的利用。VXLAN包通过底层网络根据其第3层报头进行传输。它使用等成本多径(ECMP)路由和链路聚合协议来使用所有可用路径.

Vxlan封装和数据包格式

VXLAN是第三层网络上的第二层覆盖方案。它使用MAC地址在用户数据报协议(MAC-in-UDP)封装提供了一种方法,以扩展第二层段跨越数据中心网络。VXLAN是一种解决方案,可以在共享的公共物理基础设施上支持灵活的、大规模的多租户环境。物理数据中心网络上的传输协议是IP+UDP。VXLAN定义了一种MAC in UDP封装方案,其中原始的第二层帧中添加了一个VXLAN报头,然后将其放置在UDP-IP数据包中。通过这种在UDP中的MAC封装,VXLAN在第三层网络上穿越了第二层网络.VXLAN使用一个8字节的VXLAN头,它由一个24位的VNID和几个保留位组成。VXLAN报头和原始以太网帧一起进入UDP有效负载。24位VNID用于识别第二层段和保持第二层段之间的隔离。由于VNID中有24位,VXLAN可以支持1600万个LAN段。

Vxlan隧道端点 VTEP

VTEP(Vxlan Tunnel End Point)vxlan虚拟隧道端点。VXLAN使用VXLAN隧道端点(VTEP)设备将租户的终端设备映射到VXLAN段,并执行VXLAN封装和解封装。每个VTEP功能都有两个接口:一个是本地局域网段上的交换机接口,通过桥接支持本地端点通信;另一个是传输IP网络的IP接口。IP接口具有唯一的IP地址,用于标识传输IP网络上的VTEP设备,称为基础设施VLAN。VTEP设备使用此IP地址封装以太网帧,并通过IP接口将封装的数据包发送到传输网络。VTEP设备还发现其VXLAN段的远程VTEP,并通过其IP接口学习远程MAC地址到VTEP的映射。VXLAN段独立于底层网络拓扑;相反,VTEP之间的底层IP网络独立于VXLAN覆盖。它基于外部IP地址报头对封装的数据包进行路由,其中以起始的VTEP作为源IP地址,以终止的VTEP作为目标IP地址。

Vxlan包转发流程

VXLAN使用VTEP之间的无状态隧道通过第三层传输网络(IP网络层)传输覆盖层第二层网络的通信量。

实验拓扑

配置单播 入口复制Vxlan

配置N9K-1

#激活ospfN9K-1(config)# feature ospf #启动ospfN9K-1(config)# router ospf 1 N9K-1(config-router)# router-id 2.2.2.1N9K-1(config-router)# exit#配置loopback接口,并宣告路由N9K-1(config)# interface loopback 0 N9K-1(config-if)# ip add 2.2.2.1 255.255.255.255N9K-1(config-if)# ip router ospf 1 area 0 N9K-1(config-if)# exit#配置e1/1接口ip,并宣告ospf路由N9K-1(config)# interface ethernet 1/1N9K-1(config-if)# no switchport N9K-1(config-if)# ip add 1.1.1.1 255.255.255.0N9K-1(config-if)# ip router ospf 1 area 0 N9K-1(config-if)# no shutdown N9K-1(config-if)# exit#启用vxlanN9K-1(config)# feature nv overlay #全局启动vxlan桥域N9K-1(config)# feature vn-segment-vlan-based #配置下联host1接口N9K-1(config)# interface ethernet 1/2N9K-1(config-if)# switchport N9K-1(config-if)# switchport mode access N9K-1(config-if)# switchport access vlan 11 N9K-1(config-if)# no shutdown N9K-1(config-if)# exit#设置vlan11N9K-1(config)# vlan 11#配置vxlan vnidN9K-1(config-vlan)# vn-segment 10011 N9K-1(config-vlan)# exit#创建Vxlan nve接口#用于传输vxlan隧道N9K-1(config)# interface nve 1 #启动接口N9K-1(config-if-nve)# no shutdown #配置用于去和对端互联的接口,且cisco要求必须是loopback接口。N9K-1(config-if-nve)# source-interface loopback 0 #绑定nve接口和vni,可以绑定多个。N9K-1(config-if-nve)# member vni 10011 #激活static ingress replication for the VNIN9K-1(config-if-nve-vni)# ingress-replication protocol static #配置Vxlan peer,ip最好是对端loopback接口N9K-1(config-if-nve-vni-ingr-rep)# peer-ip 2.2.2.3 N9K-1(config-if-nve-vni-ingr-rep)# exitN9K-1(config-if-nve-vni)# exitN9K-1(config-if-nve)# exit#查看vxlan nve接口状态N9K-1(config)# sh nve vni ingress-replication Interface VNI      Replication List  Source  Up Time      --------- -------- ----------------- ------- -------      nve1      10011    2.2.2.3           CLI     Down 

配置N9K-2

#激活ospfN9K-2(config)# feature ospf#启动ospfN9K-2(config)# router ospf 1 N9K-2(config-router)# router-id 2.2.2.3N9K-2(config-router)# exit#配置loopback接口,并宣告路由N9K-2(config)# interface loopback 0 N9K-2(config-if)# ip add 2.2.2.3 255.255.255.255N9K-2(config-if)# ip router ospf 1 area 0 N9K-2(config-if)# exit#配置e1/1接口ip,并宣告ospf路由N9K-2(config)# interface ethernet 1/1N9K-2(config-if)# no switchport N9K-2(config-if)# ip add 2.1.1.1 255.255.255.0N9K-2(config-if)# ip router ospf 1 area 0 N9K-2(config-if)# no shutdown N9K-2(config-if)# exit#启用vxlanN9K-2(config)# feature nv overlay #全局启动vxlan桥域N9K-2(config)# feature vn-segment-vlan-based #配置下联host1接口N9K-2(config)# interface ethernet 1/2N9K-2(config-if)# switchport N9K-2(config-if)# switchport mode access N9K-2(config-if)# switchport access vlan 11N9K-2(config-if)# no shutdown N9K-2(config-if)# exit#设置vlan11N9K-2(config)# vlan 11#配置vxlan vnidN9K-2(config-vlan)# vn-segment 10011 N9K-2(config-vlan)# exit#创建Vxlan nve接口#用于传输vxlan隧道N9K-2(config)# interface nve 1 #启动接口N9K-2(config-if-nve)# no shutdown #配置用于去和对端互联的接口,且cisco要求必须是loopback接口。N9K-2(config-if-nve)# source-interface loopback 0 #绑定nve接口和vni,可以绑定多个。N9K-2(config-if-nve)# member vni 10011 #激活static ingress replication for the VNIN9K-2(config-if-nve-vni)# ingress-replication protocol static #配置Vxlan peer,ip最好是对端loopback接口N9K-2(config-if-nve-vni-ingr-rep)# peer-ip 2.2.2.1 N9K-2(config-if-nve-vni-ingr-rep)# exitN9K-2(config-if-nve-vni)# exitN9K-2(config-if-nve)# exit#查看vxlan nve接口状态N9K-2(config)# sh nve vni ingress-replication Interface VNI      Replication List  Source  Up Time      --------- -------- ----------------- ------- -------      nve1      10011    2.2.2.1           CLI     Down 

配置R3

R3(config)#interface loopback 0R3(config-if)#ip add 2.2.2.2 255.255.255.255R3(config-if)#no shutdown R3(config-if)#exitR3(config)#interface ethernet 0/0R3(config-if)#no switchport R3(config-if)#ip add 1.1.1.2 255.255.255.0R3(config-if)#no shutdown R3(config-if)#exitR3(config)#interface ethernet 0/1R3(config-if)#no swiR3(config-if)#ip add 2.1.1.2 255.255.255.0R3(config-if)#no shutdown R3(config-if)#exitR3(config)#router ospf 1 R3(config-router)#router-id 2.2.2.2R3(config-router)#network 2.2.2.2 0.0.0.0 area 0 R3(config-router)#network 1.1.1.0 0.0.0.255 area 0 R3(config-router)#network 2.1.1.0 0.0.0.255 area 0 R3(config-router)#exit

配置两个hosts

VPCS> set pcname host1host1> ip 11.1.1.1/24Checking for duplicate address...PC1 : 11.1.1.1 255.255.255.0
VPCS> set pcname host2host2> ip 11.1.1.2/24Checking for duplicate address...PC1 : 11.1.1.2 255.255.255.0

验证

查看ospf邻居

R3#sh ip ospf neighbor Neighbor ID     Pri   State           Dead Time   Address         Interface2.2.2.3           1   FULL/DR         00:00:38    2.1.1.1         Ethernet0/12.2.2.1           1   FULL/DR         00:00:31    1.1.1.1         Ethernet0/0

查看vxlan nve接口状态:

N9K-1(config)# sh nve vni ingress-replication Interface VNI      Replication List  Source  Up Time      --------- -------- ----------------- ------- -------      nve1      10011    2.2.2.3           CLI     00:11:16 
N9K-2(config)# sh nve vni ingress-replication Interface VNI      Replication List  Source  Up Time      --------- -------- ----------------- ------- -------      nve1      10011    2.2.2.1           CLI     00:11:35

从host1pinghost2:

host1> ping 11.1.1.284 bytes from 11.1.1.2 icmp_seq=1 ttl=64 time=47.067 ms84 bytes from 11.1.1.2 icmp_seq=2 ttl=64 time=31.118 ms84 bytes from 11.1.1.2 icmp_seq=3 ttl=64 time=28.959 ms84 bytes from 11.1.1.2 icmp_seq=4 ttl=64 time=15.407 ms84 bytes from 11.1.1.2 icmp_seq=5 ttl=64 time=23.401 ms

查看Vxlan vni状态

N9K-1# sh nve vni 10011 Codes: CP - Control Plane        DP - Data Plane                 UC - Unconfigured         SA - Suppress ARPInterface VNI      Multicast-group   State Mode Type [BD/VRF]      Flags--------- -------- ----------------- ----- ---- ------------------ -----nve1      10011    UnicastStatic     Up    DP   L2 [11]   

配置基于组播Vxlan

网络拓扑

配置N9K-1

#激活组播pimN9K-1(config)# feature pim#配置处理组播的路由处理器地址,可以省略N9K-1(config)# ip pim rp-address 2.2.2.2 group-list 224.0.0.0/4##route processor (RP)路由处理器#激活ospfN9K-1(config)# feature ospf #启动ospfN9K-1(config)# router ospf 1 N9K-1(config-router)# router-id 2.2.2.1N9K-1(config-router)# exit#配置loopback接口,并宣告路由N9K-1(config)# interface loopback 0 N9K-1(config-if)# ip add 2.2.2.1 255.255.255.255N9K-1(config-if)# ip router ospf 1 area 0 #接口启用pimN9K-1(config-if)# ip pim sparse-mode N9K-1(config-if)# exit#配置e1/1接口ip,并宣告ospf路由N9K-1(config)# interface ethernet 1/1N9K-1(config-if)# no switchport N9K-1(config-if)# ip add 1.1.1.1 255.255.255.0N9K-1(config-if)# ip router ospf 1 area 0 N9K-1(config-if)# ip pim sparse-mode N9K-1(config-if)# no shutdown N9K-1(config-if)# exit#启用vxlanN9K-1(config)# feature nv overlay #全局启动vxlan桥域N9K-1(config)# feature vn-segment-vlan-based #配置下联host1接口N9K-1(config)# interface ethernet 1/2N9K-1(config-if)# switchport N9K-1(config-if)# switchport mode access N9K-1(config-if)# switchport access vlan 11 N9K-1(config-if)# no shutdown N9K-1(config-if)# exit#设置vlan11N9K-1(config)# vlan 11#配置vxlan vnidN9K-1(config-vlan)# vn-segment 10011 N9K-1(config-vlan)# exit#创建Vxlan nve接口#用于传输vxlan隧道N9K-1(config)# interface nve 1 #启动接口N9K-1(config-if-nve)# no shutdown #配置用于去和对端互联的接口,且cisco要求必须是loopback接口。N9K-1(config-if-nve)# source-interface loopback 0 #绑定nve接口和vni,可以绑定多个。N9K-1(config-if-nve)# member vni 10011 #配置NVE组播地址N9K-1(config-if-nve)# mcast-group 230.1.1.1N9K-1(config-if-nve)# exit注意:member vni 10011 mcast-group 230.1.1.1也可以直接写成一条命令member vni 10011 mcast-group 230.1.1.1#查看vxlan nve接口状态N9K-1(config)# sh nve vni Codes: CP - Control Plane        DP - Data Plane                 UC - Unconfigured         SA - Suppress ARPInterface VNI      Multicast-group   State Mode Type [BD/VRF]      Flags--------- -------- ----------------- ----- ---- ------------------ -----nve1      10011    230.1.1.1         Up    DP   L2 [11] 

配置N9K-2

#激活组播pimN9K-2(config)# feature pim#配置处理组播的路由处理器地址,可以省略N9K-2(config)# ip pim rp-address 2.2.2.2 group-list 224.0.0.0/4##route processor (RP)路由处理器#激活ospfN9K-2(config)# feature ospf #启动ospfN9K-2(config)# router ospf 1 N9K-2(config-router)# router-id 2.2.2.3N9K-2(config-router)# exit#配置loopback接口,并宣告路由N9K-2(config)# interface loopback 0 N9K-2(config-if)# ip add 2.2.2.3 255.255.255.255N9K-2(config-if)# ip router ospf 1 area 0 #接口启用pimN9K-2(config-if)# ip pim sparse-mode N9K-2(config-if)# exit#配置e1/1接口ip,并宣告ospf路由N9K-2(config)# interface ethernet 1/1N9K-2(config-if)# no switchport N9K-2(config-if)# ip add 2.1.1.1 255.255.255.0N9K-2(config-if)# ip router ospf 1 area 0 N9K-2(config-if)# ip pim sparse-mode N9K-2(config-if)# no shutdown N9K-2(config-if)# exit#启用vxlanN9K-2(config)# feature nv overlay #全局启动vxlan桥域N9K-2(config)# feature vn-segment-vlan-based #配置下联host1接口N9K-2(config)# interface ethernet 1/2N9K-2(config-if)# switchport N9K-2(config-if)# switchport mode access N9K-2(config-if)# switchport access vlan 11 N9K-2(config-if)# no shutdown N9K-2(config-if)# exit#设置vlan11N9K-2(config)# vlan 11#配置vxlan vnidN9K-2(config-vlan)# vn-segment 10011 N9K-2(config-vlan)# exit#创建Vxlan nve接口#用于传输vxlan隧道N9K-2(config)# interface nve 1 #启动接口N9K-2(config-if-nve)# no shutdown #配置用于去和对端互联的接口,且cisco要求必须是loopback接口。N9K-2(config-if-nve)# source-interface loopback 0 #绑定nve接口和vni,可以绑定多个。N9K-2(config-if-nve)# member vni 10011 #配置VNI组播地址N9K-2(config-if-nve)# mcast-group 230.1.1.1N9K-2(config-if-nve)# exit#查看vxlan nve接口状态N9K-2# sh nve vni Codes: CP - Control Plane        DP - Data Plane                 UC - Unconfigured         SA - Suppress ARPInterface VNI      Multicast-group   State Mode Type [BD/VRF]      Flags--------- -------- ----------------- ----- ---- ------------------ -----nve1      10011    230.1.1.1         Up    DP   L2 [11]  

注意:

这时候看NVE 1接口是已经up了,但是外部中间设备R3并没有配置组播转发,所以vxlan还没有完成。

配置R3

#激活组播R3(config)#ip multicast-routingR3(config)#interface loopback 0R3(config-if)#ip add 2.2.2.2 255.255.255.255R3(config-if)#ip pim sparse-mode R3(config-if)#no shutdown R3(config-if)#exitR3(config)#interface ethernet 0/0R3(config-if)#no switchport R3(config-if)#ip add 1.1.1.2 255.255.255.0R3(config-if)#ip pim sparse-mode R3(config-if)#no shutdown R3(config-if)#exitR3(config)#interface ethernet 0/1R3(config-if)#no swiR3(config-if)#ip add 2.1.1.2 255.255.255.0R3(config-if)#ip pim sparse-mode R3(config-if)#no shutdown R3(config-if)#exitR3(config)#router ospf 1 R3(config-router)#router-id 2.2.2.2R3(config-router)#network 2.2.2.2 0.0.0.0 area 0 R3(config-router)#network 1.1.1.0 0.0.0.255 area 0 R3(config-router)#network 2.1.1.0 0.0.0.255 area 0 R3(config-router)#exit#指定组播rp-address,可以省略ip pim rp-address 2.2.2.2

验证

Host1 ping Host2:

host1> sh ip NAME        : host1[1]IP/MASK     : 11.1.1.1/24GATEWAY     : 0.0.0.0DNS         : MAC         : 00:50:79:66:68:04LPORT       : 20000RHOST:PORT  : 127.0.0.1:30000MTU         : 1500host1> ping 11.1.1.284 bytes from 11.1.1.2 icmp_seq=1 ttl=64 time=16.761 ms84 bytes from 11.1.1.2 icmp_seq=2 ttl=64 time=23.309 ms84 bytes from 11.1.1.2 icmp_seq=3 ttl=64 time=33.010 ms84 bytes from 11.1.1.2 icmp_seq=4 ttl=64 time=27.178 ms84 bytes from 11.1.1.2 icmp_seq=5 ttl=64 time=40.473 ms

查看nve接口状态:

N9K-1# sh nve vni Codes: CP - Control Plane        DP - Data Plane                 UC - Unconfigured         SA - Suppress ARPInterface VNI      Multicast-group   State Mode Type [BD/VRF]      Flags--------- -------- ----------------- ----- ---- ------------------ -----nve1      10011    230.1.1.1         Up    DP   L2 [11]   

查看nve对端设备:

N9K-1# sh nve peers Interface Peer-IP          State LearnType Uptime   Router-Mac       --------- ---------------  ----- --------- -------- -----------------nve1      2.2.2.3          Up    DP        00:10:13 n/a          
N9K-1# sh nve peers detail Details of nve Peers:----------------------------------------Peer-Ip: 2.2.2.3    NVE Interface       : nve1    Peer State          : Up    Peer Uptime         : 00:11:28    Router-Mac          : n/a    Peer First VNI      : 10011    Time since Create   : 00:13:03    Configured VNIs     : 10011    Provision State     : add-complete    Route-Update        : Yes    Peer Flags          : None    Learnt CP VNIs      : --    Peer-ifindex-resp   : Yes----------------------------------------

网络加入一个H3C设备,如何配置

这里主要说明H3C是如何开启组播,并转发的。

H3C设备配置如下:

#全局启用组播:multicast routing ospf 1 router-id 2.2.2.4 area 0.0.0.0  network 2.1.1.0 0.0.0.255  network 2.2.2.4 0.0.0.0  network 3.1.1.0 0.0.0.255interface LoopBack0 ip address 2.2.2.4 255.255.255.0 pim sminterface GigabitEthernet1/0 port link-mode route ip address 2.1.1.2 255.255.255.0 pim sminterface GigabitEthernet2/0 port link-mode route ip address 3.1.1.2 255.255.255.0 pim sm

R1也就是图中的3725配置有更改的地方:

interface FastEthernet1/1 no switchport ip address 3.1.1.1 255.255.255.0 ip pim sparse-mode router ospf 1 router-id 2.2.2.2 log-adjacency-changes network 1.1.1.0 0.0.0.255 area 0 network 2.2.2.2 0.0.0.0 area 0 network 3.1.1.0 0.0.0.255 area 0

验证VXLAN 其他方式配置

To display the VXLAN configuration information, enter one of the following commands:

CommandPurpose
show tech-support vxlan [platform ]Displays related VXLAN tech-support information.
show logging level nveDisplays logging level.
show tech-support nveDisplays related NVE tech-support information.
show run interface nve xDisplays NVE overlay interface configuration.
show nve interfaceDisplays NVE overlay interface status.
show nve peersDisplays NVE peer status.
show nve peers peer_IP_address interfaceinterface_ID countersDisplays per NVE peer statistics.
clear nve peers peer_IP_address interfaceinterface_ID countersClears per NVE peer statistics.
clear nve peer-ip peer-ip-addressClears stale NVE peers. Stale NVE peers are peers that do not have MAC addresses learnt behind them.
show nve vniDisplays VXLAN VNI status.
show nve vni ingress-replicationDisplays the mapping of VNI to ingress-replication peer list and uptime for each peer.
show nve vni vni_number countersDisplays per VNI statistics.
clear nve vni vni_number countersClears per VNI statistics.
show nve vxlan-paramsDisplays VXLAN parameters, such as VXLAN destination or UDP port.
CommandPurpose
show tech-support vxlan [platform ]Displays related VXLAN tech-support information.
show interface {ethernet slot/port / port-channel port} vlan mappingDisplays VLAN mapping information for a specific interface or port channel.
show logging level nveDisplays logging level.
show tech-support nveDisplays related NVE tech-support information.
show run interface nve xDisplays NVE overlay interface configuration.
show nve interfaceDisplays NVE overlay interface status.
show nve peersDisplays NVE peer status.
show nve peers peer_IP_address interfaceinterface_ID countersDisplays per NVE peer statistics.
clear nve peers peer_IP_address interfaceinterface_ID countersClears per NVE peer statistics.
clear nve peer-ip peer-ip-addressClears stale NVE peers. Stale NVE peers are peers that do not have MAC addresses learnt behind them.
show nve vniDisplays VXLAN VNI status.
show nve vni ingress-replicationDisplays the mapping of VNI to ingress-replication peer list and uptime for each peer.
show nve vni vni_number countersDisplays per VNI statistics.
clear nve vni vni_number countersClears per VNI statistics.
show nve vxlan-paramsDisplays VXLAN parameters, such as VXLAN destination or UDP port.
show mac address-table static interface nve 1Displays static MAC information.
show vxlan interfaceDisplays VXLAN interface status for 9200 platform switches. .
show vxlan interface / countDisplays VXLAN VLAN logical port VP count.
CommandPurpose
show run trackDisplays tracking information for running-config.
show trackDisplays tracking information for IP prefix for an endpoint.
.

广告 广告

评论区