问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

VxLAN静态隧道配置实验详解

创作时间:
作者:
@小白创作中心

VxLAN静态隧道配置实验详解

引用
CSDN
1.
https://blog.csdn.net/zhu_xian_gang/article/details/142768808

VxLAN(Virtual Extensible LAN)是一种Overlay网络技术,通过在现有的Underlay网络上叠加一层虚拟网络,实现二层网络的扩展和隔离。VxLAN使用24位的VNI(VxLAN Network Identifier)来标识不同的虚拟网络,支持多达1600万个VLAN,极大地扩展了传统VLAN的限制。本文将通过一个具体的实验案例,详细介绍VxLAN静态隧道的配置过程。

实验背景

PC1和PC2在物理网络中处于两个不同的三层子网。LSW1、LSW2和LSW3不支持VxLAN,而CE1和CE2支持VxLAN。实验需求如下:

  1. PC1和PC2从Underlay网络看,处于不同的广播域
  2. 通过配置VxLAN静态隧道,实现PC1和PC2在Overlay网络上在同一广播域,可以互相通信
  3. PC1和PC2在VLAN 10,BD10,分配VNI100

注意:使用CE时,需要开启硬件虚拟化

一、基础网络配置

1.1 基础 VLAN 配置

先配置LSW2:VLAN 10

int g0/0/2
port link-type access
port default vlan 10
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10

再配置LSW3:VLAN 10

int g0/0/2
port link-type access
port default vlan 10
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10

1.2 基础 IP 地址配置

配置PC1 IP地址和掩码:192.168.100.1 255.255.255.0
配置PC2 IP地址和掩码:192.168.100.2 255.255.255.0

在CE1中配置接口IP:

int g1/0/1
undo portswitch(切换成路由模式,华为默认支持在接口配置IP)
ip add 10.0.12.1 24
commit
undo shutdown
commit
int loop 0
ip add 1.1.1.1 32
commit

在LSW1中配置:

vlan batch 100 200
int g0/0/23
port link-type access
port default vlan 100
int g0/0/24
port link-type access
port default vlan 200
int vlan 100
ip add 10.0.12.2 24
int vlan 200
ip add 10.0.23.2 24

此时可以在此设备ping 10.0.12.1 去测试(正常能通)

dis ip int b

同理配置CE2中配置接口IP:

int g1/0/1
undo portswitch
ip add 10.0.23.3 24
commit
undo shutdown
commit
ping 10.0.23.2
int loop 0
ip add 2.2.2.2 32
commit

1.3 Underlay 路由配置

CE1:

ospf
area 0
net 0.0.0.0 0.0.0.0
commit
dis ospf peer b
dis ip routing-table 2.2.2.2
ping -a 1.1.1.1 2.2.2.2

CE2:

ospf 1
area 0
net 0.0.0.0 0.0.0.0
commit

LSW1:

CE1:
ospf 1
area 0
net 0.0.0.0 0.0.0.0
commit

二、VxLAN 接入配置

2.1 创建 BD

CE1:

bridge-domain 10

2.2 创建子接口

CE1:

interface gigabitethernet 1/0/2
port link-type trunk
interface gigabitethernet 1/0/2.1 mode L2
encapsulation dot1q vid 10
Dridge-qomainl 10
commit

同理CE2:

bridge-domain 10
interface gigabitethernet 1/0/2
port link-type trunk
interface gigabitethernet 1/0/2.1 mode L2
encapsulation dot1q vid 10
Dridge-qomainl 10
commit

三、VxLAN隧道配置

CE1:

bridge-domain 10
vxlan vni 100
interface nve 1
source 1.1.1.1
vni 100 head-end peer-list 2.2.2.2
commit

含义:属于BD 10的报文,将打上VNI 100的VxLAN标识,并且封装上源地址为1.1.1.1、目标地址为2.2.2.2的新IP头部,发到对端NVE。

CE1:

dis vxlan tunnel
int g1/0/2
undo shutdown
commit

CE2:

bridge-domain 10
vxlan vni 100
interface nve 1
source 2.2.2.2
vni 100 head-end peer-list 1.1.1.1
commit

CE2:

int g1/0/2
undo shutdown
commit

四、测试

PC1:

ping 192.168.100.2

在CE的g1/0/1口抓包:

  • VXLAN的封装
  • UDP封装端口4789以及隧道的头部四个1和四个2
  • 这个MAC是CE1到LSW1的

参考文献

hcie04:datacom-VxLAN静态隧道实验演示_哔哩哔哩_bilibili

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号