Graceful-Restart

Scenario to verify BGP graceful-restart global parameter timers.

Graceful restart allows a BGP router to maintain forwarding state during a restart, minimizing traffic disruption. This test suite verifies the stalepath-time and restart-time global parameters that control how long stale routes are kept after a session goes down.

stalepath-time is configured on the helper and controls the maximum time stale paths are retained. restart-time is configured on the restarting peer and advertised to the helper, telling it how long to wait for the peer to restart before removing stale routes.

Test iBGP - Graceful restart stalepath-time controls stale route expiration

Description

Test that the global stalepath-time parameter controls how long the helper retains stale routes after the restarting peer goes down. DUT0 (helper) is configured with stalepath-time 15 (15 seconds). When DUT1 (restart mode) shuts down, DUT0 marks routes as stale. After 15 seconds the stale routes should be removed automatically, proving the timer works.

Scenario

Note

DUT0 is the helper with stalepath-time 15 seconds (default is 360 seconds). DUT1 is configured in graceful-restart restart mode.

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.10.0.100/24
set protocols bgp 20 neighbor peer graceful-restart helper
set protocols bgp 20 neighbor peer remote-address 10.10.0.200
set protocols bgp 20 neighbor peer remote-as 20
set protocols bgp 20 parameters graceful-restart stalepath-time 15
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces dummy dum0 address 1.1.1.1/24
set interfaces ethernet eth0 address 10.10.0.200/24
set protocols bgp 20 neighbor peer graceful-restart restart
set protocols bgp 20 neighbor peer remote-address 10.10.0.100
set protocols bgp 20 neighbor peer remote-as 20
set protocols bgp 20 redistribute connected
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Attention

Verify BGP session is established between DUT0 and DUT1.

Step 3: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:

10.10.0.200.*Established
Show output
IPv4 Unicast Summary:
BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0
BGP table version 2
RIB entries 3, using 384 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        LocalAddr       V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down        State   PfxRcd   PfxSnt Desc
10.10.0.200     10.10.0.100     4         20         5         4        2    0    0 00:00:02  Established        2        0 FRRouting/10.4.1

Total number of neighbors 1

Attention

Verify that DUT0 receives route 1.1.1.0/24 from DUT1.

Step 4: Run command protocols bgp show ip at DUT0 and check if output matches the following regular expressions:

1.1.1.0/24
Show output
BGP table version is 2, local router ID is 10.10.0.100, vrf id 0
Default local pref 100, local AS 20
local address -
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *ui 1.1.1.0/24       10.10.0.200              0    100      0 ?
 *ui 10.10.0.0/24     10.10.0.200              0    100      0 ?

Displayed 2 routes and 2 total paths

Attention

Verify graceful-restart capability is negotiated and stalepath-time is 15 seconds.

Step 5: Run command protocols bgp show ip neighbors at DUT0 and check if output matches the following regular expressions:

Graceful Restart Capability: advertised and received[\s\S]+Configured Stale Path Time\(sec\): 15
Show output
BGP neighbor is 10.10.0.200, remote AS 20, local AS 20, internal link
  Local Role: undefined
  Remote Role: undefined
Hostname: osdx
  BGP version 4, remote router ID 10.10.0.200, local router ID 10.10.0.100
  BGP state = Established, up for 00:00:02
  Last read 00:00:01, Last write 00:00:00
  Hold time is 90 seconds, keepalive interval is 30 seconds
  Configured hold time is 90 seconds, keepalive interval is 30 seconds
  Configured tcp-mss is 0, synced tcp-mss is 1448
  Configured conditional advertisements interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    AddPath:
      IPv4 Unicast: RX advertised and received
    Paths-Limit:
      IPv4 Unicast: advertised (0) and received (0)
    Long-lived Graceful Restart: advertised and received
      Address families by peer:
           IPv4 Unicast
    Route refresh: advertised and received
    Enhanced Route Refresh: advertised and received
    Address Family IPv4 Unicast: advertised and received
    Hostname Capability: advertised (name: osdx,domain name: n/a) received (name: osdx,domain name: n/a)
    Version Capability: advertised software version (FRRouting/10.4.1) received software version (FRRouting/10.4.1)
    Link-Local Next Hop Capability: not advertised not received
    Graceful Restart Capability: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        IPv4 Unicast(not preserved)
  Graceful restart information:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode: Helper
    Remote GR Mode: Restart
    R bit: True
    N bit: True
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 120
      Configured LLGR Stale Path Time(sec): 0
    IPv4 Unicast:
      F bit: False
      End-of-RIB sent: Yes
      End-of-RIB sent after update: Yes
      End-of-RIB received: Yes
      Timers:
        Configured Stale Path Time(sec): 15
        LLGR Stale Path Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  2          1
    Notifications:          0          0
    Updates:                1          3
    Keepalives:             1          1
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  4          5

  Prefix statistics:
    Inbound filtered: 0
    AS-PATH loop: 0
    Originator loop: 0
    Cluster loop: 0
    Invalid next-hop: 0
    Withdrawn: 0
    Attributes discarded: 0

  Minimum time between advertisement runs is 0 seconds

 For address family: IPv4 Unicast
  Update group 1, subgroup 1
  Packet Queue length 0
  Community attribute sent to this neighbor(all)
  2 accepted, 0 sent prefixes

  Connections established 1; dropped 0
  Last reset 00:00:04,  Waiting for peer OPEN (FRRouting/10.4.1)
  Internal BGP neighbor may be up to 255 hops away.
Local host: 10.10.0.100, Local port: 179
Foreign host: 10.10.0.200, Foreign port: 54488
Nexthop: 10.10.0.100
Nexthop global: fe80::dcad:beff:feef:6c00
Nexthop local: fe80::dcad:beff:feef:6c00
BGP connection: shared network
BGP Connect Retry Timer in Seconds: 30
Estimated round trip time: 0 ms
Read thread: on  Write thread: on  FD used: 25

Note

Shutdown BGP neighbor on DUT1 to trigger graceful restart on DUT0.

Step 6: Modify the following configuration lines in DUT1 :

set protocols bgp 20 neighbor peer shutdown

Attention

Verify session is down on DUT1.

Step 7: Run command protocols bgp show ip summary at DUT1 and check if output matches the following regular expressions:

10.10.0.100.*Idle \(Admin\)
Show output
IPv4 Unicast Summary:
BGP router identifier 10.10.0.200, local AS number 20 VRF default vrf-id 0
BGP table version 2
RIB entries 3, using 384 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        LocalAddr       V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down        State   PfxRcd   PfxSnt Desc
10.10.0.100     10.10.0.200     4         20         3         6        0    0    0 00:00:00 Idle (Admin)        0        0 FRRouting/10.4.1

Total number of neighbors 1

Attention

Verify that DUT0 has the route marked as stale (S flag) immediately after shutdown.

Step 8: Run command protocols bgp show ip at DUT0 and check if output matches the following regular expressions:

S.*1.1.1.0/24
Show output
BGP table version is 2, local router ID is 10.10.0.100, vrf id 0
Default local pref 100, local AS 20
local address -
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 S>i 1.1.1.0/24       10.10.0.200              0    100      0 ?
 S>i 10.10.0.0/24     10.10.0.200              0    100      0 ?

Displayed 2 routes and 2 total paths

Note

Wait for stalepath-time (15s) to expire plus margin.

Attention

Verify that stale route has been removed from DUT0 after stalepath-time expired.

Step 9: Run command protocols bgp show ip at DUT0 and check if output does not match the following regular expressions:

1.1.1.0/24
Show output
No BGP prefixes displayed, 0 exist

Test iBGP - Graceful restart restart-time controls helper wait period

Description

Test that the global restart-time parameter controls how long the helper waits for the restarting peer before removing stale routes. DUT0 (restart mode) is configured with restart-time 10 (10 seconds), which is advertised to DUT1 (helper). When DUT0 goes down, DUT1 should keep stale routes for only 10 seconds before removing them, proving the advertised timer is respected.

Scenario

Note

DUT0 is configured with restart-time 10 seconds (advertised to helper). DUT1 is the helper without custom stalepath-time.

Step 1: Set the following configuration in DUT0 :

set interfaces dummy dum0 address 1.1.1.1/24
set interfaces ethernet eth0 address 10.10.0.100/24
set protocols bgp 20 neighbor peer graceful-restart restart
set protocols bgp 20 neighbor peer remote-address 10.10.0.200
set protocols bgp 20 neighbor peer remote-as 20
set protocols bgp 20 parameters graceful-restart restart-time 10
set protocols bgp 20 redistribute connected
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.10.0.200/24
set protocols bgp 20 neighbor peer graceful-restart helper
set protocols bgp 20 neighbor peer remote-address 10.10.0.100
set protocols bgp 20 neighbor peer remote-as 20
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Attention

Verify BGP session is established between DUT0 and DUT1.

Step 3: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:

10.10.0.200.*Established
Show output
IPv4 Unicast Summary:
BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0
BGP table version 2
RIB entries 3, using 384 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        LocalAddr       V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down        State   PfxRcd   PfxSnt Desc
10.10.0.200     10.10.0.100     4         20         3         6        2    0    0 00:00:02  Established        0        2 FRRouting/10.4.1

Total number of neighbors 1

Attention

Verify that DUT1 receives route 1.1.1.0/24 from DUT0.

Step 4: Run command protocols bgp show ip at DUT1 and check if output matches the following regular expressions:

1.1.1.0/24
Show output
BGP table version is 2, local router ID is 10.10.0.200, vrf id 0
Default local pref 100, local AS 20
local address -
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *ui 1.1.1.0/24       10.10.0.100              0    100      0 ?
 *ui 10.10.0.0/24     10.10.0.100              0    100      0 ?

Displayed 2 routes and 2 total paths

Attention

Verify graceful-restart capability is negotiated.

Step 5: Run command protocols bgp show ip neighbors at DUT0 and check if output matches the following regular expressions:

Graceful Restart Capability: advertised and received
Show output
BGP neighbor is 10.10.0.200, remote AS 20, local AS 20, internal link
  Local Role: undefined
  Remote Role: undefined
Hostname: osdx
  BGP version 4, remote router ID 10.10.0.200, local router ID 10.10.0.100
  BGP state = Established, up for 00:00:02
  Last read 00:00:01, Last write 00:00:01
  Hold time is 90 seconds, keepalive interval is 30 seconds
  Configured hold time is 90 seconds, keepalive interval is 30 seconds
  Configured tcp-mss is 0, synced tcp-mss is 1448
  Configured conditional advertisements interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    AddPath:
      IPv4 Unicast: RX advertised and received
    Paths-Limit:
      IPv4 Unicast: advertised (0) and received (0)
    Long-lived Graceful Restart: advertised and received
      Address families by peer:
    Route refresh: advertised and received
    Enhanced Route Refresh: advertised and received
    Address Family IPv4 Unicast: advertised and received
    Hostname Capability: advertised (name: osdx,domain name: n/a) received (name: osdx,domain name: n/a)
    Version Capability: advertised software version (FRRouting/10.4.1) received software version (FRRouting/10.4.1)
    Link-Local Next Hop Capability: not advertised not received
    Graceful Restart Capability: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        none
  Graceful restart information:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode: Restart
    Remote GR Mode: Helper
    R bit: True
    N bit: True
    Timers:
      Configured Restart Time(sec): 10
      Received Restart Time(sec): 120
      Configured LLGR Stale Path Time(sec): 0
    IPv4 Unicast:
      F bit: False
      End-of-RIB sent: Yes
      End-of-RIB sent after update: Yes
      End-of-RIB received: Yes
      Timers:
        Configured Stale Path Time(sec): 360
        Configured Selection Deferral Time(sec): 360
        LLGR Stale Path Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  2          1
    Notifications:          0          0
    Updates:                3          1
    Keepalives:             1          1
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  6          3

  Prefix statistics:
    Inbound filtered: 0
    AS-PATH loop: 0
    Originator loop: 0
    Cluster loop: 0
    Invalid next-hop: 0
    Withdrawn: 0
    Attributes discarded: 0

  Minimum time between advertisement runs is 0 seconds

 For address family: IPv4 Unicast
  Update group 1, subgroup 1
  Packet Queue length 0
  Community attribute sent to this neighbor(all)
  0 accepted, 2 sent prefixes

  Connections established 1; dropped 0
  Last reset never
  Internal BGP neighbor may be up to 255 hops away.
Local host: 10.10.0.100, Local port: 179
Foreign host: 10.10.0.200, Foreign port: 40780
Nexthop: 10.10.0.100
Nexthop global: fe80::dcad:beff:feef:6c00
Nexthop local: fe80::dcad:beff:feef:6c00
BGP connection: shared network
BGP Connect Retry Timer in Seconds: 30
Estimated round trip time: 0 ms
Read thread: on  Write thread: on  FD used: 25

Attention

Verify that DUT1 sees the received restart timer of 10 seconds from DUT0.

Step 6: Run command protocols bgp show ip neighbors at DUT1 and check if output contains the following tokens:

Remote Restart timer is 10 seconds
Show output
BGP neighbor is 10.10.0.100, remote AS 20, local AS 20, internal link
  Local Role: undefined
  Remote Role: undefined
Hostname: osdx
  BGP version 4, remote router ID 10.10.0.100, local router ID 10.10.0.200
  BGP state = Established, up for 00:00:02
  Last read 00:00:01, Last write 00:00:01
  Hold time is 90 seconds, keepalive interval is 30 seconds
  Configured hold time is 90 seconds, keepalive interval is 30 seconds
  Configured tcp-mss is 0, synced tcp-mss is 1448
  Configured conditional advertisements interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    AddPath:
      IPv4 Unicast: RX advertised and received
    Paths-Limit:
      IPv4 Unicast: advertised (0) and received (0)
    Long-lived Graceful Restart: advertised and received
      Address families by peer:
           IPv4 Unicast
    Route refresh: advertised and received
    Enhanced Route Refresh: advertised and received
    Address Family IPv4 Unicast: advertised and received
    Hostname Capability: advertised (name: osdx,domain name: n/a) received (name: osdx,domain name: n/a)
    Version Capability: advertised software version (FRRouting/10.4.1) received software version (FRRouting/10.4.1)
    Link-Local Next Hop Capability: not advertised not received
    Graceful Restart Capability: advertised and received
      Remote Restart timer is 10 seconds
      Address families by peer:
        IPv4 Unicast(not preserved)
  Graceful restart information:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode: Helper
    Remote GR Mode: Restart
    R bit: True
    N bit: True
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 10
      Configured LLGR Stale Path Time(sec): 0
    IPv4 Unicast:
      F bit: False
      End-of-RIB sent: Yes
      End-of-RIB sent after update: Yes
      End-of-RIB received: Yes
      Timers:
        Configured Stale Path Time(sec): 360
        LLGR Stale Path Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                1          3
    Keepalives:             1          1
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  3          5

  Prefix statistics:
    Inbound filtered: 0
    AS-PATH loop: 0
    Originator loop: 0
    Cluster loop: 0
    Invalid next-hop: 0
    Withdrawn: 0
    Attributes discarded: 0

  Minimum time between advertisement runs is 0 seconds

 For address family: IPv4 Unicast
  Update group 1, subgroup 1
  Packet Queue length 0
  Community attribute sent to this neighbor(all)
  2 accepted, 0 sent prefixes

  Connections established 1; dropped 0
  Last reset 00:00:03,  Waiting for peer OPEN (FRRouting/10.4.1)
  Internal BGP neighbor may be up to 255 hops away.
Local host: 10.10.0.200, Local port: 40780
Foreign host: 10.10.0.100, Foreign port: 179
Nexthop: 10.10.0.200
Nexthop global: ::
Nexthop local: ::
BGP connection: shared network
BGP Connect Retry Timer in Seconds: 30
Estimated round trip time: 0 ms
Read thread: on  Write thread: on  FD used: 25

Note

Shutdown BGP neighbor on DUT0 to trigger graceful restart on DUT1.

Step 7: Modify the following configuration lines in DUT0 :

set protocols bgp 20 neighbor peer shutdown

Attention

Verify session is down on DUT0.

Step 8: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:

10.10.0.200.*Idle \(Admin\)
Show output
IPv4 Unicast Summary:
BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0
BGP table version 2
RIB entries 3, using 384 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        LocalAddr       V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down        State   PfxRcd   PfxSnt Desc
10.10.0.200     10.10.0.100     4         20         3         7        0    0    0 00:00:01 Idle (Admin)        0        0 FRRouting/10.4.1

Total number of neighbors 1

Attention

Verify that DUT1 has the route marked as stale (S flag) immediately after shutdown.

Step 9: Run command protocols bgp show ip at DUT1 and check if output matches the following regular expressions:

S.*1.1.1.0/24
Show output
BGP table version is 2, local router ID is 10.10.0.200, vrf id 0
Default local pref 100, local AS 20
local address -
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 S>i 1.1.1.0/24       10.10.0.100              0    100      0 ?
 S>i 10.10.0.0/24     10.10.0.100              0    100      0 ?

Displayed 2 routes and 2 total paths

Note

Wait for restart-time (10s) to expire plus margin.

Attention

Verify that stale route has been removed after restart-time expired.

Step 10: Run command protocols bgp show ip at DUT1 and check if output does not match the following regular expressions:

1.1.1.0/24
Show output
No BGP prefixes displayed, 0 exist