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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
---
myst:
html_meta:
description: |
Bidirectional Forwarding Detection (BFD) is a network protocol that
detects communication failures between two connected routing devices
in milliseconds.
keywords: bfd, bidirectional forwarding detection, bgp, ospf, isis,
multihop, echo-mode
---
(routing-bfd)=
# BFD
{abbr}`BFD (Bidirectional Forwarding Detection)` is a network protocol that
detects communication failures between two connected routing devices in mere
milliseconds — far faster than traditional routing protocols.
BFD does not route traffic itself. Instead, it provides rapid failure detection
for other protocols, such as {abbr}`BGP (Border Gateway Protocol)`,
{abbr}`OSPF (Open Shortest Path First)`, and static routes.
BFD is described and extended by the following RFCs: {rfc}`5880`, {rfc}`5881`
and {rfc}`5883`.
**How BFD works**
BFD establishes a session between two peers and exchanges rapid
{abbr}`UDP (User Datagram Protocol)` control packets at a negotiated interval
(e.g., 300 ms between consecutive packets). If a peer doesn't receive these
packets within the detection time (the negotiated interval multiplied by a
detection multiplier), BFD assumes a connection failure and notifies the
routing protocols.
## Configuration
```{cfgcmd} set protocols bfd peer \<address\>
**Configure the IPv4 or IPv6 address of the BFD peer.**
You can configure multiple BFD peers by specifying a different IP address
for each neighbor you want to monitor.
```
```{note}
For IPv6 peers, you must configure a source IP address or interface.
```
Example:
```none
set protocols bfd peer 198.51.100.33
```
```{cfgcmd} set protocols bfd peer \<address\> echo-mode
**Enable BFD echo transmission mode for the peer at the specified IP
address.**
```
Example:
```none
set protocols bfd peer 198.51.100.33 echo-mode
```
```{cfgcmd} set protocols bfd peer \<address\> multihop
**Configure the peer at the specified IP address as a multi-hop neighbor.**
```
```{note}
For BFD multi-hop peers, you must configure a local source IP address.
```
Example:
```none
set protocols bfd peer 198.51.100.33 multihop
set protocols bfd peer 198.51.100.33 source address 198.51.100.1
```
```{cfgcmd} set protocols bfd peer \<address\> source address \<address\>
**Configure the source IP address for the BFD session with the peer at the
specified IP address.**
```
```{note}
Configuring a source IP address or interface is mandatory for IPv6 BFD
peers.
```
Example:
```none
set protocols bfd peer 198.51.100.33 source address 198.51.100.1
```
```{cfgcmd} set protocols bfd peer \<address\> source interface \<interface\>
**Configure the source interface for the BFD session with the peer at the
specified IP address.**
```
```{note}
Configuring a source IP address or interface is mandatory for IPv6 BFD
peers.
```
Example:
```none
set protocols bfd peer 2001:db8::2 source interface eth0
```
```{cfgcmd} set protocols bfd peer \<address\> interval echo-interval \<10-60000\>
**Configure the minimum interval, in milliseconds, at which the local system
can receive echo packets from the peer at the specified IP address.**
```
Example:
```none
set protocols bfd peer 198.51.100.33 interval echo-interval 50
```
```{cfgcmd} set protocols bfd peer \<address\> interval multiplier \<2-255\>
**Configure the detection multiplier for the peer at the specified IP
address.**
BFD multiplies the negotiated interval by this value to calculate the
detection time — the period after which it declares the session down if no
control packets arrive.
```
Example:
```none
set protocols bfd peer 192.0.2.1 interval multiplier 3
```
```{cfgcmd} set protocols bfd peer \<address\> interval receive \<10-60000\>
**Configure the interval, in milliseconds, at which the local system can
receive BFD control packets from the peer at the specified IP address.**
```
Example:
```none
set protocols bfd peer 192.0.2.1 interval receive 300
```
```{cfgcmd} set protocols bfd peer \<address\> interval transmit \<10-60000\>
**Configure the interval, in milliseconds, at which you want the local
system to transmit BFD control packets to the peer at the specified IP
address.**
```
Example:
```none
set protocols bfd peer 192.0.2.1 interval transmit 300
```
```{cfgcmd} set protocols bfd peer \<address\> shutdown
**Disable the BFD session with the peer at the specified IP address.**
```
Example:
```none
set protocols bfd peer 198.51.100.33 shutdown
```
```{cfgcmd} set protocols bfd peer \<address\> minimum-ttl \<1-254\>
**Configure the minimum {abbr}`TTL (Time to Live)` value that incoming BFD
control packets must have to be accepted from the peer at the specified IP
address.**
BFD discards any packet whose TTL is below this threshold.
```
```{note}
This setting applies only to multi-hop sessions.
```
Example:
```none
set protocols bfd peer 192.0.2.1 minimum-ttl 250
```
```{cfgcmd} set protocols bfd peer \<address\> passive
**Configure the BFD session with the peer at the specified IP address to
operate in passive mode.**
In passive mode, the local system does not initiate the BFD session.
Instead, it waits to receive the first BFD control packet from the remote
peer.
```
```{note}
At least one of the two peers must remain in active mode for the session
to establish. If both peers are passive, neither will initiate, and the
session never establishes.
```
Example:
```none
set protocols bfd peer 198.51.100.33 passive
```
```{cfgcmd} set protocols bfd peer \<address\> profile \<profile\>
**Apply settings from a designated BFD profile to the peer at the specified
IP address.**
```
Example:
```none
set protocols bfd peer 192.0.2.1 profile datacenter-fast
```
```{cfgcmd} set protocols bfd peer \<address\> vrf \<vrf\>
**Bind the BFD session with the peer at the specified IP address to a
specific {abbr}`VRF (Virtual Routing and Forwarding)` instance.**
```
Example:
```none
set protocols bfd peer 192.0.2.1 vrf customer-a
```
### Enable BFD in BGP
```{cfgcmd} set protocols bgp neighbor \<neighbor\> bfd
**Enable BFD failure detection for the BGP session with the neighbor at the
specified IP address.**
```
Example:
```none
set protocols bgp neighbor 192.0.2.1 bfd
```
```{cfgcmd} set protocols bgp peer-group \<neighbor\> bfd
**Enable BFD failure detection for all neighbors in the specified BGP peer
group.**
```
Example:
```none
set protocols bgp peer-group INTERNAL-PEERS bfd
```
### Enable BFD in OSPF
```{cfgcmd} set protocols ospf interface \<interface\> bfd
**Enable BFD failure detection for OSPF neighbors discovered on the specified
interface.**
When OSPF forms an adjacency with a neighbor on this interface, it requests
BFD to establish a session with that neighbor.
```
Example:
```none
set protocols ospf interface eth0 bfd
```
```{cfgcmd} set protocols ospfv3 interface \<interface\> bfd
**Enable BFD failure detection for OSPFv3 neighbors discovered on the
specified interface.**
When OSPFv3 forms an adjacency with a neighbor on this interface, it
requests BFD to establish a session with that neighbor.
```
Example:
```none
set protocols ospfv3 interface eth0 bfd
```
### Enable BFD in IS-IS
```{cfgcmd} set protocols isis interface \<interface\> bfd
**Enable BFD failure detection for IS-IS neighbors discovered on the
specified interface.**
When IS-IS forms an adjacency with a neighbor on this interface, it requests
BFD to establish a session with that neighbor.
```
Example:
```none
set protocols isis interface eth0 bfd
```
## Operation
```{opcmd} show bfd peers
**Show all BFD peers.**
```
```none
vyos@vyos:~$ show bfd peers
BFD Peers:
peer 198.51.100.33 vrf default
ID: 4182341893
Remote ID: 3267892964
Active mode
Status: up
Uptime: 1 month(s), 16 hour(s), 29 minute(s), 38 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
RTT min/avg/max: 245/267/289 usec
Local timers:
Detect-multiplier: 3
Receive interval: 300ms
Transmission interval: 300ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 300ms
Transmission interval: 300ms
Echo receive interval: disabled
peer 198.51.100.55 multihop local-address 198.51.100.1 vrf default
ID: 3618932327
Remote ID: 3312345688
Active mode
Minimum TTL: 254
Status: up
Uptime: 20 hour(s), 16 minute(s), 19 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
RTT min/avg/max: 1240/1289/1356 usec
Local timers:
Detect-multiplier: 3
Receive interval: 300ms
Transmission interval: 300ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 1000ms
Transmission interval: 1000ms
Echo receive interval: disabled
```
## BFD static route monitoring
A monitored static route is present in the
{abbr}`RIB (Routing Information Base)` only when the BFD session is up. If
the session goes down, the route is removed.
```{cfgcmd} set protocols static route \<subnet\> next-hop \<address\> bfd profile \<profile\>
**Configure BFD failure detection for a single-hop static route.**
BFD uses the next-hop IP address as the BFD peer IP address and applies
settings from the specified BFD profile.
```
Example:
```none
set protocols static route 10.0.0.0/24 next-hop 192.0.2.1 bfd profile datacenter-fast
```
```{cfgcmd} set protocols static route \<subnet\> next-hop \<address\> bfd multi-hop source-address \<address\>
**Configure BFD failure detection for a multi-hop static route.**
BFD uses the next-hop IP address as the BFD peer IP address and the
multi-hop source IP address as the local source IP for outgoing BFD packets.
```
Example:
```none
set protocols static route 10.0.0.0/24 next-hop 198.51.100.33 bfd multi-hop source-address 198.51.100.1
```
```{cfgcmd} set protocols static route6 \<subnet\> next-hop \<address\> bfd profile \<profile\>
**Configure BFD failure detection for a single-hop IPv6 static route.**
BFD uses the next-hop IPv6 address as the BFD peer IPv6 address and applies
settings from the specified BFD profile.
```
Example:
```none
set protocols static route6 2001:db8:1::/64 next-hop 2001:db8::1 bfd profile datacenter-fast
```
```{cfgcmd} set protocols static route6 \<subnet\> next-hop \<address\> bfd multi-hop source-address \<address\>
**Configure BFD failure detection for a multi-hop IPv6 static route.**
BFD uses the next-hop IPv6 address as the BFD peer IPv6 address and the
multi-hop source IPv6 address as the local source IPv6 address for outgoing
BFD packets.
```
Example:
```none
set protocols static route6 2001:db8:1::/64 next-hop 2001:db8:100::33 bfd multi-hop source-address 2001:db8::1
```
|