Example: Configuring static routing-Track-LLDP collaboration
Network requirements
As shown in Figure 65:
Device A is the default gateway of the hosts in network 20.1.1.0/24.
Device B is the default gateway of the hosts in network 30.1.1.0/24.
Hosts in the two networks communicate with each other through static routes.
To ensure network availability, configure route backup and static routing-Track-LLDP collaboration on Device A and Device B as follows:
On Device A, assign a higher priority to the static route to 30.1.1.0/24 with next hop Device B. This route is the master route. The static route to 30.1.1.0/24 with next hop Device C acts as the backup route. When the master route is unavailable, the backup route takes effect. Device A forwards packets destined for 30.1.1.0/24 to Device C.
On Device B, assign a higher priority to the static route to 20.1.1.0/24 with next hop Device A. This route is the master route. The static route to 20.1.1.0/24 with next hop Device C acts as the backup route. When the master route is unavailable, the backup route takes effect. Device B forwards packets destined for 20.1.1.0/24 to Device C.
Figure 65: Network diagram
Procedure
![]() | IMPORTANT: By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface. | |
Configure the IP address of each interface, as shown in Figure 65. (Details not shown.)
Configure Device A:
# Configure a static route to 30.1.1.0/24 with next hop 10.1.1.2 and the default priority (60). Associate this static route with track entry 1.
<DeviceA> system-view [DeviceA] ip route-static 30.1.1.0 24 10.2.1.2 track 1
# Configure a static route to 30.1.1.0/24 with next hop 10.3.1.3 and priority 80.
[DeviceA] ip route-static 30.1.1.0 24 10.3.1.3 preference 80
# Enable LLDP globally.
[DeviceA] lldp global enable
# Enable LLDP on FortyGigE 1/0/1. (This step is optional because LLDP is enabled on the port by default.)
[DeviceA] interface fortygige 1/0/1 [DeviceA-FortyGigE1/0/1] lldp enable
# Configure track entry 1 and associate it with the availability of the neighbor for LLDP interface Gigabitethernet 1/0/1.
[DeviceA] track 1 lldp neighbor interface fortygige 1/0/1
Configure Device B:
# Configure a static route to 20.1.1.0/24 with next hop 10.2.1.1 and the default priority (60). Associate this static route with track entry 1.
<DeviceB> system-view [DeviceB] ip route-static 20.1.1.0 24 10.2.1.1 track 1
# Configure a static route to 20.1.1.0/24 with next hop 10.4.1.3 and priority 80.
[DeviceB] ip route-static 20.1.1.0 24 10.4.1.3 preference 80
# Enable LLDP globally.
[DeviceB] lldp global enable
# Enable LLDP on FortyGigE 1/0/1. (This step is optional because LLDP is enabled on the port by default.)
[DeviceB] interface fortygige 1/0/1 [DeviceB-FortyGigE1/0/1] lldp enable
# Configure track entry 1 and associate it with the availability of the neighbor for LLDP interface FortyGigE 1/0/1.
[DeviceB] track 1 lldp neighbor interface fortygige 1/0/1
Configure Device C:
# Configure a static route to 30.1.1.0/24 with next hop 10.4.1.2.
<DeviceC> system-view [DeviceC] ip route-static 30.1.1.0 24 10.4.1.2
# Configure a static route to 20.1.1.0/24 with next hop 10.3.1.1.
[DeviceC] ip route-static 20.1.1.0 24 10.3.1.1
Verifying the configuration
# Display track entry information on Device A.
[DeviceA] display track all Track ID: 1 State: Positive Duration: 0 days 0 hours 0 minutes 32 seconds Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: LLDP interface: FortyGigE1/0/1
The output shows that the status of track entry 1 is Positive, indicating that the neighbor of LLDP interface FortyGigE 1/0/1 is available. The master route takes effect.
# Display the routing table of Device A.
[DeviceA] display ip routing-table Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost NextHop Interface 10.2.1.0/24 Direct 0 0 10.2.1.1 FGE1/0/1 10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0 10.3.1.0/24 Direct 0 0 10.3.1.1 FGE1/0/2 10.3.1.1/32 Direct 0 0 127.0.0.1 InLoop0 20.1.1.0/24 Direct 0 0 20.1.1.1 20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0 30.1.1.0/24 Static 60 0 10.2.1.2 FGE1/0/1 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The output shows that Device A forwards packets to 30.1.1.0/24 through Device B.
# On Device B, disable LLDP on FortyGigE 1/0/1.
<DeviceB> system-view [DeviceB] interface fortygige 1/0/1 [DeviceB-FortyGigE1/0/1] undo lldp enable
# Display track entry information on Device A.
[DeviceA] display track all Track ID: 1 State: Negative Duration: 0 days 0 hours 0 minutes 32 seconds Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: LLDP interface: FortyGigE1/0/1
The output shows that the status of track entry 1 is Negative, indicating that the neighbor of LLDP interface FortyGigE 1/0/1 is unavailable. The master route fails.
# Display the routing table of Device A.
[DeviceA] display ip routing-table Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost NextHop Interface 10.2.1.0/24 Direct 0 0 10.2.1.1 10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0 10.3.1.0/24 Direct 0 0 10.3.1.1 FGE1/0/2 10.3.1.1/32 Direct 0 0 127.0.0.1 InLoop0 20.1.1.0/24 Direct 0 0 20.1.1.1 FGE1/0/3 20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0 30.1.1.0/24 Static 80 0 10.3.1.3 FGE1/0/2 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The output shows that Device A forwards packets destined for 30.1.1.0/24 to Device C. The backup static route has taken effect.
# Verify that hosts in 20.1.1.0/24 can communicate with the hosts in 30.1.1.0/24 when the master route fails.
[DeviceA] ping -a 20.1.1.1 30.1.1.1 Ping 30.1.1.1: 56 data bytes, press CTRL_C to break Reply from 30.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms Reply from 30.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 30.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 30.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms Reply from 30.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- Ping statistics for 30.1.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.00% packet loss round-trip min/avg/max/std-dev = 1/1/2/1 ms
# Verify that the hosts in 30.1.1.0/24 can communicate with the hosts in 20.1.1.0/24 when the master route fails.
[DeviceB] ping -a 30.1.1.1 20.1.1.1 Ping 20.1.1.1: 56 data bytes, press CTRL_C to break Reply from 20.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms Reply from 20.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- Ping statistics for 20.1.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.00% packet loss round-trip min/avg/max/std-dev = 1/1/2/1 ms