配置静动混合多跳PW示例
组网需求
如图5-23所示,运营商MPLS网络为用户提供L2VPN服务,其中SPE设备的功能较强,UPE1和UPE2(UPE2仅支持静态配置PW)作为用户接入设备且他们间无法直接建立LDP远端会话,接入的用户数量较多且经常变化。现要求一种适当的VPN方案,为用户提供安全的VPN服务,在接入新用户时配置简单,且维护简便。
缺省情况下,设备上全局使能链路类型自协商功能,若L2VPN使用Vlanif接口作为AC接口,则与该功能相冲突,需要先在系统视图下执行lnp disable命令去使能链路类型自协商功能。
使用lnp disable命令之后,设备重启前对业务没有影响,设备重启后只有命令port default vlan指定的VLAN二层转发可通,其他VLAN二层转发不通。缺省情况下,接口的配置是port default vlan 1,即只有VLAN 1二层转发可通。
配置思路
由于MPLS网络中SPE设备的功能较强,且UPE1和UPE2间无法直接建立LDP远端会话,可采用PW多跳实现用户需求,在SPE处进行PW交换。由于UPE2设备的限制,此例采用配置动静态混合多跳PW。
采用如下的思路配置静动混合多跳PW的基本功能:
在骨干网上运行IGP协议,使骨干网各设备能互通。
在骨干网上配置MPLS基本能力,建立LSP隧道。
UPE1与SPE之间建立远端LDP会话。
在UPE上创建静态或动态MPLS L2VC连接。
由于是多跳,需要在交换节点SPE上创建交换PW。
操作步骤
- 按图5-23配置各接口所属VLAN和VLANIF接口的IP地址
# 配置CE1。UPE1、P1、SPE、P2、UPE2和CE2的配置与CE1类似,不再赘述。
<HUAWEI> system-view [HUAWEI] sysname CE1 [CE1] vlan batch 10 [CE1] interface vlanif 10 [CE1-Vlanif10] ip address 192.168.1.1 255.255.255.0 [CE1-Vlanif10] quit [CE1] interface gigabitethernet 1/0/0 [CE1-GigabitEthernet1/0/0] port link-type trunk [CE1-GigabitEthernet1/0/0] port trunk allow-pass vlan 10 [CE1-GigabitEthernet1/0/0] quit
- 配置MPLS骨干网的IGP
在MPLS骨干网上配置IGP,本示例中使用OSPF。
配置OSPF时,注意需要发布UPE1、SPE和UPE2的32位Loopback接口地址。
# 配置UPE1。P1、SPE、P2和UPE2的配置与UPE1类似,不再赘述。
[UPE1] interface loopback 0 [UPE1-LoopBack0] ip address 1.1.1.9 255.255.255.255 [UPE1-LoopBack0] quit [UPE1] ospf 1 [UPE1-ospf-1] area 0 [UPE1-ospf-1-area-0.0.0.0] network 50.1.1.0 0.0.0.255 [UPE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0 [UPE1-ospf-1-area-0.0.0.0] quit [UPE1-ospf-1] quit
- 使能MPLS,建立隧道,并在UPE1和SPE之间建立远端LDP会话
在MPLS骨干网上配置MPLS基本能力和隧道(本例使用LSP隧道)。
注意UPE1与SPE之间需要建立远端LDP会话。
# 配置UPE1。
[UPE1] mpls lsr-id 1.1.1.9 [UPE1] mpls [UPE1-mpls] quit [UPE1] mpls ldp [UPE1-mpls-ldp] quit [UPE1] interface vlanif 20 [UPE1-Vlanif20] mpls [UPE1-Vlanif20] mpls ldp [UPE1-Vlanif20] quit [UPE1] mpls ldp remote-peer 3.3.3.9 [UPE1-mpls-ldp-remote-3.3.3.9] remote-ip 3.3.3.9 [UPE1-mpls-ldp-remote-3.3.3.9] quit
# 配置P1。
[P1] mpls lsr-id 2.2.2.9 [P1] mpls [P1-mpls] quit [P1] mpls ldp [P1-mpls-ldp] quit [P1] interface vlanif 20 [P1-Vlanif20] mpls [P1-Vlanif20] mpls ldp [P1-Vlanif20] quit [P1] interface vlanif 30 [P1-Vlanif30] mpls [P1-Vlanif30] mpls ldp [P1-Vlanif30] quit
# 配置SPE。
[SPE] mpls lsr-id 3.3.3.9 [SPE] mpls [SPE-mpls] quit [SPE] mpls ldp [SPE-mpls-ldp] quit [SPE] interface vlanif 30 [SPE-Vlanif30] mpls [SPE-Vlanif30] mpls ldp [SPE-Vlanif30] quit [SPE] interface vlanif 40 [SPE-Vlanif40] mpls [SPE-Vlanif40] mpls ldp [SPE-Vlanif40] quit [SPE] mpls ldp remote-peer 1.1.1.9 [SPE-mpls-ldp-remote-1.1.1.9] remote-ip 1.1.1.9 [SPE-mpls-ldp-remote-1.1.1.9] quit [SPE] mpls ldp remote-peer 5.5.5.9 [SPE-mpls-ldp-remote-5.5.5.9] remote-ip 5.5.5.9 [SPE-mpls-ldp-remote-5.5.5.9] quit
# 配置P2。
[P2] mpls lsr-id 4.4.4.9 [P2] mpls [P2-mpls] quit [P2] mpls ldp [P2-mpls-ldp] quit [P2] interface vlanif 40 [P2-Vlanif40] mpls [P2-Vlanif40] mpls ldp [P2-Vlanif40] quit [P2] interface vlanif 50 [P2-Vlanif50] mpls [P2-Vlanif50] mpls ldp [P2-Vlanif50] quit
# 配置UPE2。
[UPE2] mpls lsr-id 5.5.5.9 [UPE2] mpls [UPE2-mpls] quit [UPE2] mpls ldp [UPE2-mpls-ldp] quit [UPE2] interface vlanif 50 [UPE2-Vlanif50] mpls [UPE2-Vlanif50] mpls ldp [UPE2-Vlanif50] quit [UPE2] mpls ldp remote-peer 3.3.3.9 [UPE2-mpls-ldp-remote-3.3.3.9] remote-ip 3.3.3.9 [UPE2-mpls-ldp-remote-3.3.3.9] quit
- 创建VC连接
在UPE1、UPE2和SPE上使能MPLS L2VPN。
在UPE1上配置动态VC连接,在UPE2配置静态连接,在SPE上配置静动混合交换PW。
# 配置UPE1。由于本举例使用Vlanif接口作为AC接口,执行以下步骤前必须在系统视图下执行lnp disable命令。如果现网环境不能去使能链路类型自协商功能,请使用非Vlanif接口作为AC接口。
[UPE1] mpls l2vpn [UPE1-l2vpn] quit [UPE1] interface vlanif 10 [UPE1-Vlanif10] mpls l2vc 3.3.3.9 100 [UPE1-Vlanif10] quit
当配置静态PW和动态交换PW时,注意命令中的关键字between前后两个ip-address vc-id的区别:前面是动态PW的,后面是静态PW的,两者不可互换。
# 配置SPE。
[SPE] mpls l2vpn [SPE-l2vpn] quit [SPE] mpls switch-l2vc 1.1.1.9 100 between 5.5.5.9 200 trans 200 recv 100 encapsulation vlan
# 配置UPE2。由于本举例使用Vlanif接口作为AC接口,执行以下步骤前必须在系统视图下执行lnp disable命令。如果现网环境不能去使能链路类型自协商功能,请使用非Vlanif接口作为AC接口。
[UPE2] mpls l2vpn [UPE2-l2vpn] quit [UPE2] pw-template pwt [UPE2-pw-template-pwt] peer-address 3.3.3.9 [UPE2-pw-template-pwt] quit [UPE2] interface vlanif 60 [UPE2-Vlanif60] mpls static-l2vc pw-template pwt 200 transmit-vpn-label 100 receive-vpn-label 200 [UPE2-Vlanif60] quit
- 验证配置结果
# 在网络稳定后,在PE上查看L2VPN连接信息,可以看到建立了一条L2 VC,VC State为UP。
以UPE1和SPE的显示为例:
[UPE1] display mpls l2vc interface vlanif 10 *client interface : Vlanif10 is up Administrator PW : no session state : up AC status : up VC state : up Label state : 0 Token state : 0 VC ID : 100 VC type : VLAN destination : 3.3.3.9 local group ID : 0 remote group ID : 0 local VC label : 23552 remote VC label : 23552 local AC OAM State : up local PSN OAM State : up local forwarding state : forwarding local status code : 0x0 remote AC OAM state : up remote PSN OAM state : up remote forwarding state: forwarding remote status code : 0x0 ignore standby state : no BFD for PW : unavailable VCCV State : up manual fault : not set active state : active forwarding entry : exist link state : up local VC MTU : 1500 remote VC MTU : 1500 local VCCV : alert lsp-ping bfd remote VCCV : alert lsp-ping bfd local control word : disable remote control word : disable tunnel policy name : -- PW template name : -- primary or secondary : primary load balance type : flow Access-port : false Switchover Flag : false VC tunnel/token info : 1 tunnels/tokens NO.0 TNL type : lsp , TNL ID : 0x27 Backup TNL type : lsp , TNL ID : 0x0 create time : 0 days, 13 hours, 3 minutes, 37 seconds up time : 0 days, 12 hours, 54 minutes, 46 seconds last change time : 0 days, 12 hours, 54 minutes, 46 seconds VC last up time : 2010/11/24 12:31:31 VC total up time : 0 days, 2 hours, 12 minutes, 51 seconds CKey : 16 NKey : 15 PW redundancy mode : frr AdminPw interface : -- AdminPw link state : -- Diffserv Mode : uniform Service Class : -- Color : -- DomainId : -- Domain Name : --
[SPE] display mpls switch-l2vc Total Switch VC : 1, 1 up, 0 down *Switch-l2vc type : LDP<---->SVC Peer IP Address : 1.1.1.9, 5.5.5.9 VC ID : 100, 200 VC Type : VLAN VC State : up Session State : up, None Local(In)/Remote(Out) Label : 23552/23552, 100/200 InLabel Status : 0 , 0 Local/Remote MTU : 1500/1500, 1500 Local/Remote Control Word : Disable/Disable, Disable Local/Remote VCCV Capability : alert ttl lsp-ping bfd /alert ttl lsp-ping bfd , alert ttl lsp-ping bfd Switch-l2vc tunnel info : 1 tunnels for peer 1.1.1.9 NO.0 TNL Type : lsp , TNL ID : 0x48002000 1 tunnels for peer 5.5.5.9 NO.0 TNL Type : lsp , TNL ID : 0x48002004 CKey : 44, 1 NKey : 43, 3 Tunnel policy : --, -- Control-Word transparent : NO Create time : 0 days, 0 hours, 10 minutes, 59 seconds UP time : 0 days, 0 hours, 55 minutes, 45 seconds Last change time : 0 days, 0 hours, 55 minutes, 45 seconds VC last up time : 2010/11/24 12:31:31 VC total up time : 0 days, 2 hours, 12 minutes, 51 seconds
CE1和CE2能够相互Ping通。
以CE1的显示为例:
[CE1] ping 192.168.1.2 PING 192.168.1.2: 56 data bytes, press CTRL_C to break Reply from 192.168.1.2: bytes=56 Sequence=1 ttl=255 time=270 ms Reply from 192.168.1.2: bytes=56 Sequence=2 ttl=255 time=220 ms Reply from 192.168.1.2: bytes=56 Sequence=3 ttl=255 time=190 ms Reply from 192.168.1.2: bytes=56 Sequence=4 ttl=255 time=190 ms Reply from 192.168.1.2: bytes=56 Sequence=5 ttl=255 time=160 ms --- 192.168.1.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 160/206/270 ms
配置文件
CE1的配置文件
# sysname CE1 # vlan batch 10 # interface Vlanif10 ip address 192.168.1.1 255.255.255.0 # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 10 # return
UPE1的配置文件
使用lnp disable命令之后,设备重启前对业务没有影响,设备重启后只有命令port default vlan指定的VLAN二层转发可通,其他VLAN二层转发不通。缺省情况下,接口的配置是port default vlan 1,即只有VLAN 1二层转发可通。
# sysname UPE1 # vlan batch 10 20 # lnp disable # mpls lsr-id 1.1.1.9 mpls # mpls l2vpn # mpls ldp # mpls ldp remote-peer 3.3.3.9 remote-ip 3.3.3.9 # interface Vlanif10 mpls l2vc 3.3.3.9 100 # interface Vlanif20 ip address 50.1.1.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 20 # interface LoopBack0 ip address 1.1.1.9 255.255.255.255 # ospf 1 area 0.0.0.0 network 1.1.1.9 0.0.0.0 network 50.1.1.0 0.0.0.255 # return
P1的配置文件
# sysname P1 # vlan batch 20 30 # mpls lsr-id 2.2.2.9 mpls # mpls ldp # interface Vlanif20 ip address 50.1.1.2 255.255.255.0 mpls mpls ldp # interface Vlanif30 ip address 20.1.1.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 30 # interface LoopBack0 ip address 2.2.2.9 255.255.255.255 # ospf 1 area 0.0.0.0 network 2.2.2.9 0.0.0.0 network 20.1.1.0 0.0.0.255 network 50.1.1.0 0.0.0.255 # return
SPE的配置文件
# sysname SPE # vlan batch 30 40 # mpls lsr-id 3.3.3.9 mpls # mpls l2vpn # mpls switch-l2vc 1.1.1.9 100 between 5.5.5.9 200 trans 200 recv 100 encapsulation vlan # mpls ldp # mpls ldp remote-peer 1.1.1.9 remote-ip 1.1.1.9 # mpls ldp remote-peer 5.5.5.9 remote-ip 5.5.5.9 # interface Vlanif30 ip address 20.1.1.2 255.255.255.0 mpls mpls ldp # interface Vlanif40 ip address 30.1.1.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 30 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 40 # interface LoopBack0 ip address 3.3.3.9 255.255.255.255 # ospf 1 area 0.0.0.0 network 3.3.3.9 0.0.0.0 network 20.1.1.0 0.0.0.255 network 30.1.1.0 0.0.0.255 # return
P2的配置文件
# sysname P2 # vlan batch 40 50 # mpls lsr-id 4.4.4.9 mpls # mpls ldp # interface Vlanif40 ip address 30.1.1.2 255.255.255.0 mpls mpls ldp # interface Vlanif50 ip address 40.1.1.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 40 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 50 # interface LoopBack0 ip address 4.4.4.9 255.255.255.255 # ospf 1 area 0.0.0.0 network 4.4.4.9 0.0.0.0 network 30.1.1.0 0.0.0.255 network 40.1.1.0 0.0.0.255 # return
UPE2的配置文件
使用lnp disable命令之后,设备重启前对业务没有影响,设备重启后只有命令port default vlan指定的VLAN二层转发可通,其他VLAN二层转发不通。缺省情况下,接口的配置是port default vlan 1,即只有VLAN 1二层转发可通。
# sysname UPE2 # vlan batch 50 60 # lnp disable # mpls lsr-id 5.5.5.9 mpls # mpls l2vpn # pw-template pwt peer-address 3.3.3.9 # mpls ldp # mpls ldp remote-peer 3.3.3.9 remote-ip 3.3.3.9 # interface Vlanif50 ip address 40.1.1.2 255.255.255.0 mpls mpls ldp # interface Vlanif60 mpls static-l2vc pw-template pwt 200 transmit-vpn-label 100 receive-vpn-label 200 # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 50 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 60 # interface LoopBack0 ip address 5.5.5.9 255.255.255.255 # ospf 1 area 0.0.0.0 network 5.5.5.9 0.0.0.0 network 40.1.1.0 0.0.0.255 # return
CE2的配置文件
# sysname CE2 # vlan batch 60 # interface Vlanif60 ip address 192.168.1.2 255.255.255.0 # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 60 # return