1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# Graceful Restart
This page explains how to configure [Graceful Restart](https://tools.ietf.org/html/rfc4724).
Graceful Restart has two sides. One is restarting speaker which does restart,
the other is receiving speaker (helper speaker) which helps a restarting speaker
to do graceful restart. GoBGP supports both roles.
## Contents
- [Helper speaker](#helper)
- [Restarting speaker](#restarting)
## <a name="helper"> Helper speaker
Below is the configuration to enable helper speaker behavior.
```toml
[global.config]
as = 64512
router-id = "192.168.255.1"
[[neighbors]]
[neighbors.config]
neighbor-address = "10.0.255.1"
peer-as = 65001
[neighbors.graceful-restart.config]
enabled = true
```
Check graceful restart capability is negotiated.
```shell
$ gobgp n 10.0.255.1
BGP neighbor is 10.0.255.1, remote AS 65001
BGP version 4, remote router ID 192.168.0.2
BGP state = BGP_FSM_ESTABLISHED, up for 00:00:36
BGP OutQ = 0, Flops = 0
Hold time is 0, keepalive interval is 30 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
BGP_CAP_MULTIPROTOCOL:
RF_IPv4_UC: advertised and received
BGP_CAP_ROUTE_REFRESH: advertised and received
BGP_CAP_GRACEFUL_RESTART: advertised and received
Remote: restart time 90 sec
RF_IPv4_UC
BGP_CAP_FOUR_OCTET_AS_NUMBER: advertised and received
Message statistics:
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 2 1
Keepalives: 2 2
Route Refesh: 0 0
Discarded: 0 0
Total: 5 4
Route statistics:
Advertised: 1
Received: 0
Accepted: 0
```
## <a name="restarting"> Restarting speaker
To support restarting speaker behavior, try the configuration below.
```toml
[global.config]
as = 64512
router-id = "192.168.255.1"
[[neighbors]]
[neighbors.config]
neighbor-address = "10.0.255.1"
peer-as = 65001
[neighbors.graceful-restart.config]
enabled = true
restart-time = 120
[[neighbors.afi-safis]]
afi-safi-name = "ipv4-unicast"
[neighbors.afi-safis.mp-graceful-restart.config]
enabled = true
```
By this configuration, if graceful restart capability is negotiated with the peer,
the peer starts graceful restart helper procedure, when `gobgpd` dies involuntarily or
`SIGINT`, `SIGKILL` signal is sent to `gobgpd`.
Note when `SIGTERM` signal is sent to `gobgpd`, graceful restart negotiated peers
don't start graceful restart helper procedure, since `gobgpd` sends notification
messages to these peers before it die.
When you restart `gobgpd`, add `-r` option to let peers know `gobgpd` is
recovered from graceful restart.
```shell
$ gobgpd -f gobgpd.conf -r
```
Let's see how capability negotiation changes.
```shell
$ gobgp n 10.0.255.1
BGP neighbor is 10.0.255.1, remote AS 65001
BGP version 4, remote router ID 192.168.0.2
BGP state = BGP_FSM_ESTABLISHED, up for 00:00:03
BGP OutQ = 0, Flops = 0
Hold time is 0, keepalive interval is 30 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
BGP_CAP_MULTIPROTOCOL:
RF_IPv4_UC: advertised and received
BGP_CAP_ROUTE_REFRESH: advertised and received
BGP_CAP_GRACEFUL_RESTART: advertised and received
Local: restart time 90 sec, restart flag set
RF_IPv4_UC, forward flag set
Remote: restart time 90 sec
RF_IPv4_UC
BGP_CAP_FOUR_OCTET_AS_NUMBER: advertised and received
Message statistics:
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 2 1
Keepalives: 1 1
Route Refesh: 0 0
Discarded: 0 0
Total: 4 3
Route statistics:
Advertised: 1
Received: 0
Accepted: 0
```
You can see `restart flag` and `forward flag` is set.
Without `-r` option, the peers which are under helper procedure will
immediately withdraw all routes which were advertised from `gobgpd`.
Also, when `gobgpd` doesn't recovered within `restart-time`, the peers will
withdraw all routes.
Default value of `restart-time` is equal to `hold-time`.
|