HCIP之LSP静态搭建实验

目录

HCIP之LSP静态搭建实验

实验图

基本配置

R1

R2

R3

R4

配置方法

搭建从1.0 - 4.0 网段的LSP

搭建静态路由

配置MPLS

        配置LSR - ID

        激活MPLS

                全局激活

                接口激活

搭建静态LSP

        搭建入站LSR

                 R1配置

        搭建中转LSR

                R2配置

                R3配置

        搭建出站LSR         

                R4配置

搭建从4.0 - 1.0 网段的LSP

搭建静态路由

搭建LSP

        配置入站LSR(R4)

        配置中转LSR(R3、R2)

        配置出站LSR(R1)

测试

ping通测试

抓包

查看静态LSP表


HCIP之LSP静态搭建实验

实验图

HCIP之LSP静态搭建实验_第1张图片

基本配置

R1

[R1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.0.0.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/24           up         up(s)     
NULL0                             unassigned           up         up(s)

R2

[R2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.0.0.2/24          up         up        
GigabitEthernet0/0/1              23.0.0.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         2.2.2.2/24           up         up(s)     
NULL0                             unassigned           up         up(s)     

R3

[R3]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              23.0.0.2/24          up         up        
GigabitEthernet0/0/1              34.0.0.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         3.3.3.3/24           up         up(s)     
NULL0                             unassigned           up         up(s)     

R4

[R4]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              34.0.0.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/24           up         up(s)     
NULL0                             unassigned           up         up(s)     

配置方法

[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.0.0.2 24
Apr 14 2023 18:47:25-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.0.0.1 24
Apr 14 2023 18:47:36-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2-GigabitEthernet0/0/1]int l 0
[R2-LoopBack0]ip address 2.2.2.2 24

搭建从1.0 - 4.0 网段的LSP

搭建静态路由

[R1]ip route-static 4.4.4.0 24 12.0.0.2

配置MPLS

        配置LSR - ID

[R1]mpls lsr-id 1.1.1.1

注意:

        一般情况下我们习惯使用设备的环回接口的IP地址作为LSR-ID

        激活MPLS

                全局激活

[R1]mpls
Info: Mpls starting, please wait... OK!
[R1-mpls]

                接口激活

[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]mpls

搭建静态LSP

        搭建入站LSR

[R1]static-lsp ingress lto4 destination 4.4.4.0 24 nexthop 12.0.0.2 out-label 16

注意:  

        destination 4.4.4.0 24 nexthop 12.0.0.2 --- 需要和本地路由表中的内容对应上,否则静态LSP搭建失败

        out-label --- 出站标签 --- 即R1将数据包转发后压入的标签,R2收到数据包后,需要根据这个标签判断到底是到达哪个网段的数据包 --- R2接受后需要根据这个标签判断数据到达哪个网段

                 R1配置

[R1]mpls lsr-id 1.1.1.1
[R1]mpls
Info: Mpls starting, please wait... OK!
[R1-mpls]
[R1-mpls]q
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]mpls
[R1-GigabitEthernet0/0/0]q
[R1]static-lsp ingress lto4 destination 4.4.4.0 24 nexthop 12.0.0.2 out-label 16

        搭建中转LSR

[R2]static-lsp transit lto4 incoming-interface GigabitEthernet 0/0/0 in-label 16
 nexthop 23.0.0.2 out-label 17

注意:    

        incoming-interface --- 数据进入的接口

        int-lable --- --- 入站标签 --- 必须和R1配置的出战标签相同

                R2配置

[R2]mpls lsr	
[R2]mpls lsr-id 2.2.2.2
[R2]mpls	
Info: Mpls starting, please wait... OK!
[R2-mpls]q
[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-GigabitEthernet0/0/1]q	
[R2]static-lsp transit lto4 incoming-interface GigabitEthernet 0/0/0 in-label 16
 nexthop 23.0.0.2 out-label 17
[R2]

                R3配置

[R3]mpls lsr-id 3.3.3.3	
[R3]mpls 
Info: Mpls starting, please wait... OK!
[R3-mpls]q
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]mpls 
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]mpls 
[R3-GigabitEthernet0/0/1]q
[R3]static-lsp transit lto4 incoming-interface GigabitEthernet 0/0/0 in-label 17
 nexthop 34.0.0.2 out-label 18

        搭建出站LSR         

[R4]static-lsp egress lto4 incoming-interface g 0/0/0 in-label 18 

                R4配置

[R4]static-lsp egress lto4 incoming-interface g 0/0/0 in-label 18 

搭建从4.0 - 1.0 网段的LSP

搭建静态路由

[R4]ip route-static 1.1.1.0 24 34.0.0.1 

注意:

        因为已经配置过MPLS所以不用再次搭建

搭建LSP

        配置入站LSR(R4)

[R4]static-lsp ingress 4to1 destination 1.1.1.0 24 nexthop 34.0.0.1 out-label 10
00 

        配置中转LSR(R3、R2)

[R3]static-lsp transit 4tol incoming-interface GigabitEthernet 0/0/1 in-label 10
00 nexthop 23.0.0.1 out-label 1001
[R2]static-lsp transit 4tol incoming-interface GigabitEthernet 0/0/1 in-label 10
01 nexthop 12.0.0.1 out-label 1002 

        配置出站LSR(R1)

[R1]static-lsp egress 4to1 incoming-interface GigabitEthernet 0/0/0 in-label 100
2 

测试

ping通测试

[R1]ping -a 1.1.1.1 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=40 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    3 packet(s) received
    40.00% packet loss
    round-trip min/avg/max = 40/46/50 ms

抓包

HCIP之LSP静态搭建实验_第2张图片

HCIP之LSP静态搭建实验_第3张图片

MultiProtocol Label Switching Header, Label --- 为添加的标签

查看静态LSP表

[R1]display mpls static-lsp
TOTAL          :	2       STATIC LSP(S)
UP             :	2       STATIC LSP(S)
DOWN           :	0       STATIC LSP(S)
Name                FEC                I/O Label    I/O If                Status
lto4                4.4.4.0/24         NULL/16      -/GE0/0/0             Up    
4to1                -/-                1002/NULL    GE0/0/0/-             Up    
[R1]
[R2]display mpls static-lsp
TOTAL          :	2       STATIC LSP(S)
UP             :	2       STATIC LSP(S)
DOWN           :	0       STATIC LSP(S)
Name                FEC                I/O Label    I/O If                Status
lto4                -/-                16/17        GE0/0/0/GE0/0/1       Up    
4tol                -/-                1001/1002    GE0/0/1/GE0/0/0       Up    
[R2]
[R3]display mpls static-lsp
TOTAL          :	2       STATIC LSP(S)
UP             :	2       STATIC LSP(S)
DOWN           :	0       STATIC LSP(S)
Name                FEC                I/O Label    I/O If                Status
lto4                -/-                17/18        GE0/0/0/GE0/0/1       Up    
4tol                -/-                1000/1001    GE0/0/1/GE0/0/0       Up    
[R3]
[R4]display mpls static-lsp
TOTAL          :	2       STATIC LSP(S)
UP             :	2       STATIC LSP(S)
DOWN           :	0       STATIC LSP(S)
Name                FEC                I/O Label    I/O If                Status
lto4                -/-                18/NULL      GE0/0/0/-             Up    
4to1                1.1.1.0/24         NULL/1000    -/GE0/0/0             Up    
[R4]

你可能感兴趣的:(HCIP,网络协议,网络)