]> git.proxmox.com Git - mirror_frr.git/blame - doc/user/bfd.rst
Merge pull request #12531 from opensourcerouting/feature/snmp_tests
[mirror_frr.git] / doc / user / bfd.rst
CommitLineData
c44032c1
RZ
1.. _bfd:
2
3**********************************
4Bidirectional Forwarding Detection
5**********************************
6
7:abbr:`BFD (Bidirectional Forwarding Detection)` stands for
8Bidirectional Forwarding Detection and it is described and extended by
9the following RFCs:
10
11* :rfc:`5880`
12* :rfc:`5881`
13* :rfc:`5883`
14
15Currently, there are two implementations of the BFD commands in FRR:
16
17* :abbr:`PTM (Prescriptive Topology Manager)`: an external daemon which
18 implements BFD;
19* ``bfdd``: a BFD implementation that is able to talk with remote peers;
20
21This document will focus on the later implementation: *bfdd*.
22
23
24.. _bfd-starting:
25
26Starting BFD
27============
28
29*bfdd* default configuration file is :file:`bfdd.conf`. *bfdd* searches
30the current directory first then |INSTALL_PREFIX_ETC|/bfdd.conf. All of
31*bfdd*'s command must be configured in :file:`bfdd.conf`.
32
33*bfdd* specific invocation options are described below. Common options
34may also be specified (:ref:`common-invocation-options`).
35
36.. program:: bfdd
37
38.. option:: --bfdctl <unix-socket>
39
40 Set the BFD daemon control socket location. If using a non-default
123582b3 41 socket location::
c44032c1
RZ
42
43 /usr/lib/frr/bfdd --bfdctl /tmp/bfdd.sock
44
45
46 The default UNIX socket location is:
47
48 #define BFDD_CONTROL_SOCKET "|INSTALL_PREFIX_STATE|/bfdd.sock"
49
6ed85950
DS
50 This option overrides the location addition that the -N option provides
51 to the bfdd.sock
52
c4a21663
RZ
53.. option:: --dplaneaddr <type>:<address>[<:port>]
54
55 Configure the distributed BFD data plane listening socket bind address.
56
57 One would expect the data plane to run in the same machine as FRR, so
58 the suggested configuration would be:
59
60 --dplaneaddr unix:/var/run/frr/bfdd_dplane.sock
61
62 Or using IPv4:
63
64 --dplaneaddr ipv4:127.0.0.1
65
66 Or using IPv6:
67
68 --dplaneaddr ipv6:[::1]
69
70 It is also possible to specify a port (for IPv4/IPv6 only):
71
72 --dplaneaddr ipv6:[::1]:50701
73
74 (if ommited the default port is ``50700``).
75
6655b43d
RZ
76 It is also possible to operate in client mode (instead of listening for
77 connections). To connect to a data plane server append the letter 'c' to
78 the protocol, example:
79
80 --dplaneaddr ipv4c:127.0.0.1
81
c4a21663
RZ
82.. note::
83
84 When using UNIX sockets don't forget to check the file permissions
85 before attempting to use it.
86
c44032c1
RZ
87
88.. _bfd-commands:
89
90BFDd Commands
91=============
92
c44032c1
RZ
93.. clicmd:: bfd
94
95 Opens the BFD daemon configuration node.
96
c44032c1
RZ
97.. clicmd:: peer <A.B.C.D|X:X::X:X> [{multihop|local-address <A.B.C.D|X:X::X:X>|interface IFNAME|vrf NAME}]
98
99 Creates and configures a new BFD peer to listen and talk to.
100
101 `multihop` tells the BFD daemon that we should expect packets with
102 TTL less than 254 (because it will take more than one hop) and to
103 listen on the multihop port (4784). When using multi-hop mode
104 `echo-mode` will not work (see :rfc:`5883` section 3).
105
106 `local-address` provides a local address that we should bind our
107 peer listener to and the address we should use to send the packets.
108 This option is mandatory for IPv6.
109
626618ca 110 `interface` selects which interface we should use.
c44032c1
RZ
111
112 `vrf` selects which domain we want to use.
113
088f4902 114
088f4902
RZ
115.. clicmd:: profile WORD
116
117 Creates a peer profile that can be configured in multiple peers.
118
03750f1e
QY
119 Deleting the profile will cause all peers using it to reset to the default
120 values.
088f4902
RZ
121
122
c3771c91 123.. clicmd:: show bfd [vrf NAME] peers [json]
c44032c1
RZ
124
125 Show all configured BFD peers information and current status.
126
cc2a89db 127.. clicmd:: show bfd [vrf NAME] peer <WORD|<A.B.C.D|X:X::X:X> [{multihop|local-address <A.B.C.D|X:X::X:X>|interface IFNAME}]> [json]
c44032c1
RZ
128
129 Show status for a specific BFD peer.
130
54719107
S
131.. clicmd:: show bfd [vrf NAME] peers brief [json]
132
133 Show all configured BFD peers information and current status in brief.
c44032c1 134
c4a21663
RZ
135.. clicmd:: show bfd distributed
136
137 Show the BFD data plane (distributed BFD) statistics.
138
139
c44032c1
RZ
140.. _bfd-peer-config:
141
088f4902
RZ
142Peer / Profile Configuration
143----------------------------
144
145BFD peers and profiles share the same BFD session configuration commands.
c44032c1 146
c44032c1
RZ
147.. clicmd:: detect-multiplier (2-255)
148
149 Configures the detection multiplier to determine packet loss. The
150 remote transmission interval will be multiplied by this value to
151 determine the connection loss detection timer. The default value is
152 3.
153
154 Example: when the local system has `detect-multiplier 3` and the
155 remote system has `transmission interval 300`, the local system will
156 detect failures only after 900 milliseconds without receiving
157 packets.
158
c44032c1
RZ
159.. clicmd:: receive-interval (10-60000)
160
161 Configures the minimum interval that this system is capable of
162 receiving control packets. The default value is 300 milliseconds.
163
c44032c1
RZ
164.. clicmd:: transmit-interval (10-60000)
165
166 The minimum transmission interval (less jitter) that this system
a01cb26c 167 wants to use to send BFD control packets. Defaults to 300ms.
c44032c1 168
4df3e31c 169.. clicmd:: echo receive-interval <disabled|(10-60000)>
c44032c1 170
4df3e31c
IR
171 Configures the minimum interval that this system is capable of
172 receiving echo packets. Disabled means that this system doesn't want
173 to receive echo packets. The default value is 50 milliseconds.
174
175.. clicmd:: echo transmit-interval (10-60000)
176
177 The minimum transmission interval (less jitter) that this system
178 wants to use to send BFD echo packets. Defaults to 50ms.
c44032c1 179
03750f1e 180.. clicmd:: echo-mode
c44032c1
RZ
181
182 Enables or disables the echo transmission mode. This mode is disabled
f1825d57
IR
183 by default. If you are not using distributed BFD then echo mode works
184 only when the peer is also FRR.
c44032c1
RZ
185
186 It is recommended that the transmission interval of control packets
187 to be increased after enabling echo-mode to reduce bandwidth usage.
a01cb26c 188 For example: `transmit-interval 2000`.
c44032c1
RZ
189
190 Echo mode is not supported on multi-hop setups (see :rfc:`5883`
191 section 3).
192
03750f1e 193.. clicmd:: shutdown
c44032c1
RZ
194
195 Enables or disables the peer. When the peer is disabled an
196 'administrative down' message is sent to the remote peer.
197
088f4902 198
03750f1e 199.. clicmd:: passive-mode
abd15296
RZ
200
201 Mark session as passive: a passive session will not attempt to start
202 the connection and will wait for control packets from peer before it
203 begins replying.
204
205 This feature is useful when you have a router that acts as the
206 central node of a star network and you want to avoid sending BFD
207 control packets you don't need to.
208
209 The default is active-mode (or ``no passive-mode``).
210
03750f1e 211.. clicmd:: minimum-ttl (1-254)
158a95c5
RZ
212
213 For multi hop sessions only: configure the minimum expected TTL for
214 an incoming BFD control packet.
215
216 This feature serves the purpose of thightening the packet validation
217 requirements to avoid receiving BFD control packets from other
218 sessions.
219
220 The default value is 254 (which means we only expect one hop between
221 this system and the peer).
222
abd15296 223
088f4902
RZ
224BFD Peer Specific Commands
225--------------------------
226
c44032c1
RZ
227.. clicmd:: label WORD
228
229 Labels a peer with the provided word. This word can be referenced
230 later on other daemons to refer to a specific peer.
231
232
088f4902
RZ
233.. clicmd:: profile BFDPROF
234
235 Configure peer to use the profile configurations.
236
237 Notes:
238
2b669d3a 239 - Profile configurations can be overridden on a peer basis by specifying
580b190c 240 non-default parameters in peer configuration node.
088f4902
RZ
241 - Non existing profiles can be configured and they will only be applied
242 once they start to exist.
243 - If the profile gets updated the new configuration will be applied to all
244 peers with the profile without interruptions.
245
246
c44032c1
RZ
247.. _bfd-bgp-peer-config:
248
249BGP BFD Configuration
250---------------------
251
123582b3
RZ
252The following commands are available inside the BGP configuration node.
253
c44032c1
RZ
254.. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd
255
256 Listen for BFD events registered on the same target as this BGP
257 neighbor. When BFD peer goes down it immediately asks BGP to shutdown
258 the connection with its neighbor and, when it goes back up, notify
259 BGP to try to connect to it.
260
c44032c1 261
7b8ca2a8
PG
262.. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd check-control-plane-failure
263
264 Allow to write CBIT independence in BFD outgoing packets. Also allow to
265 read both C-BIT value of BFD and lookup BGP peer status. This command is
266 useful when a BFD down event is caught, while the BGP peer requested that
267 local BGP keeps the remote BGP entries as staled if such issue is detected.
268 This is the case when graceful restart is enabled, and it is wished to
269 ignore the BD event while waiting for the remote router to restart.
270
03750f1e
QY
271 Disabling this disables presence of CBIT independence in BFD outgoing
272 packets and pays attention to BFD down notifications. This is the default.
c44032c1 273
55d1a984 274
55d1a984
RZ
275.. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd profile BFDPROF
276
277 Same as command ``neighbor <A.B.C.D|X:X::X:X|WORD> bfd``, but applies the
278 BFD profile to the sessions it creates or that already exist.
279
280
a01cb26c
G
281.. _bfd-isis-peer-config:
282
283IS-IS BFD Configuration
284-----------------------
285
286The following commands are available inside the interface configuration node.
287
4affdba7 288.. clicmd:: isis bfd
a01cb26c
G
289
290 Listen for BFD events on peers created on the interface. Every time
291 a new neighbor is found a BFD peer is created to monitor the link
292 status for fast convergence.
293
a01cb26c
G
294 Note that there will be just one BFD session per interface. In case both
295 IPv4 and IPv6 support are configured then just a IPv6 based session is
296 created.
297
4affdba7
G
298.. clicmd:: isis bfd profile BFDPROF
299
300 Use a BFD profile BFDPROF as provided in the BFD configuration.
301
a01cb26c 302
123582b3
RZ
303.. _bfd-ospf-peer-config:
304
305OSPF BFD Configuration
e36ff3f3 306----------------------
123582b3
RZ
307
308The following commands are available inside the interface configuration node.
309
123582b3
RZ
310.. clicmd:: ip ospf bfd
311
312 Listen for BFD events on peers created on the interface. Every time
313 a new neighbor is found a BFD peer is created to monitor the link
314 status for fast convergence.
315
33082fcf
RZ
316.. clicmd:: ip ospf bfd profile BFDPROF
317
318 Same as command ``ip ospf bfd``, but applies the BFD profile to the sessions
319 it creates or that already exist.
320
123582b3
RZ
321
322.. _bfd-ospf6-peer-config:
323
324OSPF6 BFD Configuration
325-----------------------
326
327The following commands are available inside the interface configuration node.
328
76b512be 329.. clicmd:: ipv6 ospf6 bfd [profile BFDPROF]
123582b3
RZ
330
331 Listen for BFD events on peers created on the interface. Every time
332 a new neighbor is found a BFD peer is created to monitor the link
333 status for fast convergence.
334
76b512be
RZ
335 Optionally uses the BFD profile ``BFDPROF`` in the created sessions under
336 that interface.
337
123582b3
RZ
338
339.. _bfd-pim-peer-config:
340
341PIM BFD Configuration
342---------------------
343
344The following commands are available inside the interface configuration node.
345
46e3d008 346.. clicmd:: ip pim bfd [profile BFDPROF]
123582b3
RZ
347
348 Listen for BFD events on peers created on the interface. Every time
349 a new neighbor is found a BFD peer is created to monitor the link
350 status for fast convergence.
351
46e3d008
RZ
352 Optionally uses the BFD profile ``BFDPROF`` in the created sessions under
353 that interface.
354
123582b3 355
c44032c1
RZ
356.. _bfd-configuration:
357
358Configuration
359=============
360
361Before applying ``bfdd`` rules to integrated daemons (like BGPd), we must
362create the corresponding peers inside the ``bfd`` configuration node.
363
364Here is an example of BFD configuration:
365
366::
367
368 bfd
369 peer 192.168.0.1
370 label home-peer
371 no shutdown
372 !
373 !
374 router bgp 65530
375 neighbor 192.168.0.1 remote-as 65531
376 neighbor 192.168.0.1 bfd
377 neighbor 192.168.0.2 remote-as 65530
378 neighbor 192.168.0.2 bfd
379 neighbor 192.168.0.3 remote-as 65532
380 neighbor 192.168.0.3 bfd
381 !
382
383Peers can be identified by its address (use ``multihop`` when you need
384to specify a multi hop peer) or can be specified manually by a label.
385
386Here are the available peer configurations:
387
388::
389
390 bfd
088f4902
RZ
391 ! Configure a fast profile
392 profile fast
393 receive-interval 150
394 transmit-interval 150
395 !
396
397 ! Configure peer with fast profile
398 peer 192.168.0.6
399 profile fast
400 no shutdown
401 !
402
403 ! Configure peer with fast profile and override receive speed.
404 peer 192.168.0.7
405 profile fast
406 receive-interval 500
407 no shutdown
408 !
c44032c1
RZ
409
410 ! configure a peer on an specific interface
411 peer 192.168.0.1 interface eth0
412 no shutdown
413 !
414
415 ! configure a multihop peer
416 peer 192.168.0.2 multihop local-address 192.168.0.3
417 shutdown
418 !
419
420 ! configure a peer in a different vrf
421 peer 192.168.0.3 vrf foo
422 shutdown
423 !
424
425 ! configure a peer with every option possible
426 peer 192.168.0.4
427 label peer-label
428 detect-multiplier 50
429 receive-interval 60000
430 transmit-interval 3000
431 shutdown
432 !
433
626618ca
PG
434 ! configure a peer on an interface from a separate vrf
435 peer 192.168.0.5 interface eth1 vrf vrf2
436 no shutdown
437 !
438
c44032c1
RZ
439 ! remove a peer
440 no peer 192.168.0.3 vrf foo
441
442
443.. _bfd-status:
444
445Status
446======
447
448You can inspect the current BFD peer status with the following commands:
449
450::
451
452 frr# show bfd peers
453 BFD Peers:
454 peer 192.168.0.1
455 ID: 1
456 Remote ID: 1
457 Status: up
458 Uptime: 1 minute(s), 51 second(s)
459 Diagnostics: ok
460 Remote diagnostics: ok
54719107 461 Peer Type: dynamic
c44032c1 462 Local timers:
54719107 463 Detect-multiplier: 3
c44032c1
RZ
464 Receive interval: 300ms
465 Transmission interval: 300ms
4df3e31c 466 Echo receive interval: 50ms
c44032c1
RZ
467 Echo transmission interval: disabled
468 Remote timers:
54719107 469 Detect-multiplier: 3
c44032c1
RZ
470 Receive interval: 300ms
471 Transmission interval: 300ms
4df3e31c 472 Echo receive interval: 50ms
c44032c1
RZ
473
474 peer 192.168.1.1
475 label: router3-peer
476 ID: 2
477 Remote ID: 2
478 Status: up
479 Uptime: 1 minute(s), 53 second(s)
480 Diagnostics: ok
481 Remote diagnostics: ok
54719107 482 Peer Type: configured
c44032c1 483 Local timers:
54719107 484 Detect-multiplier: 3
c44032c1
RZ
485 Receive interval: 300ms
486 Transmission interval: 300ms
4df3e31c 487 Echo receive interval: 50ms
c44032c1
RZ
488 Echo transmission interval: disabled
489 Remote timers:
54719107 490 Detect-multiplier: 3
c44032c1
RZ
491 Receive interval: 300ms
492 Transmission interval: 300ms
4df3e31c 493 Echo receive interval: 50ms
c44032c1
RZ
494
495 frr# show bfd peer 192.168.1.1
496 BFD Peer:
497 peer 192.168.1.1
498 label: router3-peer
499 ID: 2
500 Remote ID: 2
501 Status: up
502 Uptime: 3 minute(s), 4 second(s)
503 Diagnostics: ok
504 Remote diagnostics: ok
54719107 505 Peer Type: dynamic
c44032c1 506 Local timers:
54719107 507 Detect-multiplier: 3
c44032c1
RZ
508 Receive interval: 300ms
509 Transmission interval: 300ms
4df3e31c 510 Echo receive interval: 50ms
c44032c1
RZ
511 Echo transmission interval: disabled
512 Remote timers:
54719107 513 Detect-multiplier: 3
c44032c1
RZ
514 Receive interval: 300ms
515 Transmission interval: 300ms
4df3e31c 516 Echo receive interval: 50ms
123582b3
RZ
517
518 frr# show bfd peer 192.168.0.1 json
4df3e31c 519 {"multihop":false,"peer":"192.168.0.1","id":1,"remote-id":1,"status":"up","uptime":161,"diagnostic":"ok","remote-diagnostic":"ok","receive-interval":300,"transmit-interval":300,"echo-receive-interval":50,"echo-transmit-interval":0,"detect-multiplier":3,"remote-receive-interval":300,"remote-transmit-interval":300,"remote-echo-receive-interval":50,"remote-detect-multiplier":3,"peer-type":"dynamic"}
54719107 520
a0ffb7dd 521If you are running IPV4 BFD Echo, on a Linux platform, we also
522calculate round trip time for the packets. We display minimum,
523average and maximum time it took to receive the looped Echo packets
524in the RTT fields.
54719107
S
525
526You can inspect the current BFD peer status in brief with the following commands:
527
528::
529
431dd37e 530 frr# show bfd peers brief
54719107
S
531 Session count: 1
532 SessionId LocalAddress PeerAddress Status
533 ========= ============ =========== ======
534 1 192.168.0.1 192.168.0.2 up
123582b3
RZ
535
536
537You can also inspect peer session counters with the following commands:
538
539::
540
541 frr# show bfd peers counters
542 BFD Peers:
543 peer 192.168.2.1 interface r2-eth2
544 Control packet input: 28 packets
545 Control packet output: 28 packets
546 Echo packet input: 0 packets
547 Echo packet output: 0 packets
548 Session up events: 1
549 Session down events: 0
550 Zebra notifications: 2
551
552 peer 192.168.0.1
553 Control packet input: 54 packets
554 Control packet output: 103 packets
555 Echo packet input: 965 packets
556 Echo packet output: 966 packets
557 Session up events: 1
558 Session down events: 0
559 Zebra notifications: 4
560
561 frr# show bfd peer 192.168.0.1 counters
562 peer 192.168.0.1
563 Control packet input: 126 packets
564 Control packet output: 247 packets
565 Echo packet input: 2409 packets
566 Echo packet output: 2410 packets
567 Session up events: 1
568 Session down events: 0
569 Zebra notifications: 4
570
571 frr# show bfd peer 192.168.0.1 counters json
e36ff3f3 572 {"multihop":false,"peer":"192.168.0.1","control-packet-input":348,"control-packet-output":685,"echo-packet-input":6815,"echo-packet-output":6816,"session-up":1,"session-down":0,"zebra-notifications":4}
54719107
S
573
574You can also clear packet counters per session with the following commands, only the packet counters will be reset:
575
576::
577
578 frr# clear bfd peers counters
579
580 frr# show bfd peers counters
581 BFD Peers:
582 peer 192.168.2.1 interface r2-eth2
583 Control packet input: 0 packets
584 Control packet output: 0 packets
585 Echo packet input: 0 packets
586 Echo packet output: 0 packets
587 Session up events: 1
588 Session down events: 0
589 Zebra notifications: 2
590
591 peer 192.168.0.1
592 Control packet input: 0 packets
593 Control packet output: 0 packets
594 Echo packet input: 0 packets
595 Echo packet output: 0 packets
596 Session up events: 1
597 Session down events: 0
598 Zebra notifications: 4
599
c4a21663
RZ
600
601.. _bfd-distributed:
602
603Distributed BFD
604===============
605
606The distributed BFD is the separation of the BFD protocol control plane from
607the data plane. FRR implements its own BFD data plane protocol so vendors can
608study and include it in their own software/hardware without having to modify
609the FRR source code. The protocol definitions can be found at
610``bfdd/bfddp_packet.h`` header (or the installed
611``/usr/include/frr/bfdd/bfddp_packet.h``).
612
613To use this feature the BFD daemon needs to be started using the command line
614option :option:`--dplaneaddr`. When operating using this option the BFD daemon
615will not attempt to establish BFD sessions, but it will offload all its work to
616the data plane that is (or will be) connected. Data plane reconnection is also
617supported.
618
619The BFD data plane will be responsible for:
620
621* Sending/receiving the BFD protocol control/echo packets
622
623* Notifying BFD sessions state changes
624
625* Keeping the number of packets/bytes received/transmitted per session
626
627
628The FRR BFD daemon will be responsible for:
629
630* Adding/updating BFD session settings
631
632* Asking for BFD session counters
633
634* Redistributing the state changes to the integrated protocols (``bgpd``,
635 ``ospfd`` etc...)
636
637
638BFD daemon will also keep record of data plane communication statistics with
639the command :clicmd:`show bfd distributed`.
640
641Sample output:
642
643::
644
645 frr# show bfd distributed
646 Data plane
647 ==========
648 File descriptor: 16
649 Input bytes: 1296
650 Input bytes peak: 72
651 Input messages: 42
652 Input current usage: 0
653 Output bytes: 568
654 Output bytes peak: 136
655 Output messages: 19
656 Output full events: 0
657 Output current usage: 0
658
659
660.. _bfd-debugging:
661
2b21c550
RZ
662Debugging
663=========
8202e9a0 664
2b21c550
RZ
665By default only informational, warning and errors messages are going to be
666displayed. If you want to get debug messages and other diagnostics then make
667sure you have `debugging` level enabled:
8202e9a0
TB
668
669::
670
671 config
672 log file /var/log/frr/frr.log debugging
673 log syslog debugging
2b21c550
RZ
674
675You may also fine tune the debug messages by selecting one or more of the
676debug levels:
677
03750f1e 678.. clicmd:: debug bfd distributed
c4a21663
RZ
679
680 Toggle BFD data plane (distributed BFD) debugging.
681
682 Activates the following debug messages:
683
684 * Data plane received / send messages
685 * Connection events
686
03750f1e 687.. clicmd:: debug bfd network
2b21c550
RZ
688
689 Toggle network events: show messages about socket failures and unexpected
690 BFD messages that may not belong to registered peers.
691
03750f1e 692.. clicmd:: debug bfd peer
2b21c550
RZ
693
694 Toggle peer event log messages: show messages about peer creation/removal
695 and state changes.
696
03750f1e 697.. clicmd:: debug bfd zebra
2b21c550
RZ
698
699 Toggle zebra message events: show messages about interfaces, local
700 addresses, VRF and daemon peer registrations.