Example for Configuring Synchronization Between LDP and Static Routes
Networking Requirements
On an MPLS network with primary and backup LSPs, LSPs are established between LSRs based on static routes. When the primary LDP session on the primary LSP fails (not due to a link fault) or the primary LSP is restored, MPLS traffic is interrupted for a short period of time. This is because static routes and LDP are not synchronized.
As shown in Figure 3-29, LSRA has static routes that are destined for LSRD and pass LSRB and LSRC. An LDP session is established on LSRA. LinkA is the primary LSP, while LinkB is the backup LSP. The MPLS traffic needs to be uninterrupted when the LDP session on LinkA fails or LinkA is restored from a fault.
Configuration Roadmap
To meet the preceding requirements, configure synchronization between LDP and static routes. The configuration roadmap is as follows:
Configure synchronization between LDP and static routes on LSRA and LSRD, and set the value of Hold-down timer to 20s.
Procedure
- Configure IP addresses for interfaces.
# Configure LSRA. The configurations of LSRB, LSRC, and LSRD are similar to the configuration of LSRA, and are not mentioned here.
<Huawei> system-view [Huawei] sysname LSRA [LSRA] interface loopback 0 [LSRA-LoopBack0] ip address 10.10.1.1 32 [LSRA-LoopBack0] quit [LSRA] interface gigabitethernet 1/0/0 [LSRA-GigabitEthernet1/0/0] ip address 10.1.1.1 30 [LSRA-GigabitEthernet1/0/0] quit [LSRA] interface gigabitethernet 2/0/0 [LSRA-GigabitEthernet2/0/0] ip address 10.2.1.1 30 [LSRA-GigabitEthernet2/0/0] quit
- Configure static routes for nodes to make the network connected.
# Configure two static routes with different priorities from LSRA to LSRD. Configure two static routes with different priorities from LSRD to LSRA.
# Configure LSRA.
[LSRA] ip route-static 10.10.1.2 32 10.1.1.2 [LSRA] ip route-static 10.10.1.3 32 10.2.1.2 [LSRA] ip route-static 10.3.1.1 30 10.1.1.2 [LSRA] ip route-static 10.4.1.1 30 10.2.1.2 [LSRA] ip route-static 10.10.1.4 32 10.1.1.2 preference 40 [LSRA] ip route-static 10.10.1.4 32 10.2.1.2 preference 60
# Configure LSRB.
[LSRB] ip route-static 10.10.1.1 32 10.1.1.1 [LSRB] ip route-static 10.10.1.4 32 10.3.1.2
# Configure LSRC.
[LSRC] ip route-static 10.10.1.1 32 10.2.1.1 [LSRC] ip route-static 10.10.1.4 32 10.4.1.2
# Configure LSRD.
[LSRD] ip route-static 10.10.1.2 32 10.3.1.1 [LSRD] ip route-static 10.10.1.3 32 10.4.1.1 [LSRD] ip route-static 10.1.1.2 30 10.3.1.1 [LSRD] ip route-static 10.2.1.2 30 10.4.1.1 [LSRD] ip route-static 10.10.1.1 32 10.3.1.1 preference 40 [LSRD] ip route-static 10.10.1.1 32 10.4.1.1 preference 60
# Run the display ip routing-table protocol static command on each node to check the configured static routes. Use the display on LSRA as an example.
[LSRA] display ip routing-table protocol static Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Public routing table : Static Destinations : 5 Routes : 6 Configured Routes : 6 Static routing table status : <Active> Destinations : 5 Routes : 5 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.10.1.2/32 Static 60 0 RD 10.1.1.2 GigabitEthernet1/0/0 10.10.1.3/32 Static 60 0 RD 10.2.1.2 GigabitEthernet2/0/0 10.10.1.4/32 Static 40 0 RD 10.1.1.2 GigabitEthernet1/0/0 10.3.1.0/30 Static 60 0 RD 10.1.1.2 GigabitEthernet1/0/0 10.4.1.0/30 Static 60 0 RD 10.2.1.2 GigabitEthernet2/0/0 Static routing table status : <Inactive> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.10.1.4/32 Static 60 0 D 10.2.1.2 GigabitEthernet2/0/0
- Enable MPLS LDP on LSRs and establish an LDP LSP.
# Configure LSRA. The configurations of LSRB, LSRC, and LSRD are similar to the configuration of LSRA, and are not mentioned here.
[LSRA] mpls lsr-id 10.10.1.1 [LSRA] mpls [LSRA-mpls] quit [LSRA] mpls ldp [LSRA-mpls-ldp] quit [LSRA] interface gigabitethernet 1/0/0 [LSRA-GigabitEthernet1/0/0] mpls [LSRA-GigabitEthernet1/0/0] mpls ldp [LSRA-GigabitEthernet1/0/0] quit [LSRA] interface gigabitethernet 2/0/0 [LSRA-GigabitEthernet2/0/0] mpls [LSRA-GigabitEthernet2/0/0] mpls ldp [LSRA-GigabitEthernet2/0/0] quit
# Run the display mpls ldp session command on each node. The command output shows that the LDP session is established and status is Operational. LSRA is used as an example.
[LSRA] display mpls ldp session LDP Session(s) in Public Network Codes: 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 ------------------------------------------------------------------------------ 10.10.1.2:0 Operational DU Passive 0000:00:00 1/1 10.10.1.3:0 Operational DU Passive 0000:00:02 12/12 ------------------------------------------------------------------------------ TOTAL: 2 session(s) Found.
- Configure synchronization between LDP and static routes
on LSRA and LSRD.
# Configure LSRA.
[LSRA] ip route-static 10.10.1.4 32 gigabitethernet 1/0/0 ldp-sync [LSRA] interface gigabitethernet 1/0/0 [LSRA-GigabitEthernet1/0/0] static-route timer ldp-sync hold-down 20 [LSRA-GigabitEthernet1/0/0] quit
# Configure LSRD.
[LSRD] ip route-static 10.10.1.1 32 gigabitethernet 1/0/0 ldp-sync [LSRD] interface gigabitethernet 1/0/0 [LSRD-GigabitEthernet1/0/0] static-route timer ldp-sync hold-down 20 [LSRD-GigabitEthernet1/0/0] quit
- Verify the configuration.
# Check the status of the outbound interface specified by static routes that are synchronized with LDP.
[LSRA] display static-route ldp-sync Total number of routes enable Ldp-Sync: 1 ----------------------------------------------------- Interface GigabitEthernet1/0/0 Enable ldp-sync static routes number: 1 Static-route ldp-sync holddown timer: 20s Sync state: Normal Dest = 10.10.1.4, Mask = 32, NextHop = 10.1.1.1. -----------------------------------------------------
The command output shows that synchronization between LDP and static routes is configured and synchronization status is Normal.
If the LDP session on LinkA fails, traffic is immediately switched to LinkB, ensuring uninterrupted traffic transmission.
When LinkA is restored from the fault, the static route whose next hop IP address is 10.1.1.1 is not used immediately. Only when the Hold-down timer expires after 20s, the LDP session on LinkA is established. The static route whose next hop IP address is 10.1.1.1 is activated. The static route and LDP are synchronized and MPLS traffic transmission is not interrupted.
Configuration Files
LSRA configuration file
# sysname LSRA # mpls lsr-id 10.10.1.1 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.1.1.1 255.255.255.252 static-route timer ldp-sync hold-down 20 mpls mpls ldp # interface GigabitEthernet2/0/0 ip address 10.2.1.1 255.255.255.252 mpls mpls ldp # interface loopback0 ip address 10.10.1.1 255.255.255.255 # ip route-static 10.10.1.2 255.255.255.255 10.1.1.2 ip route-static 10.10.1.3 255.255.255.255 10.2.1.2 ip route-static 10.10.1.4 255.255.255.255 10.1.1.2 preference 40 ip route-static 10.10.1.4 255.255.255.255 10.2.1.2 ip route-static 10.10.1.4 255.255.255.255 GigabitEthernet1/0/0 ldp-sync ip route-static 10.3.1.0 255.255.255.252 10.1.1.2 ip route-static 10.4.1.0 255.255.255.252 10.2.1.2 # return
LSRB configuration file
# sysname LSRB # mpls lsr-id 10.10.1.2 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.1.1.2 255.255.255.252 mpls mpls ldp # interface GigabitEthernet2/0/0 ip address 10.3.1.1 255.255.255.252 mpls mpls ldp # interface loopback0 ip address 10.10.1.2 255.255.255.255 # ip route-static 10.10.1.1 255.255.255.255 10.1.1.1 ip route-static 10.10.1.4 255.255.255.255 10.3.1.2 # return
LSRC configuration file
# sysname LSRC # mpls lsr-id 10.10.1.3 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.2.1.2 255.255.255.252 mpls mpls ldp # interface GigabitEthernet2/0/0 ip address 10.4.1.1 255.255.255.252 mpls mpls ldp # interface loopback0 ip address 10.10.1.3 255.255.255.255 # ip route-static 10.10.1.1 255.255.255.255 10.2.1.1 ip route-static 10.10.1.4 255.255.255.255 10.4.1.2 # return
LSRD configuration file
# sysname LSRD # mpls lsr-id 10.10.1.4 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.3.1.2 255.255.255.252 static-route timer ldp-sync hold-down 20 mpls mpls ldp # interface GigabitEthernet2/0/0 ip address 10.4.1.2 255.255.255.252 mpls mpls ldp # interface loopback0 ip address 10.10.1.4 255.255.255.255 # ip route-static 10.10.1.1 255.255.255.255 10.3.1.1 preference 40 ip route-static 10.10.1.1 255.255.255.255 10.4.1.1 ip route-static 10.10.1.1 255.255.255.255 GigabitEthernet1/0/0 ldp-sync ip route-static 10.10.1.2 255.255.255.255 10.3.1.1 ip route-static 10.10.1.3 255.255.255.255 10.4.1.1 ip route-static 10.1.1.0 255.255.255.252 10.3.1.1 ip route-static 10.2.1.0 255.255.255.252 10.4.1.1 # return