MPLS-TE前四个基础实验

MPLS-TE的基础配置

image-20230416145206341

实验目标:

  • 所有的路由器都运行MPLS-TE
  • 实现从AR1到10.0.4.4的MPLS-TE负载

基础配置

# R1
sys
sysn AR1
int l0
	ip add 10.0.1.1 32
int g0/0/1
	ip add 10.0.15.1 24
int g0/0/0
	ip add 10.0.12.1 24
ospf 1 router-id 10.0.1.1
	a 0
		network 10.0.1.1 0.0.0.0
		network 10.0.15.1 0.0.0.0
		network 10.0.12.1 0.0.0.0

R2:
sys
sysn AR2
int l0
	ip add 10.0.2.2 32
int g0/0/0
	ip add 10.0.12.2 24
int g0/0/1
	ip add 10.0.23.2 24
int g0/0/2
	ip add 10.0.25.2 24
ospf 1 router-id 10.0.2.2
	a 0
		network 0.0.0.0 0.0.0.0

# R3:
sys
sysn AR3
int l0
	ip add 10.0.3.3 32
int g0/0/0
	ip add 10.0.23.3 24
int g0/0/1
	ip add 10.0.34.3 24
int g0/0/2
	ip add 10.0.36.3 24
ospf 1 router-id 10.0.3.3
	a 0
		network 0.0.0.0 0.0.0.0

# R4
sys
sysn AR4
int l0
	ip add 10.0.4.4 32
int g0/0/0
	ip add 10.0.34.4 24
int g0/0/1
	ip add 10.0.46.4 24
ospf 1 router-id 10.0.4.4
	a 0
		network 10.0.4.4 0.0.0.0
		network 10.0.34.4 0.0.0.0
		network  10.0.46.4 0.0.0.0

# R5
sys
sysn AR5
int l0
	ip add 10.0.5.5 32
int g0/0/0
	ip add 10.0.56.5 24
int g0/0/2
	ip add 10.0.25.5 24
int g0/0/1
	ip add 10.0.15.5 24
ospf 1 router-id 10.0.5.5
a 0
network 0.0.0.0 0.0.0.0

# R6
sys
sysn AR6
int l0
	ip add 10.0.6.6 32
int g0/0/1
	ip add 10.0.56.6 24
int g0/0/0
	ip add 10.0.46.6 24
int g0/0/2
	ip add 10.0.36.6 24
ospf 1 router-id 10.0.6.6
a 0
network 0.0.0.0 0.0.0.0
# 基础配置完成之后,从R1到R4应是负载效果,反之亦然。
<AR4>dis ip routing-table 10.0.1.1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32  OSPF    10   3           D   10.0.34.3       GigabitEthernet
0/0/0
                    OSPF    10   3           D   10.0.46.6       GigabitEthernet
0/0/1

RSVP-TE的配置

# 所有的路由器全都开启MPLS-TE功能,以AR1为例子
mpls lsr-id 10.0.1.1
mpls
	mpls te
	mpls rsvp-te 

# 所有的物理接口全都打开mpls mplste
int g x/x/x
	mpls
	mpls te
	mpls rsvp-te

# 让所有的OSPF支持MPLS-TE
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
# 具体配置
# R1的具体配置
mpls lsr-id 10.0.1.1
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
		
# AR2的具体配置
mpls lsr-id 10.0.2.2
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
int g0/0/2
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
		
		
# AR3的具体配置
mpls lsr-id 10.0.3.3
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
int g0/0/2
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable

# AR4的具体配置
mpls lsr-id 10.0.4.4
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
# AR5的具体配置
mpls lsr-id 10.0.5.5
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
int g0/0/2
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
# # AR6的具体配置
mpls lsr-id 10.0.6.6
mpls
	mpls te
	mpls rsvp-te 
int g0/0/0
	mpls
	mpls te
	mpls rsvp-te
int g0/0/1
	mpls
	mpls te
	mpls rsvp-te
int g0/0/2
	mpls
	mpls te
	mpls rsvp-te
ospf 1
	opaque-capability enable 
	a 0
		mpls-te enable
# 校验
AR1>dis ospf lsdb

	 OSPF Process 1 with Router ID 10.0.1.1
		 Link State Database 

		         Area: 0.0.0.0
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    10.0.5.5        10.0.5.5           366  72    8000001B       0
 Router    10.0.3.3        10.0.3.3           377  72    80000021       0
……
 
		         Area: 0.0.0.1
 
		 Type 10 Opaque (Area-Local Scope) Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Area
 Opq-Area  1.0.0.3         10.0.2.2           470  200   80000001    0.0.0.0
 Opq-Area  1.0.0.3         10.0.3.3           431  200   80000001    0.0.0.0
 ……

查看一下LSA里面具体内容,这是AR1自己发送的

<AR1>dis ospf mpls-te self-originated 
	 OSPF Process 1 with Router ID 10.0.1.1
 Area ID                   : 0.0.0.0
 LSA [ 1 ]
 ------------------------------------------------
   Lsa  Type                : Opq-Area
   Opaque Type              : 1
   Opaque Id                : 1
   Advertising Router Id    : 10.0.1.1    # 通告路由器

 
   Link Type                : MultiAccess 
   Link ID                  : 10.0.12.1 
   Local Interface Address  : 10.0.12.1    # 本地地址
   Remote Interface Address : 0.0.0.0      # 没有指对端地址
   TE Metric                : 1            # TE的开销
   Maximum Bandwidth        : 0 bytes/sec  # 最大带宽
   Maximum Reservable BW    : 0 bytes/sec  # 最大可保留带宽
   Admin Group              : 0X0          # 管理组

隧道配置

# R1的具体配置
[AR1]dis mpls lsp
[AR1]int tunnel 0/0/1
[AR1-Tunnel0/0/1]tunnel-protocol mpls te
[AR1-Tunnel0/0/1]ip add unnumbered interface l0
[AR1-Tunnel0/0/1]destination 10.0.4.4
[AR1-Tunnel0/0/1]mpls te tunnel-id 1
[AR1-Tunnel0/0/1]mpls te signal-protocol rsvp-te 
[AR1-Tunnel0/0/1]mpls te commit 
[AR1-Tunnel0/0/1]
Apr 15 2023 20:50:52-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[41]:The line protocol I
P on the interface Tunnel0/0/1 has entered the UP state. 

[AR1-Tunnel0/0/1]dis ip int brie    
Tunnel0/0/1                       10.0.1.1/32          up         up

# 在R1配置了隧道接口之后,立马形成了LSP路径,现在R5上并没有隧道
[AR1]dis mpls lsp
-------------------------------------------------------------------------------
                 LSP Information: RSVP LSP
-------------------------------------------------------------------------------
FEC                In/Out Label  In/Out IF                      Vrf Name       
10.0.4.4/32        NULL/1024     -/GE0/0/0

隧道源接口这个地址的与GRE的隧道接口一样没有意义步骤比较多,如果少了哪一步,commit的时候会提醒你的。

其实这个过程是这样的,在隧道选中目标IP是10.0.4.4之后,MPLS-TE立马在路由表里面查看10.0.4.4的路由,并将建立请求的信息发送给10.0.4.4,R4收到之后立马就会通过RSVP-TE沿着中间的其它路由器向着R1方向建立LSP,这个方向与LDP差不多,都是与数据转发的方向是相反的。

# 验证
<AR1>dis mpls lsp 
-------------------------------------------------------------------------------
                 LSP Information: RSVP LSP
-------------------------------------------------------------------------------
FEC                In/Out Label  In/Out IF                      Vrf Name       
10.0.4.4/32        NULL/1024     -/GE0/0/0

<AR1>dis mpls lsp verbose
-------------------------------------------------------------------------------
                 LSP Information: RSVP LSP
-------------------------------------------------------------------------------

  No                  :  1
  SessionID           :  1
  IngressLsrID        :  10.0.1.1
  LocalLspID          :  1
  Tunnel-Interface    :  Tunnel0/0/1
  Fec                 :  10.0.4.4/32
  TunnelTableIndex    :  0x0
  Nexthop             :  10.0.12.2
  In-Label            :  NULL
  Out-Label           :  1024
  In-Interface        :  ----------
  Out-Interface       :  GigabitEthernet0/0/0
  LspIndex            :  2048
  Token               :  0x2
  LsrType             :  Ingress
  Mpls-Mtu            :  1500
  TimeStamp           :  595sec
  Bfd-State           :  ---
  CBfd-Event          :  0x0
  Bed-State           :  BED STOP
  Bed-LastNotifyValue :  ---
  Bed-LastNotifyLspId :  ---

<AR1>tracert lsp te tunnel 0/0/1
  LSP Trace Route FEC: TE TUNNEL IPV4 SESSION QUERY Tunnel0/0/1 , press CTRL_C t
o break.
  TTL   Replier            Time    Type      Downstream 
  0                                Ingress   10.0.12.2/[1024 ]   # 压入标签
  1     10.0.12.2          20 ms   Transit   10.0.23.3/[1024 ]   # 中间的传输节点
  2     10.0.23.3          30 ms   Transit   10.0.34.4/[3 ]      # 中间的传输节点
  3     10.0.4.4           30 ms   Egress                        # 弹出标签
[AR1]int t0/0/1
	mpls te record-route label

<AR1>dis mpls te tunnel path 
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :2 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2  Label 1025 
  Hop 2   10.0.2.2  Label 1025 
  Hop 3   10.0.23.2 
  Hop 4   10.0.23.3  Label 1025 
  Hop 5   10.0.3.3  Label 1025 
  Hop 6   10.0.34.3 
  Hop 7   10.0.34.4  Label 3 
  Hop 8   10.0.4.4  Label 3

image-20230416145753674

MPLS-TE根据带宽选路实现

image-20230416125059953

先看AR1的默认选路

按理说是随机的,奈何一直随机R1-R2-R3-R4这条路径,R1-R5-R6-R4那条路径明明也能走,当把R2和R3关机之后就会走上面的那条;

[AR1-Tunnel0/0/1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :2 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2 
  Hop 2   10.0.2.2 
  Hop 3   10.0.23.2 
  Hop 4   10.0.23.3 
  Hop 5   10.0.3.3 
  Hop 6   10.0.34.3 
  Hop 7   10.0.34.4 
  Hop 8   10.0.4.4 
  
[AR1-Tunnel0/0/1]restart
[AR1-Tunnel0/0/1]
Apr 16 2023 12:52:39-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[26]:The line protocol I
P on the interface Tunnel0/0/1 has entered the DOWN state. 
[AR1-Tunnel0/0/1]
Apr 16 2023 12:52:39-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[27]:The line protocol I
P on the interface Tunnel0/0/1 has entered the UP state. 
[AR1-Tunnel0/0/1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :2 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2 
  Hop 2   10.0.2.2 
  Hop 3   10.0.23.2 
  Hop 4   10.0.23.3 
  Hop 5   10.0.3.3 
  Hop 6   10.0.34.3 
  Hop 7   10.0.34.4 
  Hop 8   10.0.4.4 

配置

思路:

1. 根据拓扑,调整物理接口的带宽限制
2. 通知MPLS-TE使用本身的的路径选择算法
3. 在AR1的隧道内要求建立LSP的时候,沿途带宽必须大于150M
4. 第四步:看效果,成功,现在是走R1-R5-R6这条路径
# 根据拓扑,调整物理接口的带宽限制
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]mpls te bandwidth max-reservable-bandwidth 200000
[AR1-GigabitEthernet0/0/1]mpls te bandwidth bc0 200000

[AR5]int g0/0/0
[AR5-GigabitEthernet0/0/0]mpls te bandwidth max-reservable-bandwidth 200000
[AR5-GigabitEthernet0/0/0]mpls te bandwidth bc0 200000

[AR6]int g0/0/0
[AR6-GigabitEthernet0/0/0]mpls te bandwidth max-reservable-bandwidth 200000
[AR6-GigabitEthernet0/0/0]mpls te bandwidth bc0 200000

[AR1-GigabitEthernet0/0/0]mpls te bandwidth max-reservable-bandwidth 100000
[AR1-GigabitEthernet0/0/0]mpls te bandwidth bc0 100000

[AR2-GigabitEthernet0/0/1]mpls te bandwidth max-reservable-bandwidth 100000
[AR2-GigabitEthernet0/0/1]mpls te bandwidth bc0 100000

[AR3-GigabitEthernet0/0/1]mpls te bandwidth max-reservable-bandwidth 100000
[AR3-GigabitEthernet0/0/1]mpls te bandwidth bc0 100000
# 第二步:通知MPLS-TE使用本身的的路径选择算法
[AR1]mpls
[AR1-mpls]mpls te cspf
[AR1-mpls]dis th
[V200R003C00]
#
mpls lsr-id 10.0.1.1
mpls
 mpls te
 mpls rsvp-te
 mpls te cspf
# 第三步:在AR1的隧道内要求建立LSP的时候,沿途带宽必须大于150M
[AR1]int t0/0/1
[AR1-Tunnel0/0/1]mpls te bandwidth CT0 150000
[AR1-Tunnel0/0/1]mpls te commit
[AR1-Tunnel0/0/1]restart
# 第四步:看效果,成功,现在是走R1-R5-R6这条路径
[AR1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :3 
 Hop Information 
  Hop 0   10.0.15.1 
  Hop 1   10.0.15.5 
  Hop 2   10.0.5.5 
  Hop 3   10.0.56.5 
  Hop 4   10.0.56.6 
  Hop 5   10.0.6.6 
  Hop 6   10.0.46.6 
  Hop 7   10.0.46.4 
  Hop 8   10.0.4.4 

MPLS-TE根据亲和属性选路

image-20230416162607682

当前路径

[AR1]int t0/0/1
[AR1-Tunnel0/0/1]dis th
[V200R003C00]
#
interface Tunnel0/0/1
 ip address unnumbered interface LoopBack0
 tunnel-protocol mpls te
 destination 10.0.4.4
 mpls te tunnel-id 1
 mpls te record-route
 mpls te commit

# 随机选了一个上面的路径
[AR1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :1 
 Hop Information 
  Hop 0   10.0.15.1 
  Hop 1   10.0.15.5 
  Hop 2   10.0.5.5 
  Hop 3   10.0.56.5 
  Hop 4   10.0.56.6 
  Hop 5   10.0.6.6 
  Hop 6   10.0.46.6 
  Hop 7   10.0.46.4 
  Hop 8   10.0.4.4

配置

在R1上规则路径,希望AR4来的时候是这样的路径,如下所示

image-20230416162650119

# 第一步:在MPLS里面启用算法,先在所有的设备的物理接口上把管理组根据图中的拓扑敲上
# 启用算法
[AR1-mpls]mpls te cspf

# 例如,只敲入接口即可,以R1为例子
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]mpls te link administrative group 10001
Info: The configuration will take into effect ONLY for the newly created LSP
# 第二步:在隧道上配置配置亲和属性和MASK用来匹配路径,重启隧道进行验证
[AR1-Tunnel0/0/1]mpls te affinity property 10001 mask 11101
[AR1-Tunnel0/0/1]mpls te commit
[AR1-Tunnel0/0/1]restart

# 验证
# 成功
[AR1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :1 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2 
  Hop 2   10.0.2.2 
  Hop 3   10.0.25.2 
  Hop 4   10.0.25.5 
  Hop 5   10.0.5.5 
  Hop 6   10.0.56.5 
  Hop 7   10.0.56.6 
  Hop 8   10.0.6.6 
  Hop 9   10.0.36.6 
  Hop 10   10.0.36.3 
  Hop 11   10.0.3.3 
  Hop 12   10.0.34.3 
  Hop 13   10.0.34.4 
  Hop 14   10.0.4.4

MPLS-TE 显式路径

严格

# # 启用算法
[AR1-mpls]mpls te cspf

# 定义严格路径列表
[AR1]explicit-path 1
[AR1-explicit-path-1]next hop 10.0.12.2 include strict
[AR1-explicit-path-1]next hop 10.0.25.5 include strict
[AR1-explicit-path-1]next hop 10.0.56.6 include strict
[AR1-explicit-path-1]next hop 10.0.36.3 include strict
[AR1-explicit-path-1]next hop 10.0.34.4 include strict
[AR1-explicit-path-1]list hop
 Path Name : 1         Path Status : Enabled            
 1      10.0.12.2         Strict      Include             
 2      10.0.25.5         Strict      Include             
 3      10.0.56.6         Strict      Include             
 4      10.0.36.3         Strict      Include             
 5      10.0.34.4         Strict      Include

# 调用
[AR1]int t0/0/1
[AR1-Tunnel0/0/1]mpls te path ex
[AR1-Tunnel0/0/1]mpls te path explicit-path 1
[AR1-Tunnel0/0/1]mpls te commit
[AR1-Tunnel0/0/1]restart

# 校验
<AR1>dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :1 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2 
  Hop 2   10.0.2.2 
  Hop 3   10.0.25.2 
  Hop 4   10.0.25.5 
  Hop 5   10.0.5.5 
  Hop 6   10.0.56.5 
  Hop 7   10.0.56.6 
  Hop 8   10.0.6.6 
  Hop 9   10.0.36.6 
  Hop 10   10.0.36.3 
  Hop 11   10.0.3.3 
  Hop 12   10.0.34.3 
  Hop 13   10.0.34.4 
  Hop 14   10.0.4.4

PS:切换的时候旧的路径有可能会有残留显示

松散

# # 启用算法
[AR1-mpls]mpls te cspf

# 没限制的情况下
[AR1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :1 
 Hop Information 
  Hop 0   10.0.12.1 
  Hop 1   10.0.12.2 
  Hop 2   10.0.2.2 
  Hop 3   10.0.23.2 
  Hop 4   10.0.23.3 
  Hop 5   10.0.3.3 
  Hop 6   10.0.34.3 
  Hop 7   10.0.34.4 
  Hop 8   10.0.4.4


# 隧道路径必须经过10.0.56.6
[AR1]explicit-path 2  
[AR1-explicit-path-2]next hop 10.0.56.6 include loose
[AR1]int t0/0/1
[AR1-Tunnel0/0/1]mpls te path explicit-path 2
[AR1-Tunnel0/0/1]restart

# 校验
[AR1]dis mpls te tunnel path
 Tunnel Interface Name : Tunnel0/0/1
 Lsp ID : 10.0.1.1 :1 :1 
 Hop Information 
  Hop 0   10.0.15.1 
  Hop 1   10.0.15.5 
  Hop 2   10.0.5.5 
  Hop 3   10.0.56.5 
  Hop 4   10.0.56.6 
  Hop 5   10.0.6.6 
  Hop 6   10.0.46.6 
  Hop 7   10.0.46.4 
  Hop 8   10.0.4.4
posted @ 2023-04-16 16:31  张贺贺呀  阅读(76)  评论(0编辑  收藏  举报