MPLS概念(AI)
MPLS(多协议标签交换)的工作原理是通过标签(Label)引导数据转发,将固定长度的短标签与数据分组封装,交换节点仅根据标签进行快速转发,从而提升网络传输效率和灵活性。
MPLS的静态lsp(人机)
拓扑
实验目的:
1. 掌握mpls 静态lsp的配置
2. 掌握mpls网络中数据通信过程
实验步骤:
1. 设备重命名以及IP地址的配置
2. 配置OSPF
3. 配置静态LSP,在AR1测试,并且在G0/0/0口抓包查看数据特征
4. 配置FEC为1.1.1.1的静态lsp,再次在AR1上ping测试3.3.3.3,查看抓包结果
命令
配置
r1
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1]int lo 0
[r1-LoopBack0]ip add 1.1.1.1 32
[r1-LoopBack0]q
[r1-GigabitEthernet0/0/0]ospf
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]mpls lsr-id 1.1.1.1
[r1]mpls
Info: Mpls starting, please wait... OK!
[r1-mpls]int g0/0/0
[r1-GigabitEthernet0/0/0]mpls
[r1-GigabitEthernet0/0/0]q
[r1]static-lsp ingress 1-3 destination 3.3.3.3 32 nexthop 12.1.1.2 outgoing-int
g0/0/0 out-label 200测试
[r1]static-lsp egress 3-1 incoming-int g0/0/0 in-label 300{r1}dis mpls lsp
注:出现并联通3.3.3.3即可
配置
r2
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname r2
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
[r2-GigabitEthernet0/0/1]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[r2-GigabitEthernet0/0/0]q
[r2]ospf
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]q
[r2]int lo 0
[r2-LoopBack0]ip add 2.2.2.2 32
[r2-LoopBack0]q
[r2]mpls lsr-id 2.2.2.2
[r2]mpls
Info: Mpls starting, please wait... OK!
[r2-mpls]int g0/0/0
[r2-GigabitEthernet0/0/0]mpls
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]mpls
[r2-GigabitEthernet0/0/1]q
[r2]static-lsp transit 1-3 incoming-int g0/0/0 in-label 200 nexthop 23.1.1.2 out
-label 100
如果配置有误,可以把接口改成/1,建议看准接口在配置,此为12-23ip的下一跳,应为/1r2/r3测试
[r2]dis mpls lsp
-------------------------------------------------------------------------------LSP Information: STATIC LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
-/- 200/100 GE0/0/0/GE0/0/0
[r2]static-lsp transit 3-1 incoming-int g0/0/1 in-label 100 nexthop 12.1.1.1 out
-label 100
配置
r3
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 23.1.1.3 24
[r3-GigabitEthernet0/0/1]int lo 0
[r3-LoopBack0]ip add 3.3.3.3 32
[r3-LoopBack0]q
[r3]ospf
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]q
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
Info: Mpls starting, please wait... OK!
[r3-mpls]int g0/0/1
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]q
[r3]q
[r3]static-lsp egress 1-3 incoming-int g0/0/1 in-label 100测试
[r3]static-lsp ingress 3-1 destination 1.1.1.1 32 nexhop 23.1.1.1 out-label 100dis mpls lsp
测试
出现能相互IP互通包就行
MPLS的ldp(人机)
拓扑
命令
[Huawei]sysname r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int lo 0
[r1-LoopBack0]ip add 1.1.1.1 32
[r1-LoopBack0]ospf
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.0
[r1-ospf-1-area-0.0.0.0]mpls lsr-id 1.1.1.1
[r1]mpls
Info: Mpls starting, please wait... OK!
[r1-mpls]q
[r1]mpls ldp
[r1-mpls-ldp]int g0/0/0
[r1-GigabitEthernet0/0/0]mpls
[r1-GigabitEthernet0/0/0]mpls ldp
[r1-GigabitEthernet0/0/0]q
[r1]q<r1>dis mpls ldp sessionLDP Session(s) in Public NetworkCodes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)A '*' before a session means the session is being deleted.------------------------------------------------------------------------------PeerID Status LAM SsnRole SsnAge KASent/Rcv------------------------------------------------------------------------------2.2.2.2:0 NonExistent Passive 0/0------------------------------------------------------------------------------TOTAL: 1 session(s) Found.
sys
un in en
sys r2
int g0/0/1
ip add 12.1.1.2 24
int g0/0/0
ip add 23.1.1.2 24
int lo 0
ip add 2.2.2.2 32
ospf
area 0
network 2.2.2.2 0.0.0.0
network 12.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
mpls lsr-id 2.2.2.2
mpls
q
mpls ldp
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
sys
un in en
sys r3
int g0/0/1
ip add 23.1.1.3 24
int g0/0/0
ip add 34.1.1.3 24
int lo 0
ip add 3.3.3.3 32
ospf
area 0
network 3.3.3.3 0.0.0.0
network 34.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
mpls lsr-id 3.3.3.3
mpls
q
mpls ldp
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
sys
int g0/0/1
ip add 34.1.1.4
int lo 0
ip add 4.4.4.4 32
ospf
area 0
network 4.4.4.4 0.0.0.0
network 34.1.1.0 0.0.0.255
mpls lsr-id 4.4.4.4
mpls
q
mpls ldp
int g0/0/1
mpls
mpls ldp
测试
由于ar1的会话过期