采用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
3、配置S6800B交換機
步驟一:配置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
4、配置完成后的結果檢驗
步驟一:配置完成后,在兩臺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 ---