素材来源:华为路由器配置指南
一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全
目标
从典型的应用场景描述了Dot1q终结子接口接入L2VPN(Layer 2 virtual private network)后,如何保证发送带有一层VLAN Tag报文的终端用户通过L2VPN网络通信。
组网模型
如果通过终结子接口接入L2VPN网络,为了保证用户之间互通,需要配置终结子接口绑定VSI(Virtual Switching Instance)/VPWS(Virtual Private Wire Service)接入L2VPN网络。
如图1所示,CE通过路由器接入PE,路由器发送到PE的用户报文带有一层VLAN Tag,并通过Dot1q终结子接口接入L2VPN用户网络。为了保证CE1~CE6的用户网络可以互通,需要在PE1、PE2、PE3上部署Dot1q终结子接口绑定VSI/VPWS接入L2VPN网络。
配置思路
操作步骤
配置CE1
interface Ethernet0/0/0
ip address 10.1.1.1 255.255.255.0
配置CE2
interface Ethernet0/0/0
ip address 10.1.1.2 255.255.255.0
配置CE3
interface Ethernet0/0/0
ip address 10.1.1.3 255.255.255.0
配置CE4
interface Ethernet0/0/0
ip address 10.1.1.4 255.255.255.0
配置CE5
interface Ethernet0/0/0
ip address 10.1.1.5 255.255.255.0
配置CE6
interface Ethernet0/0/0
ip address 10.1.1.6 255.255.255.0
配置DeviceA
vlan batch 10 20
interface Ethernet0/0/0
portswitch
port link-type access
port default vlan 10
interface GigabitEthernet0/0/0
portswitch
port link-type access
port default vlan 20
配置DeviceB
vlan batch 10 20
interface Ethernet0/0/0
portswitch
port link-type access
port default vlan 10
interface GigabitEthernet0/0/0
portswitch
port link-type access
port default vlan 20
配置DeviceC
vlan batch 10 20
interface Ethernet0/0/0
portswitch
port link-type access
port default vlan 10
interface Ethernet0/0/1
portswitch
port link-type access
port default vlan 20
配置DeviceA
interface Ethernet0/0/1
portswitch
port link-type trunk
port trunk allow-pass vlan 10 20
配置DeviceB
interface Ethernet0/0/1
portswitch
port link-type trunk
port trunk allow-pass vlan 10 20
配置DeviceC
interface GigabitEthernet0/0/0
portswitch
port link-type trunk
port trunk allow-pass vlan 10 20
分别在PE上配置OSPF协议
配置PE的各接口地址。配置OSPF时,注意需要发布PE的32位Loopback接口地址。
配置PE1。
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
interface Ethernet1/0/0
ip address 192.168.1.1 255.255.255.0
interface Ethernet1/0/1
ip address 192.168.3.1 255.255.255.0
ospf 1
area 0.0.0.0
network 1.1.1.9 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
配置PE2。
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
interface Ethernet1/0/1
ip address 192.168.2.2 255.255.255.0
interface Ethernet1/0/0
ip address 192.168.3.2 255.255.255.0
ospf 1
area 0.0.0.0
network 2.2.2.9 0.0.0.0
network 192.168.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
配置PE3。
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
interface Ethernet1/0/0
ip address 192.168.1.2 255.255.255.0
interface Ethernet1/0/1
ip address 192.168.2.1 255.255.255.0
ospf 1
area 0.0.0.0
network 3.3.3.9 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
完成上述步骤后,PE1和PE2、PE1和PE3之间通过OSPF协议发现的对方Loopback1的IP路由,并能互相Ping通。
以PE1的显示为例。
[~PE1-ospf-1]dis ip routing-table
Route Flags: R - relay, D - download to fib, T - to -instance, B - black hole
route
------------------------------------------------------------------------------
Routing Table : _public_
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.9/32 Direct 0 0 D 127.0.0.1 LoopBack1
2.2.2.9/32 OSPF 10 1 D 192.168.3.2 Ethernet1/0/1
3.3.3.9/32 OSPF 10 1 D 192.168.1.2 Ethernet1/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Ethernet1/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
192.168.2.0/24 OSPF 10 2 D 192.168.3.2 Ethernet1/0/1
192.168.3.0/24 Direct 0 0 D 192.168.3.1 Ethernet1/0/1
192.168.3.1/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
192.168.3.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[~PE1-ospf-1]
[~PE1-ospf-1]ping 192.168.2.2
PING 192.168.2.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.2: bytes=56 Sequence=1 ttl=255 time=4 ms
Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=255 time=4 ms
Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=255 time=4 ms
Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=255 time=4 ms
Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=255 time=5 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 4/4/5 ms
[~PE1-ospf-1]
使能MPLS基本能力和LDP
配置PE1。
mpls lsr-id 1.1.1.9
mpls
mpls ldp
interface Ethernet1/0/0
mpls
mpls ldp
interface Ethernet1/0/1
mpls
mpls ldp
配置PE2。
mpls lsr-id 2.2.2.9
mpls
mpls ldp
interface Ethernet1/0/0
mpls
mpls ldp
interface Ethernet1/0/1
mpls
mpls ldp
配置PE3。
mpls lsr-id 3.3.3.9
mpls
mpls ldp
interface Ethernet1/0/0
mpls
mpls ldp
interface Ethernet1/0/1
mpls
mpls ldp
上述配置完成后,PE1与PE2、PE1与PE3之间建立LDP会话,执行命令display mpls ldp session可以看到显示结果中Status项为“Operational”。
以PE1的显示为例。
[~PE1-Ethernet1/0/1]dis mpls ldp session
LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
An asterisk (*) before a session means the session is being deleted.
--------------------------------------------------------------------------
PeerID Status LAM SsnRole SsnAge KASent/Rcv
--------------------------------------------------------------------------
2.2.2.9:0 Operational DU Passive 0002:00:01 11527/11527
3.3.3.9:0 Operational DU Passive 0000:00:01 8/8
--------------------------------------------------------------------------
TOTAL: 2 Session(s) Found.
[~PE1-Ethernet1/0/1]
使能MPLS L2VPN
配置PE1。
mpls l2
配置PE2。
mpls l2
配置PE3。
mpls l2
配置VSI和Dot1q终结子接口,并将VSI与Dot1q终结子接口绑定。
配置PE1。
vsi ldp1 static
pwsignal ldp
vsi-id 2
peer 2.2.2.9
peer 3.3.3.9
interface Ethernet1/0/2.1
encapsulation dot1q-termination
dot1q termination vid 10
dot1q termination vid 20
l2 binding vsi ldp1
配置PE2。
vsi ldp1 static
pwsignal ldp
vsi-id 2
peer 1.1.1.9
peer 3.3.3.9
interface Ethernet1/0/2.1
encapsulation dot1q-termination
dot1q termination vid 10
dot1q termination vid 20
l2 binding vsi ldp1
配置PE3。
vsi ldp1 static
pwsignal ldp
vsi-id 2
peer 1.1.1.9
peer 2.2.2.9
interface Ethernet1/0/2.1
encapsulation dot1q-termination
dot1q termination vid 10
dot1q termination vid 20
l2 binding vsi ldp1
完成上述配置后,在PE1上执行命令display vsi name ldp1 verbose,可以看到名字为ldp1的VSI建立了到PE2、PE3的PW,VSI状态为Up。
[~PE1]dis vsi name ldp1 verbose
***VSI Name : ldp1
Work Mode : normal
Administrator VSI : no
Isolate Spoken : disable
VSI Index : 1
PW Signaling : ldp
Member Discovery Style : static
Bridge-domain Mode : disable
PW MAC Learn Style : unqualify
Encapsulation Type : vlan
MTU : 1500
Diffserv Mode : uniform
Service Class : --
Color : --
DomainId : 255
Domain Name :
Ignore AcState : disable
P2P VSI : disable
Multicast Fast Switch : disable
Create Time : 0 days, 0 hours, 21 minutes, 49 seconds
VSI State : up
Resource Status : --
VSI ID : 2
*Peer Router ID : 2.2.2.9
Negotiation-vc-id : 2
Encapsulation Type : vlan
primary or secondary : primary
ignore-standby-state : no
VC Label : 48122
Peer Type : dynamic
Session : up
Tunnel ID : 0x0000000001004c4b42
Broadcast Tunnel ID : --
Broad BackupTunnel ID : --
CKey : 1
NKey : 16777376
Stp Enable : 0
PwIndex : 1
Control Word : disable
BFD for PW : unavailable
*Peer Router ID : 3.3.3.9
Negotiation-vc-id : 2
Encapsulation Type : vlan
primary or secondary : primary
ignore-standby-state : no
VC Label : 48123
Peer Type : dynamic
Session : up
Tunnel ID : 0x0000000001004c4b43
Broadcast Tunnel ID : --
Broad BackupTunnel ID : --
CKey : 2
NKey : 16777377
Stp Enable : 0
PwIndex : 2
Control Word : disable
BFD for PW : unavailable
Interface Name : Ethernet1/0/2.1
State : up
Ac Block State : unblocked
Access Port : false
Last Up Time : 2021/01/26 16:48:42
Total Up Time : 0 days, 0 hours, 21 minutes, 49 seconds
**PW Information:
*Peer Ip Address : 2.2.2.9
PW State : up
Local VC Label : 48122
Remote VC Label : 48122
Remote Control Word : disable
PW Type : label
Local VCCV : alert lsp-ping bfd
Remote VCCV : alert lsp-ping bfd
Tunnel ID : 0x0000000001004c4b42
Broadcast Tunnel ID : --
Broad BackupTunnel ID : --
Ckey : 1
Nkey : 16777376
Main PW Token : 0x0
Slave PW Token : 0x0
Tnl Type : ldp
OutInterface : --
Backup OutInterface : --
Stp Enable : 0
Mac Flapping : 0
Monitor Group Name : --
PW Last Up Time : 2021/01/26 16:51:08
PW Total Up Time : 0 days, 0 hours, 19 minutes, 23 seconds
*Peer Ip Address : 3.3.3.9
PW State : up
Local VC Label : 48123
Remote VC Label : 48122
Remote Control Word : disable
PW Type : label
Local VCCV : alert lsp-ping bfd
Remote VCCV : alert lsp-ping bfd
Tunnel ID : 0x0000000001004c4b43
Broadcast Tunnel ID : --
Broad BackupTunnel ID : --
Ckey : 2
Nkey : 16777377
Main PW Token : 0x0
Slave PW Token : 0x0
Tnl Type : ldp
OutInterface : --
Backup OutInterface : --
Stp Enable : 0
Mac Flapping : 0
Monitor Group Name : --
PW Last Up Time : 2021/01/26 16:52:50
PW Total Up Time : 0 days, 0 hours, 17 minutes, 41 seconds
[~PE1]
[~PE1]
上述配置完成后,执行命令display dot1q information termination interface,可以查看到Dot1q终结子接口配置信息,及Dot1q终结子接口绑定了VSI。
以PE1的显示为例。
[~PE1]dis dot1q information termination interface ethe 1/0/2
Ethernet1/0/2.1
VSI bound
Total QinQ Num: 2
dot1q termination vid 10
dot1q termination vid 20
Total vlan-group Num: 0
encapsulation dot1q-termination
[~PE1]
CE、CE2和CE3的主机能够相互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=110 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=60 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=80 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=110 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=80 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/88/110 ms
[CE1]