32-MPLS基本配置典型配置举例
本章节下载: 32-MPLS基本配置典型配置举例 (161.97 KB)
目 录
本文介绍了通过静态配置和LDP协议两种方式创建MPLS隧道的典型配置举例。
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800系列以太网交换机 |
Release 1808 |
如图1所示,在运营商网络的MPLS区域中,PE1和PE2作为边缘设备,现要求在图中11.1.1.1/24网段到21.1.1.1/24网段间,通过静态配置创建LSP隧道,使这两个网段中互访的报文能够通过MPLS进行传输。
图1 配置静态LSP组网示意图
· 为了使设备能够按正确的路径转发MPLS报文,需要在手工配置LSP的标签时,确保上游LSR出标签的值就是下游LSR入标签的值。
· LSP是一种单向通道,为了实现数据的双向正常传输,需要在数据传输的两个方向上分别配置一条静态LSP,并指定各自的入节点、中间节点和出节点。
· 在静态LSP环境中,只需要Ingress节点上存在到达FEC目的地址的路由即可,Transit和Egress节点上无需存在到达FEC目的地址的路由,因此本例中使用简单的静态路由即可完成路由配置。
· 如果在配置静态LSP时指定了下一跳,并且下一跳地址存在于路由信息表中,则在配置IP静态路由时也必须指定下一跳。
· 配置Ingress和Transit时,本地的公网地址不能被指定为下一跳。
· 由于MPLS功能会在原有报文上封装一层或多层标签,因此建议用户在使能某VLAN接口的MPLS功能后,将该VLAN内端口的jumboframe功能开启,并根据实际应用和标签嵌套层数配置相应的帧长,避免某些报文因超长而被丢弃。
(1) 配置各接口的IP地址
按照图1配置各接口的IP地址和掩码,包括Loopback接口,具体配置过程略。
(2) 配置静态路由,使两条LSP的Ingress节点上存在到达FEC目的地址的路由。
# 配置PE1。
<PE1> system-view
[PE1] ip route-static 21.1.1.0 24 10.1.1.2
# 配置PE2。
<PE2> system-view
[PE2] ip route-static 11.1.1.0 24 20.1.1.1
# 配置完成后,在Ingress设备上执行display ip routing-table命令,可以看到静态路由已生效。以PE1为例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan2
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan10
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
21.1.1.0/24 Static 60 0 10.1.1.2 Vlan2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
(3) 使能MPLS功能
# 配置PE1。
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] interface vlan-interface 2
[PE1-Vlan-interface2] mpls
[PE1-Vlan-interface2] quit
# 配置P。
[P] mpls lsr-id 2.2.2.9
[P] mpls
[P-mpls] quit
[P] interface vlan-interface 2
[P-Vlan-interface2] mpls
[P-Vlan-interface2] quit
[P] interface vlan-interface 3
[P-Vlan-interface3] mpls
[P-Vlan-interface3] quit
# 配置PE2。
[PE2] mpls lsr-id 3.3.3.9
[PE2] mpls
[PE2-mpls] quit
[PE2] interface vlan-interface 3
[PE2-Vlan-interface3] mpls
[PE2-Vlan-interface3] quit
(4) 创建从PE1到PE2的静态LSP
# 配置Ingress PE1。
[PE1] static-lsp ingress PE1_to_PE2 destination 21.1.1.0 24 nexthop 10.1.1.2 out-label 30
# 配置Transit P
[P] static-lsp transit PE1_to_PE2 incoming-interface vlan-interface 2 in-label 30 nexthop 20.1.1.2 out-label 50
# 配置Egress PE2。
[PE2] static-lsp egress PE1_to_PE2 incoming-interface vlan-interface 3 in-label 50
(5) 创建从PE2到PE1的静态LSP
# 配置Ingress PE2。
[PE2] static-lsp ingress PE2_to_PE1 destination 11.1.1.0 24 nexthop 20.1.1.1 out-label 40
# 配置Transit P。
[P] static-lsp transit PE2_to_PE1 incoming-interface vlan-interface 3 in-label 40 nexthop 10.1.1.1 out-label 70
# 配置Egress PE1。
[PE1] static-lsp egress PE2_to_PE1 incoming-interface vlan-interface 2 in-label 70
# 配置完成后,可以在各交换机上通过display mpls static-lsp命令查看静态LSP的信息。以PE1的显示信息为例:
[PE1] display mpls static-lsp
total statics-lsp : 2
Name FEC I/O Label I/O If State
PE1_to_PE2 21.1.1.0/24 NULL/30 -/Vlan2 Up
PE2_to_PE1 -/- 70/NULL Vlan2/- Up
# 在PE1上检测PE1到PE2静态LSP的可达性。
[PE1] ping lsp ipv4 21.1.1.0 24
LSP Ping FEC: LDP IPV4 PREFIX 21.1.1.1/24 : 100 data bytes, press CTRL_C to break
Reply from 20.1.1.2: bytes=100 Sequence=1 time = 76 ms
Reply from 20.1.1.2: bytes=100 Sequence=2 time = 75 ms
Reply from 20.1.1.2: bytes=100 Sequence=3 time = 75 ms
Reply from 20.1.1.2: bytes=100 Sequence=4 time = 75 ms
Reply from 20.1.1.2: bytes=100 Sequence=5 time = 75 ms
--- FEC: LDP IPV4 PREFIX 21.1.1.1/24 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 75/75/76 ms
# 在PE2上检测PE2到PE1静态LSP的可达性。
[PE2] ping lsp ipv4 11.1.1.0 24
LSP Ping FEC: LDP IPV4 PREFIX 11.1.1.1/24 : 100 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=100 Sequence=1 time = 75 ms
Reply from 10.1.1.1: bytes=100 Sequence=2 time = 75 ms
Reply from 10.1.1.1: bytes=100 Sequence=3 time = 75 ms
Reply from 10.1.1.1: bytes=100 Sequence=4 time = 74 ms
Reply from 10.1.1.1: bytes=100 Sequence=5 time = 75 ms
--- FEC: LDP IPV4 PREFIX 11.1.1.1/24 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 74/74/75 ms
· PE1的配置文件
#
mpls lsr-id 1.1.1.9
#
vlan 2
#
vlan 10
#
mpls
#
interface LoopBack0
ip address 1.1.1.9 255.255.255.255
#
interface Vlan-interface2
ip address 10.1.1.1 255.255.255.0
mpls
#
interface Vlan-interface10
ip address 11.1.1.1 255.255.255.0
#
ip route-static 21.1.1.0 255.255.255.0 11.1.1.2
#
static-lsp ingress PE1_to_PE2 destination 21.1.1.0 24 nexthop 10.1.1.2 out-label 30
#
static-lsp egress PE2_to_PE1 incoming-interface vlan-interface 2 in-label 70
· P的配置文件
#
mpls lsr-id 2.2.2.9
#
vlan 2
#
vlan 3
#
mpls
#
interface LoopBack0
ip address 2.2.2.9 255.255.255.255
#
interface Vlan-interface2
ip address 10.1.1.2 255.255.255.0
mpls
#
interface Vlan-interface3
ip address 20.1.1.1 255.255.255.0
mpls
#
static-lsp transit PE1_to_PE2 incoming-interface vlan-interface 2 in-label 30 nexthop 20.1.1.2 out-label 50
#
static-lsp transit PE2_to_PE1 incoming-interface vlan-interface 3 in-label 40 nexthop 10.1.1.1 out-label 70
· PE2的配置文件
mpls lsr-id 3.3.3.9
#
vlan 3
#
vlan 11
#
mpls
#
interface LoopBack0
ip address 3.3.3.9 255.255.255.255
#
interface Vlan-interface3
ip address 20.1.1.2 255.255.255.0
mpls
#
interface Vlan-interface11
ip address 21.1.1.1 255.255.255.0
#
ip route-static 11.1.1.0 255.255.255.0 20.1.1.1
#
static-lsp egress PE1_to_PE2 incoming-interface vlan-interface 3 in-label 50
#
static-lsp ingress PE2_to_PE1 destination 11.1.1.0 24 nexthop 20.1.1.1 out-label 40
表2 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800系列以太网交换机 |
Release 1808 |
如图2所示,在运营商网络的MPLS区域中,PE1和PE2作为边缘设备,现要求在图中11.1.1.1/24网段到21.1.1.1/24网段间,通过LDP协议创建动态LSP隧道,使这两个网段中互访的报文能够通过MPLS进行传输。
图2 配置动态LSP组网示意图
(1) 配置各接口的IP地址
按照图2配置各接口的IP地址和掩码,包括Loopback接口,具体配置过程略。
(2) 配置OSPF,以保证各交换机之间路由可达。
# 配置PE1。
<PE1> system-view
[PE1] ospf
[PE1-ospf-1] area 0
[PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[PE1-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0] quit
[PE1-ospf-1] quit
# 配置P。
<P> system-view
[P] ospf
[P-ospf-1] area 0
[P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[P-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] quit
[P-ospf-1] quit
# 配置PE2。
<PE2> system-view
[PE2] ospf
[PE2-ospf-1] area 0
[PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[PE2-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0] network 21.1.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0] quit
[PE2-ospf-1] quit
# 配置完成后,在各交换机上执行display ip routing-table命令,可以看到相互之间都学到了到对方的主机路由。以PE1为例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 OSPF 10 11 10.1.1.2 Vlan2
3.3.3.9/32 OSPF 10 12 10.1.1.2 Vlan2
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan2
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan10
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
20.1.1.0/24 OSPF 10 11 10.1.1.2 Vlan2
21.1.1.0/24 OSPF 10 12 10.1.1.2 Vlan2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
PE1和P,P和PE2之间应建立起OSPF邻居关系,执行display ospf peer verbose命令可以看到邻居达到FULL状态。以PE1为例:
[PE1] display ospf peer verbose
OSPF Process 1 with Switch ID 1.1.1.9
Neighbors
Area 0.0.0.0 interface 10.1.1.1(Vlan-interface10)'s neighbors
Router ID: 2.2.2.9 Address: 10.1.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: None BDR: None MTU: 1500
Dead timer due in 39 sec
Neighbor is up for 00:02:13
Authentication Sequence: [ 0 ]
(3) 配置基本能力,并使能LDP
# 配置PE1。
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 2
[PE1-Vlan-interface2] mpls
[PE1-Vlan-interface2] mpls ldp
[PE1-Vlan-interface2] quit
# 配置P。
[P] mpls lsr-id 2.2.2.9
[P] mpls
[P-mpls] quit
[P] mpls ldp
[P-mpls-ldp] quit
[P] interface vlan-interface 2
[P-Vlan-interface2] mpls
[P-Vlan-interface2] mpls ldp
[P-Vlan-interface2] quit
[P] interface vlan-interface 3
[P-Vlan-interface3] mpls
[P-Vlan-interface3] mpls ldp
[P-Vlan-interface3] quit
# 配置PE2。
[PE2] mpls lsr-id 3.3.3.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 3
[PE2-Vlan-interface3] mpls
[PE2-Vlan-interface3] mpls ldp
[PE2-Vlan-interface3] quit
完成上述配置后,PE1和P、P和PE2之间的本地LDP会话建立成功。
在各设备上执行display mpls ldp session命令,可以看到LDP会话的建立情况;执行display mpls ldp peer命令,可以看到LDP的对等体情况。以PE1为例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
----------------------------------------------------------------
2.2.2.9:0 Operational DU Passive Off Off 5/5
----------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display mpls ldp peer
LDP Peer Information in Public network
Total number of peers: 1
-----------------------------------------------------------------
Peer-ID Transport-Address Discovery-Source
----------------------------------------------------------------
2.2.2.9:0 2.2.2.9 Vlan-interface10
----------------------------------------------------------------
(4) 配置LSP的触发策略
# 配置PE1。
[PE1] mpls
[PE1-mpls] lsp-trigger all
[PE1-mpls] quit
# 配置P。
[P] mpls
[P-mpls] lsp-trigger all
[P-mpls] quit
# 配置PE2。
[PE2] mpls
[PE2-mpls] lsp-trigger all
[PE2-mpls] return
配置完成后,在各设备上执行display mpls ldp lsp命令,可以看到LDP LSP的建立情况。以PE1为例。
<PE1> display mpls ldp lsp
LDP LSP Information
-------------------------------------------------------------------------------
SN DestAddress/Mask In/OutLabel Next-Hop In/Out-Interface
-------------------------------------------------------------------------------
1 1.1.1.9/32 3/NULL 127.0.0.1 -------/InLoop0
2 2.2.2.9/32 NULL/3 10.1.1.2 -------/Vlan2
3 3.3.3.9/32 NULL/1027 10.1.1.2 -------/Vlan2
4 11.1.1.0/24 1029/NULL 0.0.0.0 -------/Vlan10
5 20.1.1.0/24 NULL/1032 10.1.1.2 -------/Vlan2
-------------------------------------------------------------------------------
A '*' before an LSP means the LSP is not established
A '*' before a Label means the USCB or DSCB is stale
A '>' before an LSP means the LSP may be inactive
# 使用LSP Ping检测MPLS LSP的有效性和可达性。
<PE1> ping lsp ipv4 3.3.3.9 32
LSP PING FEC: LDP IPV4 PREFIX 3.3.3.9/32 : 100 data bytes, press CTRL_C to break
Reply from 20.1.1.2: bytes=100 Sequence=1 time = 1 ms
Reply from 20.1.1.2: bytes=100 Sequence=2 time = 1 ms
Reply from 20.1.1.2: bytes=100 Sequence=3 time = 1 ms
Reply from 20.1.1.2: bytes=100 Sequence=4 time = 1 ms
Reply from 20.1.1.2: bytes=100 Sequence=5 time = 1 ms
--- FEC: LDP IPV4 PREFIX 3.3.3.9/32 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
· PE1的配置文件
#
mpls lsr-id 1.1.1.9
#
vlan 2
#
mpls
lsp-trigger all
#
mpls ldp
#
interface LoopBack0
ip address 1.1.1.9 255.255.255.255
#
interface Vlan-interface2
ip address 10.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface Vlan-interface10
ip address 11.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 11.1.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255
network 1.1.1.9 0.0.0.0
#
· P的配置文件
#
mpls lsr-id 2.2.2.9
#
vlan 2
#
vlan 3
#
mpls
lsp-trigger all
#
mpls ldp
#
interface LoopBack0
ip address 2.2.2.9 255.255.255.255
#
#
interface Vlan-interface2
ip address 10.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface Vlan-interface3
ip address 20.1.1.1 255.255.255.0
mpls
mpls ldp
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.255
network 2.2.2.9 0.0.0.0
#
· PE2的配置文件
#
mpls lsr-id 3.3.3.9
#
vlan 3
#
vlan 11
#
mpls
lsp-trigger all
#
mpls ldp
#
interface LoopBack0
ip address 3.3.3.9 255.255.255.255
#
interface Vlan-interface3
ip address 20.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface Vlan-interface11
ip address 21.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 21.1.1.0 0.0.0.255
network 3.3.3.9 0.0.0.0
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!