一、MPLS 拓撲
二、MPLS配置
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
三、驗證LSP
[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