配置BGP方式VPWS本地连接示例
两个CE设备连接在同一个PE设备上,可以通过建立BGP方式VPWS本地连接,实现CE设备之间的互通。
操作步骤
- 配置CE
# 配置CE1。
<HUAWEI> system-view
[~HUAWEI] sysname CE1
[*HUAWEI] commit
[~CE1] interface gigabitethernet 1/0/0
[*CE1-GigabitEthernet1/0/0] ip address 10.1.1.1 24
[*CE1-GigabitEthernet1/0/0] quit
[*CE1] commit
# 配置CE2。
<HUAWEI> system-view
[~HUAWEI] sysname CE2
[*HUAWEI] commit
[~CE2] interface gigabitethernet 1/0/0
[*CE2-GigabitEthernet1/0/0] ip address 10.1.1.2 24
[*CE2-GigabitEthernet1/0/0] quit
[*CE2] commit
- 在PE上使能MPLS基本功能
<HUAWEI> system-view
[~HUAWEI] sysname PE
[*HUAWEI] commit
[~PE] interface loopback 1
[*PE-LoopBack1] ip address 1.1.1.9 32
[*PE-LoopBack1] quit
[*PE] mpls lsr-id 1.1.1.9
[*PE] mpls
[*PE-mpls] quit
[*PE] commit
- 在配置BGP方式VPWS本地连接
[~PE] mpls l2vpn
[*PE-l2vpn] quit
[*PE] mpls l2vpn vpn1 encapsulation ethernet
[*PE-mpls-l2vpn-vpn1] route-distinguisher 100:1
[*PE-mpls-l2vpn-vpn1] ce ce1 id 1 range 10
[*PE-mpls-l2vpn-vpn1-ce-ce1] connection ce-offset 2 interface gigabitethernet 1/0/0
[*PE-mpls-l2vpn-vpn1-ce-ce1] quit
[*PE-mpls-l2vpn-vpn1] ce ce2 id 2 range 10
[*PE-mpls-l2vpn-vpn1-ce-ce2] connection ce-offset 1 interface gigabitethernet 2/0/0
[*PE-mpls-l2vpn-vpn1-ce-ce2] quit
[*PE-mpls-l2vpn-vpn1] quit
[*PE] commit
- 验证配置结果
完成上述配置后,在PE上执行display mpls l2vpn connection命令,可以看到建立了两条VPWS本地连接,且状态为Up。
[~PE] display mpls l2vpn connection
2 total connections, connections: 2 up, 0 down, 2 local, 0 remote, 0 unknown VPN name: vpn1, 2 total connections, connections: 2 up, 0 down , 2 local, 0 remote, 0 unknown CE name: ce1, id: 1, Rid type status peer-id route-distinguisher interface primary or not ---------------------------------------------------------------------------- 2 loc up --- --- GigabitEthernet1/0/0 primary CE name: ce2, id: 2, Rid type status peer-id route-distinguisher interface primary or not ---------------------------------------------------------------------------- 1 loc up --- --- GigabitEthernet2/0/0 primary
CE1与CE2能够Ping通。
[~CE1] ping 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=7 ms Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=3 ms Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=4 ms Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=2 ms Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=3 ms --- 10.1.1.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 2/3/7 ms
配置文件
CE1的配置文件
# sysname CE1 # interface GigabitEthernet1/0/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # return
CE2的配置文件
# sysname CE2 # interface GigabitEthernet1/0/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # return
PE的配置文件
# sysname PE1 # mpls lsr-id 1.1.1.9 # mpls # mpls l2vpn # interface LoopBack1 ip address 1.1.1.9 255.255.255.255 # mpls l2vpn vpn1 encapsulation ethernet route-distinguisher 100:1 ce ce1 id 1 range 10 default-offset 0 connection ce-offset 2 interface GigabitEthernet1/0/0 ce ce2 id 2 range 10 default-offset 0 connection ce-offset 1 interface GigabitEthernet2/0/0 # return