The MPLS experiment is actually not difficult. After doing the experiment in this article, it will be easy in the future!

experimental topology

Experimental requirements

1. The device interconnection address is as shown in the figure; all devices have a Loopback0 interface, and the IP address of this interface is xxxx/32, where x is the device number. The IP address of Loopback0 is used as the OSPF RouterID, LSR ID, and LDP transport address;

2. R1, R2, R3, and R4 run OSPF, and notify the directly connected interface and Loopback0;

3. Activate MPLS on all devices, establish LDP neighbors based on direct connection, and observe the distribution of labels;

4. Observe the 1.1.1.1 access 4.4.4.4 data packet, and analyze the process of the data packet traversing the MPLS network.

Experimental steps and configuration

1. R1, R2, R3 and R4 complete the interface IP address configuration and run OSPF

The configuration of R1 is as follows:

[R1] interface GigabitEthernet0/0/0
[R1-GigabitEthernet0/0/0] ip address 12.1.1.1 24
[R1] interface loopback0
[R1-Loopback0] ip address 1.1.1.1 32

[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] area 0
[R1-ospf-1-0.0.0.0] network 12.1.1.0 0.0.0.255
[R1-ospf-1-0.0.0.0] network 1.1.1.1 0.0.0.0

The configuration of R2 is as follows:

[R2] interface GigabitEthernet0/0/0
[R2-GigabitEthernet0/0/0] ip address 12.1.1.2 24
[R2] interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1] ip address 23.1.1.2 24
[R2] interface loopback0
[R2-Loopback0] ip address 2.2.2.2 32

[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-0.0.0.0] network 12.1.1.0 0.0.0.255
[R2-ospf-1-0.0.0.0] network 23.1.1.0 0.0.0.255
[R2-ospf-1-0.0.0.0] network 2.2.2.2 0.0.0.0

The configuration of R3 is as follows:

[R3] interface GigabitEthernet0/0/0
[R3-GigabitEthernet0/0/0] ip address 23.1.1.3 24
[R3] interface GigabitEthernet0/0/1
[R3-GigabitEthernet0/0/1] ip address 34.1.1.3 24
[R3] interface loopback0
[R3-Loopback0] ip address 3.3.3.3 32

[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 0
[R3-ospf-1-0.0.0.0] network 23.1.1.0 0.0.0.255
[R3-ospf-1-0.0.0.0] network 34.1.1.0 0.0.0.255
[R3-ospf-1-0.0.0.0] network 1.1.1.1 0.0.0.0

The configuration of R4 is as follows:

[R4] interface GigabitEthernet0/0/0
[R4-GigabitEthernet0/0/0] ip address 34.1.1.4 24
[R4] interface loopback0
[R4-Loopback0] ip address 4.4.4.4 32

[R4] ospf 1 router-id 4.4.4.4
[R4-ospf-1] area 0
[R4-ospf-1-0.0.0.0] network 34.1.1.0 0.0.0.255
[R4-ospf-1-0.0.0.0] network 4.4.4.4 0.0.0.0

2. R1, R2, R3 and R4 activate MPLS and activate LDP on the interface

The configuration of R1 is as follows:

[R1] mpls lsr-id 1.1.1.1  #配置MPLS LSR ID

[R1] mpls  #全局激活MPLS
[R1-mpls] quit

[R1] mpls ldp #全局激活LDP
[R1-mpls-ldp] quit

[R1] Interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0] mpls #在接口上激活MPLS
[R1-GigabitEthernet0/0/0] mpls ldp #在接口上激活LDP

The configuration of R2 is as follows:

[R2] mpls lsr-id 2.2.2.2

[R2] mpls
[R2-mpls] quit

[R2] mpls ldp
[R2-mpls-ldp] quit

[R2] Interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0] mpls
[R2-GigabitEthernet0/0/0] mpls ldp
[R2] Interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1] mpls
[R2-GigabitEthernet0/0/1] mpls ldp

The configuration of R3 is as follows:

[R3] mpls lsr-id 3.3.3.3 
[R3] mpls
[R3-mpls] quit
[R3] mpls ldp
[R3-mpls-ldp] quit
[R3] Interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] mpls
[R3-GigabitEthernet0/0/0] mpls ldp
[R3] Interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1] mpls
[R3-GigabitEthernet0/0/1] mpls ldp

The configuration of R4 is as follows:

[R4] mpls lsr-id 4.4.4.4
[R4] mpls
[R4-mpls] quit
[R4] mpls ldp
[R4-mpls-ldp] quit
[R4] Interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0] mpls
[R4-GigabitEthernet0/0/0] mpls ldp

After completing the above configuration, let's do some inspection and verification:

[SW1] display mpls ldp peer
LDP Peer Information in Public network
A '*' before a peer means the peer is being deleted.
------------------------------------------------------------------------------
PeerID TransportAddress DiscoverySource
------------------------------------------------------------------------------
2.2.2.2:0 2.2.2.2 GigabitEthernet0/0/0
------------------------------------------------------------------------------
TOTAL: 1 Peer(s) Found.

The output above is the LDP neighbor table of R1. From the table, it can be seen that R1 has discovered an LDP neighbor, which is R2.

[SW1] display mpls ldp session
LDP Session(s) in Public Network
------------------------------------------------------------------------------
Peer LDP ID : 2.2.2.2:0 Local LDP ID : 1.1.1.1:0
TCP Connection : 1.1.1.1 <- 2.2.2.2
Session State : Operational Session Role : Passive
Session FT Flag : Off MD5 Flag : Off
Reconnect Timer : --- Recovery Timer : ---
Keychain Name : ---
Negotiated Keepalive Hold Timer : 45 Sec
Configured Keepalive Send Timer : ---
Keepalive Message Sent/Rcvd : 20/20 (Message Count)
Label Advertisement Mode : Downstream Unsolicited
Label Resource Status(Peer/Local) : Available/Available
Session Age : 0000:00:04 (DDDD:HH:MM)
Session Deletion Status : No
Capability:
Capability-Announcement : Off
P2MP Capability : Off
Outbound&Inbound Policies applied : NULL
Addresses received from peer: (Count: 3)
2.2.2.2 12.1.1.2 23.1.1.2
------------------------------------------------------------------------------

The above output is the detailed information of the LDP session. The state of the neighbor must be Operational to be the final stable state. In addition, it can be verified from the TCP connection 1.1.1.1 < 2.2.2.2 that the establishment of the LDP session is initiated by the party with the larger transmission address. of.

<R1> display mpls lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 3/NULL -/-
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3 -/GE0/0/0
3.3.3.3/32 NULL/1025 -/GE0/0/0
3.3.3.3/32 1025/1025 -/GE0/0/0
4.4.4.4/32 NULL/1026 -/GE0/0/0
4.4.4.4/32 1026/1026 -/GE0/0/0

The output above is the LFIB (Label Forwarding Information Base) of R1, and you can see the established LSP.

In fact, when we run OSPF on R1, R2, R3, and R4, the routing of the entire network has been opened, that is, each router has the routing of the entire network, including the routing of the Internet segment, and the loopback of each device. routing. Then we activate MPLS and LDP of each device, and each device will perform label binding based on the routing prefix in its own routing table, and distribute the label bundled with the routing prefix (FEC) to its own LDP neighbors. By default, on our equipment, labels are only distributed for /32 host routes, and the default split horizon rule is not enabled, so the label distribution between R2 and R3 may be as follows:

Now, to test it out, go to tracert 4.4.4.4 from R1:

<R1>tracert lsp ip 4.4.4.4 32
LSP Trace Route FEC: IPV4 PREFIX 4.4.4.4/32 , press CTRL_C to break.
TTL Replier Time Type Downstream
0 Ingress 12.1.1.2 / [1026]
1 12.1.1.2 200 ms Transit 23.1.1.3 / [1028]
2 23.1.1.3 170 ms Transit 34.1.1.4 / [3]
3 4.4.4.4 100 ms Egress

From the tracert results, we can see the path that the packet traveled and the label that was pushed.

The packet forwarding process is actually similar to the following:

Guess you like

Origin blog.csdn.net/weixin_43025343/article/details/132289864