1、OSPF关键配置
R1配置:
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.12.0 0.0.0.255
R2配置:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.12.2 0.0.0.0
network 10.1.23.2 0.0.0.0
R3配置:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.23.3 0.0.0.
2、MPLS静态LSP配置
1)、R1--->R3方向LSP配置
R1作为ingress
[R1]mpls lsr-id 1.1.1.1 //配置MPLS LSR-ID
[R1]mpls //开启MPLS
[R1-GigabitEthernet0/0/0]mpls
[R1]static-lsp ingress 1to3 destination 3.3.3.3 32 nexthop 10.1.12.2 out-label 102 //配置静态LSP
到达目的3.3.3.3/32出标签为102
R2作为transit
[R2]mpls lsr-id 2.2.2.2
[R2]mpls
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]mpls
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]mpls
[R2]static-lsp transit 1to3 incoming-interface g0/0/0 in-label 102 nexthop 10.1.23.3 out-label 203
配置入接口标签为102,出标签为203
R3作为egrees
[R3]mpls lsr-id 3.3.3.3
[R3]mpls
[R3-GigabitEthernet0/0/1]mpls
[R3]static-lsp egress 1to3 incoming-interface g0/0/1 in-label 203
静态LSP入接口G0/0/1入标签为203
[R1]display mpls lsp
[R2]display mpls lsp
[R3]display mpls lsp
[R1]ping lsp ip 3.3.3.3 32 //检测LSP的连通性及LSP是否能够正常的转发
LSP PING FEC: IPV4 PREFIX 3.3.3.3/32/ : 100 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=100 Sequence=1 time=40 ms
Reply from 3.3.3.3: bytes=100 Sequence=2 time=30 ms
此时R1到R3的LSP连通性正常。如果需要R3到R1的LSP正常,我们需要配置R3到R1的LSP
R3作为ingress
static-lsp ingress 3to1 destination 1.1.1.1 32 nexthop 10.1.23.2 out-label 302
R2作为transit
[R2]static-lsp transit 3to1 incoming-interface g 0/0/1 in-label 302 nexthop 10.1.12.1 out-label 201
R1作为egress
[R1]static-lsp egress 3to1 incoming-interface g 0/0/0 in-label 201
[R3]display mpls lsp
[R2]display mpls lsp
[R1]display mpls lsp
[R3]ping lsp ip 1.1.1.1 32
LSP PING FEC: IPV4 PREFIX 1.1.1.1/32/ : 100 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=100 Sequence=1 time=40 ms
Reply from 1.1.1.1: bytes=100 Sequence=2 time=30 ms
注意事项:
1、配置静态LSP目标与路由表中的目标掩码需一致
[R1]static-lsp ingress 1to3 destination 3.3.3.3 24 nexthop 10.1.12.2 out-label 102
此时我们查看没有查看到3.3.3.3 32的静态LSP标签
[R1]display mpls lsp
-/- 201/NULL GE0/0/0/-
因为路由表中是32 位的掩码,我们配置24位 到 3.3.3.3 的LSP
正确配置:[R1]static-lsp ingress 1to3 destination 3.3.3.3 32 nexthop 10.1.12.2 out-label 102
2、中间如果没有3.3.3.3 的路由不影响LSP
我们知道R2路由表中有3.3.3.3 的路由,如果我们把3.3.3.3路由过滤掉,是否影响LSP
[R2]acl 2000
[R2-acl-basic-2000]rule deny source 3.3.3.3 0
[R2-acl-basic-2000]rule permit source any
[R2-ospf-1]filter-policy 2000 import
此时R2 路由表中没有R3的路由
中间Transit属于标签转发,不影响LSP的连续性:
[R1]ping lsp ip 3.3.3.3 32
LSP PING FEC: IPV4 PREFIX 3.3.3.3/32/ : 100 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=100 Sequence=1 time=30 ms
Reply from 3.3.3.3: bytes=100 Sequence=2 time=40 ms
Reply from 3.3.3.3: bytes=100 Sequence=3 time=30 ms