Unetlab: Backup static route is not used when peer router’s interface is down

Topology

bfd

Background
In GNS3 or in unetlab when the peer router’s (seemed) directly connected interface is down, your local router interface is still up. This is because the so-call directly connected is connected via a virtual bridge.

In this lab I have created floating static route to simulate uRPF scenario, however because R1 does not know that R2’s ethernet0/0 interface was shutdown, R1’s ethernet0/0 is still up and hence the primary static route is still installed in the routing table causing traffic destined to 1.1.1.1 is blackholed.


!R1's primary route is still in the routing table despite R2's e0/0 was shutdown.
!R1 is configured to use the secondary static route if 1.1.1.1 is not reachable via !192.168.1.2 (which is R2's e0/0)

ip route 1.1.1.1 255.255.255.255 192.168.1.2 name "via R2 e0/0"
ip route 1.1.1.1 255.255.255.255 192.168.1.6 2 name "via R2 e0/1"
R1#
R1#sh ip route static
      1.0.0.0/32 is subnetted, 1 subnets
S        1.1.1.1 [1/0] via 192.168.1.2, Ethernet0/0
R1#

R1#sh ip int brief | in 0/0
Ethernet0/0                192.168.1.1     YES NVRAM  up                    up  

The solution is to used Bidirectional forwarding detection on static routes

1. R1 and R2 needs to have the BFD configured in order to form BFD neighborship.
2. R1 and R2 interface has to configure BFD timers.
3. BFD echo is enabled by default per router’s interface.
4. Configure BFD for static route
5. Configure static route and specify the exit interface.


R1#sh run int e0/0

!Configure BFD timer. This means transmit every 50ms and receive every 50ms
!If BFD timer exceeds 250ms the BFD neighbor is declared dead.
interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.252
 no ip redirects
 bfd interval 50 min_rx 50 multiplier 5
end

R1#sh run | in ip route static
!Configure the bfd for static route neighbor
ip route static bfd Ethernet0/0 192.168.1.2
ip route static bfd Ethernet0/1 192.168.1.6

R1#sh run | in ip route
!Specifies the ip static route bfd neighbor.
ip route 1.1.1.1 255.255.255.255 Ethernet0/0 192.168.1.2
ip route 1.1.1.1 255.255.255.255 Ethernet0/1 192.168.1.6 2

When the BFD neighbor is formed you will see this syslog message:


R1#
*Feb 21 17:33:26.226: %BFDFSM-6-BFD_SESS_UP: BFD-SYSLOG: BFD session ld:1 handle:1 is going UP

Verification


R1#sh bfd neighbors

IPv4 Sessions
NeighAddr                              LD/RD         RH/RS     State     Int
192.168.1.2                             1/1          Up        Up        Et0/0
192.168.1.6                             2/2          Up        Up        Et0/1
R1#

When R2 shutsdown e0/0, R1 should use the secondary route.


R1#
*Feb 21 17:59:48.504: %BFDFSM-6-BFD_SESS_DOWN: BFD-SYSLOG: BFD session ld:1 handle:1,is going Down Reason: ECHO FAILURE

R1#sh ip route static

      1.0.0.0/32 is subnetted, 1 subnets
S        1.1.1.1 [2/0] via 192.168.1.6, Ethernet0/1
R1#
Advertisement

One thought on “Unetlab: Backup static route is not used when peer router’s interface is down

  1. Hi which GNS image you used on router… because in my lab simulation ip route static is not coming.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s