准备工作
需要保证 PC3 与 PC4 网络可达,否则 MPLS 无法生效。我们使用 OSPF 路由协议,来实现网络互通(如下配置将重点关注 MPLS 配置,未体现 OSPF 配置);
配置命令
AR4:
mpls lsr-id 10.0.45.4 mpls interface GigabitEthernet0/0/0 ip address 1.1.1.4 255.255.255.0 interface GigabitEthernet0/0/1 ip address 10.0.45.4 255.255.255.0 mpls static-lsp ingress 4to6 destination 3.3.3.0 24 nexthop 10.0.45.5 out-label 200
AR5:
mpls lsr-id 5.5.5.5 mpls interface GigabitEthernet0/0/0 ip address 10.0.45.5 255.255.255.0 mpls interface GigabitEthernet0/0/1 ip address 10.0.56.5 255.255.255.0 mpls static-lsp transit 4to6 incoming-interface GigabitEthernet0/0/0 in-label 200 nexthop 10.0.56.6 out-label 200
AR6:
mpls lsr-id 6.6.6.6 mpls interface GigabitEthernet0/0/0 ip address 10.0.56.6 255.255.255.0 mpls interface GigabitEthernet0/0/1 ip address 3.3.3.6 255.255.255.0 static-lsp egress 4to6 incoming-interface GigabitEthernet0/0/0 in-label 200
网络测试
[PC3] ping PC4,并进行抓包,理论上仅有能看到 ICMP Request 包含 MPLS Label 信息,而 ICMP Reply 未包含 MPLS Lable 信息;
查看 LSP 信息:
<AR4>display mpls lsp ------------------------------------------------------------------------------- LSP Information: STATIC LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 3.3.3.0/24 NULL/200 -/GE0/0/1 <AR4>display mpls static-lsp TOTAL : 1 STATIC LSP(S) UP : 1 STATIC LSP(S) DOWN : 0 STATIC LSP(S) Name FEC I/O Label I/O If Status 4to6 3.3.3.0/24 NULL/200 -/GE0/0/1 Up <AR4>display mpls static-lsp verbose No : 1 LSP-Name : 4to6 LSR-Type : Ingress FEC : 3.3.3.0/24 In-Label : NULL Out-Label : 200 In-Interface : - Out-Interface : GigabitEthernet0/0/1 NextHop : 10.0.45.5 Static-Lsp Type: Normal Lsp Status : Up
补充说明
1)鉴于配置静态 LSP,所以我们 LSR ID 未采用网络可达地址;
2)如果对应接口为开启 MPLS,则 static-lsp 为 DOWN 状态;
3)鉴于标签是本地意义的,所以我们都使用 200 标签值(实质上,保证本端出与对端入一致即可);