github.com/osrg/gobgp/v3@v3.30.0/docs/sources/graceful-restart.md (about) 1 # Graceful Restart 2 3 This page explains how to configure [Graceful Restart](https://tools.ietf.org/html/rfc4724), 4 [Graceful Restart Notification Support](https://tools.ietf.org/html/rfc8538) and 5 [Long Lived Graceful Restart](https://tools.ietf.org/html/draft-uttaro-idr-bgp-persistence-02). 6 Graceful Restart has two sides. One is restarting speaker which does restart, 7 the other is receiving speaker (helper speaker) which helps a restarting speaker 8 to do graceful restart. GoBGP supports both roles. 9 10 ## Contents 11 12 - [Helper speaker](#helper-speaker) 13 - [Restarting speaker](#restarting-speaker) 14 - [Graceful Restart Notification Support](#graceful-restart-notification-support) 15 - [Long Lived Graceful Restart](#long-lived-graceful-restart) 16 - [Long Lived Graceful Restart Helper Speaker Configuration](#long-lived-graceful-restart-helper-speaker-configuration) 17 - [Long Lived Graceful Restart Restarting Speaker Configuration](#long-lived-graceful-restart-restarting-speaker-configuration) 18 - [Combination with normal Graceful Restart](#combination-with-normal-graceful-restart) 19 20 ## Helper speaker 21 22 Below is the configuration to enable helper speaker behavior. 23 24 ```toml 25 [global.config] 26 as = 64512 27 router-id = "192.168.255.1" 28 29 [[neighbors]] 30 [neighbors.config] 31 neighbor-address = "10.0.255.1" 32 peer-as = 65001 33 [neighbors.graceful-restart.config] 34 enabled = true 35 ``` 36 37 Check graceful restart capability is negotiated. 38 39 ```shell 40 $ gobgp n 10.0.255.1 41 BGP neighbor is 10.0.255.1, remote AS 65001 42 BGP version 4, remote router ID 192.168.0.2 43 BGP state = BGP_FSM_ESTABLISHED, up for 00:00:36 44 BGP OutQ = 0, Flops = 0 45 Hold time is 0, keepalive interval is 30 seconds 46 Configured hold time is 90, keepalive interval is 30 seconds 47 Neighbor capabilities: 48 BGP_CAP_MULTIPROTOCOL: 49 RF_IPv4_UC: advertised and received 50 BGP_CAP_ROUTE_REFRESH: advertised and received 51 BGP_CAP_GRACEFUL_RESTART: advertised and received 52 Remote: restart time 90 sec 53 RF_IPv4_UC 54 BGP_CAP_FOUR_OCTET_AS_NUMBER: advertised and received 55 Message statistics: 56 Sent Rcvd 57 Opens: 1 1 58 Notifications: 0 0 59 Updates: 2 1 60 Keepalives: 2 2 61 Route Refresh: 0 0 62 Discarded: 0 0 63 Total: 5 4 64 Route statistics: 65 Advertised: 1 66 Received: 0 67 Accepted: 0 68 ``` 69 70 ## Restarting speaker 71 72 To support restarting speaker behavior, try the configuration below. 73 74 ```toml 75 [global.config] 76 as = 64512 77 router-id = "192.168.255.1" 78 79 [[neighbors]] 80 [neighbors.config] 81 neighbor-address = "10.0.255.1" 82 peer-as = 65001 83 [neighbors.graceful-restart.config] 84 enabled = true 85 restart-time = 120 86 [[neighbors.afi-safis]] 87 [neighbors.afi-safis.config] 88 afi-safi-name = "ipv4-unicast" 89 [neighbors.afi-safis.mp-graceful-restart.config] 90 enabled = true 91 ``` 92 93 By this configuration, if graceful restart capability is negotiated with the peer, 94 the peer starts graceful restart helper procedure, when `gobgpd` dies involuntarily or 95 `SIGINT`, `SIGKILL` signal is sent to `gobgpd`. 96 Note when `SIGTERM` signal is sent to `gobgpd`, graceful restart negotiated peers 97 don't start graceful restart helper procedure, since `gobgpd` sends notification 98 messages to these peers before it die. 99 100 When you restart `gobgpd`, add `-r` option to let peers know `gobgpd` is 101 recovered from graceful restart. 102 103 ```shell 104 $ gobgpd -f gobgpd.conf -r 105 ``` 106 107 Let's see how capability negotiation changes. 108 109 ```shell 110 $ gobgp n 10.0.255.1 111 BGP neighbor is 10.0.255.1, remote AS 65001 112 BGP version 4, remote router ID 192.168.0.2 113 BGP state = BGP_FSM_ESTABLISHED, up for 00:00:03 114 BGP OutQ = 0, Flops = 0 115 Hold time is 0, keepalive interval is 30 seconds 116 Configured hold time is 90, keepalive interval is 30 seconds 117 Neighbor capabilities: 118 BGP_CAP_MULTIPROTOCOL: 119 RF_IPv4_UC: advertised and received 120 BGP_CAP_ROUTE_REFRESH: advertised and received 121 BGP_CAP_GRACEFUL_RESTART: advertised and received 122 Local: restart time 90 sec, restart flag set 123 RF_IPv4_UC, forward flag set 124 Remote: restart time 90 sec 125 RF_IPv4_UC 126 BGP_CAP_FOUR_OCTET_AS_NUMBER: advertised and received 127 Message statistics: 128 Sent Rcvd 129 Opens: 1 1 130 Notifications: 0 0 131 Updates: 2 1 132 Keepalives: 1 1 133 Route Refresh: 0 0 134 Discarded: 0 0 135 Total: 4 3 136 Route statistics: 137 Advertised: 1 138 Received: 0 139 Accepted: 0 140 ``` 141 142 You can see `restart flag` and `forward flag` is set. 143 144 Without `-r` option, the peers which are under helper procedure will 145 immediately withdraw all routes which were advertised from `gobgpd`. 146 147 Also, when `gobgpd` doesn't recovered within `restart-time`, the peers will 148 withdraw all routes. 149 Default value of `restart-time` is equal to `hold-time`. 150 151 ## Graceful Restart Notification Support 152 153 [RFC4724](https://tools.ietf.org/html/rfc4724) specifies gracful restart procedures are triggered only when 154 the BGP session between graceful restart capable peers turns down without 155 a notification message for backward compatibility. 156 [Graceful Restart Notification Support](https://tools.ietf.org/html/rfc8538) 157 expands this to trigger graceful restart procedures also with a notification message. 158 To turn on this feature, add `notification-enabled = true` to configuration like below. 159 160 ```toml 161 [global.config] 162 as = 64512 163 router-id = "192.168.255.1" 164 165 [[neighbors]] 166 [neighbors.config] 167 neighbor-address = "10.0.255.1" 168 peer-as = 65001 169 [neighbors.graceful-restart.config] 170 enabled = true 171 notification-enabled = true 172 ``` 173 174 ## Long Lived Graceful Restart 175 176 ### Long Lived Graceful Restart Helper Speaker Configuration 177 178 ```toml 179 [global.config] 180 as = 64512 181 router-id = "192.168.255.1" 182 183 [[neighbors]] 184 [neighbors.config] 185 neighbor-address = "10.0.255.1" 186 peer-as = 65001 187 [neighbors.graceful-restart.config] 188 enabled = true 189 long-lived-enabled = true 190 ``` 191 192 ### Long Lived Graceful Restart Restarting Speaker Configuration 193 194 Unlike normal graceful restart, long-lived graceful restart supports 195 restart-time as per address family. 196 197 ```toml 198 [global.config] 199 as = 64512 200 router-id = "192.168.255.1" 201 202 [[neighbors]] 203 [neighbors.config] 204 neighbor-address = "10.0.255.1" 205 peer-as = 65001 206 [neighbors.graceful-restart.config] 207 enabled = true 208 long-lived-enabled = true 209 [[neighbors.afi-safis]] 210 [neighbors.afi-safis.config] 211 afi-safi-name = "ipv4-unicast" 212 [neighbors.afi-safis.long-lived-graceful-restart.config] 213 enabled = true 214 restart-time = 100000 215 ``` 216 217 ### Combination with normal Graceful Restart 218 219 You can also use long lived graceful restart with normal graceful restart. 220 221 ```toml 222 [global.config] 223 as = 64512 224 router-id = "192.168.255.1" 225 226 [[neighbors]] 227 [neighbors.config] 228 neighbor-address = "10.0.255.1" 229 peer-as = 65001 230 [neighbors.graceful-restart.config] 231 enabled = true 232 long-lived-enabled = true 233 restart-time = 120 234 [[neighbors.afi-safis]] 235 [neighbors.afi-safis.config] 236 afi-safi-name = "ipv4-unicast" 237 [neighbors.afi-safis.mp-graceful-restart.config] 238 enabled = true 239 [neighbors.afi-safis.long-lived-graceful-restart.config] 240 enabled = true 241 restart-time = 100000 242 ```