MPLS的静态配置

实验环境

如图所示,全网使用OSPF AREA 0连接,并将loopback 0地址宣告进OSPF中,AR1的Loopback 1配置接口192.168.1.1/24,AR4的Loopback 1配置接口192.168.2.1/24,并都宣告如OSPF中。
网络配置规则:router id和mpls lsr-id均为1.1.1.X(X为ARX),在同一个广播域中router id 小的,所使用的网络地址小。
image
通过MPLS的配置,控制192.168.1.1至192.168.2.1的流量路径为AR1、AR2、AR3、AR4,192.168.2.1至192.168.1.1的流量路径为AR4、AR3、AR5、AR2、AR1。
image

参考配置

以AR1为例

点击查看代码
#

router id 1.1.1.1

#

mpls lsr-id 1.1.1.1

mpls

#

interface GigabitEthernet0/0/0

 ip address 10.1.1.1 255.255.255.0

 mpls

#

interface LoopBack0

 ip address 1.1.1.1 255.255.255.255

 ospf enable 1 area 0.0.0.0

#

interface LoopBack1

 ip address 192.168.1.1 255.255.255.0

 ospf enable 1 area 0.0.0.0

#

ospf 1

 area 0.0.0.0

  network 10.1.0.0 0.0.255.255

#

static-lsp ingress 1to2 destination 192.168.2.1 32 nexthop 10.1.1.2 out-label 100

static-lsp egress 2to1 incoming-interface GigabitEthernet0/0/0 in-label 700

#
## 以AR2为例
点击查看代码
#

mpls lsr-id 1.1.1.2

mpls

#

interface GigabitEthernet0/0/0

 ip address 10.1.1.2 255.255.255.0

 mpls

#

interface GigabitEthernet0/0/1

 ip address 10.1.2.1 255.255.255.0

 mpls

#

interface GigabitEthernet0/0/2

 ip address 10.1.4.1 255.255.255.0

 mpls

#

interface LoopBack0

 ip address 1.1.1.2 255.255.255.255

 ospf enable 1 area 0.0.0.0

#

ospf 1

 area 0.0.0.0

  network 10.1.0.0 0.0.255.255

#

static-lsp transit 1to2 incoming-interface GigabitEthernet0/0/0 in-label 100 nexthop 10.1.2.2 out-label 200

static-lsp transit 2to1 incoming-interface GigabitEthernet0/0/2 in-label 600 nexthop 10.1.1.1 out-label 700

#

以AR4为例

点击查看代码
#

router id 1.1.1.4

#

mpls lsr-id 1.1.1.4

mpls

#

interface GigabitEthernet0/0/0

 ip address 10.1.3.2 255.255.255.0

 mpls

#

interface LoopBack0

 ip address 1.1.1.4 255.255.255.255

 ospf enable 1 area 0.0.0.0

#

interface LoopBack1

 ip address 192.168.2.1 255.255.255.0

 ospf enable 1 area 0.0.0.0

#

ospf 1

 area 0.0.0.0

  network 10.1.0.0 0.0.255.255

#

static-lsp ingress 2to1 destination 192.168.1.1 32 nexthop 10.1.3.1 out-label 400

static-lsp egress 1to2 incoming-interface GigabitEthernet0/0/0 in-label 300

#
# 功能验证 在AR1上的MPLS LSP ![image](https://img2024.cnblogs.com/blog/3527377/202412/3527377-20241224203434098-965470461.png) 在AR1上的FIB ![image](https://img2024.cnblogs.com/blog/3527377/202412/3527377-20241224203438425-533891855.png) 在AR1上指定以192.168.1.1ping192.168.2.1,并在AR2的G0/0/1口和G0/0/2口捕获数据流量。 ![image](https://img2024.cnblogs.com/blog/3527377/202412/3527377-20241224203443635-303586926.png) G0/0/1口的流量 ![image](https://img2024.cnblogs.com/blog/3527377/202412/3527377-20241224203448033-1702936499.png) G0/0/2口的流量 ![image](https://img2024.cnblogs.com/blog/3527377/202412/3527377-20241224203452456-1237455972.png) # 结论 MPLS的数据转发主要根据FTN(FEC to NHLFE,转发等价类到下一跳标签转发项)、NHLFE(next hop label forwarding entry,下一跳标签转发项)、ILM(incoming label mapping,如标签映射)。三者通过系统自动创建的tunnel ID联系,该值自动分配且仅本地有效。 注意:在创建静态MPLS-LSP时,destination(目的地址)为32位的主机地址,状态才会up。
posted @ 2024-12-24 20:35  FuMingyang  阅读(175)  评论(0)    收藏  举报