采用VXLAN实现不同站点主机跨三层网络实现二层互通:
PCA和PCB分别模拟两个不同站点的主机;
- PCA和PCB处在不同VLAN,但处于同一个VXLAN;
- 通过配置VXLAN实现PCA和PCB之间跨三层的二层互通;
1、配置两台PC 的IP地址
分别配置PCA和PCB IP地址为 10.1.1.1 与 10.1.1.2
2、配置S6800A交换机步骤一:配置VLAN 10、12, PCA连接端口属于VLAN10,两台S6800互联口属于vlan 12
<H3C> system-view
[H3C] VLAN 10
[H3C-vlan10]quit
[H3C] vlan 12
[H3C-vlan12]quit
[H3C] interface Ten-GigabitEthernet1/0/10
[H3C-Ten-GigabitEthernet1/0/10] port access vlan 10
[H3C] interface Ten-GigabitEthernet1/0/1
[H3C-Ten-GigabitEthernet1/0/1] port access vlan 12
步骤二:创建loopback 1接口
[H3C]interface LoopBack 1
[H3C-LoopBack1]ip address 1.1.1.1 32
步骤三:创建vlan12虚接口
[H3C]interface Vlan-interface 12
[H3C-Vlan-interface12]ip address 12.1.1.1 30
步骤四:配置OSPF,使得两台设备之间IP可达
[H3C]interface Vlan-interface 12
[H3C-Vlan-interface12]ip address 12.1.1.1 30
[H3C]ospf 1
[H3C-ospf-1]area 0
[H3C-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.3
[H3C-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
步骤五:开启L2VPN功能
[H3C] l2vpn enable
步骤六:创建VSI,并进入VSI视图(这里1即创建的VSI名称)
[H3C]vsi 1
[H3C-vsi-1]
步骤七:创建VXLAN 100
[H3C-vsi-1]vxlan 100
[H3C-vsi-1-vxlan-100]quit
步骤八:创建模式为VXLAN隧道的tunnel接口,并配置隧道源与目的
[H3C]interface Tunnel 1 mode vxlan
[H3C-Tunnel1]source LoopBack 1
[H3C-Tunnel1]destination 2.2.2.2
步骤九:手工关联VXLAN与VXLAN隧道
[H3C]vsi 1
[H3C-vsi-1]vxlan 100
[H3C-vsi-1-vxlan-100]tunnel 1
步骤十:创建以太网服务实例及配置封装模式,并使其与VSI关联
[H3C]interface Ten-GigabitEthernet 1/0/10
[H3C-Ten-GigabitEthernet1/0/10]service-instance 1
[H3C-Ten-GigabitEthernet1/0/10-srv1]encapsulation s-vid 10
[H3C-Ten-GigabitEthernet1/0/10-srv1]xconnect vsi 1
步骤一:配置VLAN 20,12 ,PCB连接端口属于VLAN20,两台S6800互联口属于vlan 12
<H3C> system-view
[H3C] vlan 20
[H3C-vlan20]quit
[H3C] vlan 12
[H3C-vlan12]quit
[H3C] interface Ten-GigabitEthernet1/0/20
[H3C-Ten-GigabitEthernet1/0/20] port access vlan 20
[H3C] interface Ten-GigabitEthernet1/0/1
[H3C-Ten-GigabitEthernet1/0/1] port access vlan 12
步骤二:创建loopback1 接口
[H3C]interface LoopBack 1
[H3C-LoopBack1]ip address 2.2.2.2 32
步骤三:创建vlan12虚接口
[H3C]interface Vlan-interface 12
[H3C-Vlan-interface12]ip address 12.1.1.2 30
步骤四:配置OSPF,使得两台设备之间IP可达
[H3C]ospf 1
[H3C-ospf-1]area 0
[H3C-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.3
[H3C-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
步骤五:开启L2VPN功能
[H3C] l2vpn enable
步骤六:创建VSI,并进入VSI视图(这里1即创建的VSI名称)
[H3C]vsi 1
[H3C-vsi-1]
步骤七:创建VXLAN 100
[H3C-vsi-1]vxlan 100
[H3C-vsi-1-vxlan-100]quit
步骤八:创建模式为VXLAN隧道的tunnel接口,并配置隧道源与目的
[H3C]interface Tunnel 1 mode vxlan
[H3C-Tunnel1]source LoopBack 1
[H3C-Tunnel1]destination 1.1.1.1
步骤九:手工关联VXLAN与VXLAN隧道
[H3C]vsi 1
[H3C-vsi-1]vxlan 100
[H3C-vsi-1-vxlan-100]tunnel 1
步骤十:创建以太网服务实例及配置封装模式,并使其与VSI关联
[H3C]interface Ten-GigabitEthernet 1/0/20
[H3C-Ten-GigabitEthernet1/0/20]service-instance 1
[H3C-Ten-GigabitEthernet1/0/20-srv1]encapsulation s-vid 20
[H3C-Ten-GigabitEthernet1/0/20-srv1]xconnect vsi 1
步骤一:配置完成后,在两台PC进行Ping操作,此时两台PC可以ping通
步骤二:配置完成后,执行display l2vpn mac-address 查看MAC地址学习情况
[H3C]display l2vpn mac-address
MAC Address State VSI Name Link ID/Name Aging
4437-e6ab-9cea Dynamic 1 Tunnel1 Aging
c434-6b25-4b67 Dynamic 1 XGE1/0/20 Aging
--- 2 mac address(es) found ---