frr/nhrpd
Lou Berger cffec3cbad nhrp: replace hard coded retry time with value derived from holdtime
Signed-off-by: Lou Berger <lberger@labn.net>
2024-04-23 11:51:33 -04:00
..
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
Makefile build: non-recursive nhrpd 2017-08-04 11:09:50 +02:00
README.kernel nhrpd: add reference to net.ipv4.ip_forward_use_pmtu=1 thread 2020-12-17 10:04:13 +13:00
README.nhrpd nhrp: Make vici socket path configurable 2020-10-12 19:34:53 +02:00
debug.h *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
linux.c nhrpd: unset noarp flag using a zapi message 2024-01-24 10:05:29 +01:00
netlink.h nhrpd: remove netlink_configure_arp declaration 2024-01-24 10:05:52 +01:00
netlink_arp.c nhrp: fix race condition 2024-02-07 23:05:20 +00:00
nhrp_cache.c nhrpd: Fix nhrp_peer leak 2023-10-12 18:23:09 +04:00
nhrp_errors.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
nhrp_errors.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
nhrp_event.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
nhrp_interface.c nhrpd: unset noarp flag using a zapi message 2024-01-24 10:05:29 +01:00
nhrp_main.c *: fix `frr_daemon_info` indentation 2024-01-27 19:02:51 +01:00
nhrp_multicast.c *: Remove netlink headers from lib/zebra.h 2023-11-07 06:46:19 -05:00
nhrp_nhs.c nhrp: replace hard coded retry time with value derived from holdtime 2024-04-23 11:51:33 -04:00
nhrp_packet.c build: add -Wimplicit-fallthrough 2023-10-12 21:23:18 +03:00
nhrp_peer.c Merge pull request #14561 from idryzhov/implicit-fallthrough 2023-10-13 11:51:11 -04:00
nhrp_protocol.h *: manual SPDX License ID conversions 2023-02-09 14:09:07 +01:00
nhrp_route.c nhrpd: unset noarp flag using a zapi message 2024-01-24 10:05:29 +01:00
nhrp_shortcut.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
nhrp_vc.c nhrpd: Cleanup a hash on nhrp shutdown 2023-12-16 09:29:00 -05:00
nhrp_vty.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
nhrpd.h *: create a single registry of daemons' default port values 2024-02-01 11:40:02 -05:00
os.h *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
reqid.c *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
subdir.am build, vtysh: extract vtysh commands from .xref 2022-10-26 17:12:34 +01:00
vici.c *: zebra.h should not have fcntl.h 2024-01-09 12:50:40 -05:00
vici.h *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
zbuf.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zbuf.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
znl.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
znl.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00

README.nhrpd

Quagga / NHRP Design and Configuration Notes
============================================

Quagga/NHRP is an NHRP (RFC2332) implementation for Linux. The primary
use case is to implement DMVPN. The aim is thus to be compatible with
Cisco DMVPN (and potentially with FlexVPN in the future).


Current Status
--------------

- IPsec integration with strongSwan (requires patched strongSwan)
- IPv4 over IPv4 NBMA GRE
- IPv6 over IPv4 NBMA GRE -- majority of code exist; but is not tested
- Spoke (NHC) functionality complete
- Hub (NHS) functionality complete
- Multicast support is not done yet
  (so OSPF will not work, use BGP for now)

The code is not (yet) compatible with Cisco FlexVPN style DMVPN. It
would require relaying IKEv2 routing messages from strongSwan to nhrpd
and parsing that. It is doable, but not implemented for the time being.


Routing Design
--------------

In contrast to opennhrp routing design, Quagga/NHRP routes each NHRP
domain address individually (similar to Cisco FlexVPN).

To create NBMA GRE tunnel you might use following:
	ip tunnel add gre1 mode gre key 42 ttl 64 dev eth0
	ip addr add 10.255.255.2/32 dev gre1
	ip link set gre1 up

This has two important differences compared to opennhrp setup:
 1. The 'tunnel add' now specifies physical device binding. Quagga/NHRP
    wants to know stable protocol address to NBMA address mapping. Thus,
    add 'dev <physdev>' binding, or specify 'local <nbma-address>'. If
    neither of this is specified, NHRP will not be enabled on the interface.
    Alternatively you can skip 'dev' binding on tunnel if you allow
    nhrpd to manage it using 'tunnel source' command (see below).

 2. The 'addr add' now has host prefix. In opennhrp you would have used
    the GRE subnet prefix length here instead, e.g. /24.

Quagga/NHRP will automatically create additional host routes pointing to
gre1 when a connection with these hosts is established. The gre1 subnet
should be announced by routing protocol. This allows routing protocol
to decide which is the closest hub and get the gre addresses' traffic.

The second benefit is that hubs can then easily exchange host prefixes
of directly connected gre addresses. And thus routing of gre addresses
inside hubs is based on routing protocol's shortest path choice -- not
on random choice from next hop server list.


Configuring nhrpd
-----------------

The configuration is done using vtysh, and most commands do what they
do in Cisco. As minimal configuration example one can do:
 configure terminal
 interface gre1
   tunnel protection vici profile dmvpn
   tunnel source eth0
   ip nhrp network-id 1
   ip nhrp shortcut
   ip nhrp registration no-unique
   ip nhrp nhs dynamic nbma hubs.example.com

There's important notes about the "ip nhrp nhs" command:

 1. The 'dynamic' works only against Cisco (or nhrpd), but is not
    compatible with opennhrp. To use dynamic detection of opennhrp hub's
    protocol address use the GRE broadcast address there. For the above
    example of 10.255.255.0/24 the configuration should read instead:
      ip nhrp nhs 10.255.255.255 nbma hubs.example.com

 2. nbma <FQDN> works like opennhrp dynamic-map. That is, all of the
    A-records are configured as NBMA addresses of different hubs, and
    each hub protocol address will be dynamically detected.


Hub functionality
-----------------

Sending Traffic Indication (redirect) notifications is now accomplished
using NFLOG.

Use:
iptables -A FORWARD -i gre1 -o gre1 \
	-m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 \
	--hashlimit-mode srcip,dstip --hashlimit-srcmask 16 --hashlimit-dstmask 16 \
	--hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128

or similar to get rate-limited samples of the packets that match traffic
flow needing redirection. This kernel NFLOG target's nflog-group is configured
in global nhrp config with:
	nhrp nflog-group 1

To start sending these traffic notices out from hubs, use the nhrp per-interface
directive:
	ip nhrp redirect

opennhrp used PF_PACKET and tried to create packet filter to get only
the packets of interest. Though, this was bad if shortcut fails to
establish (remote policy, or both are behind NAT or restrictive
firewalls), all of the relayaed traffic would match always.


Getting information via vtysh
-----------------------------

Some commands of interest:
 - show dmvpn
 - show ip nhrp cache
 - show ip nhrp shortcut
 - show ip route nhrp
 - clear ip nhrp cache
 - clear ip nhrp shortcut


Integration with strongSwan
---------------------------

Contrary to opennhrp, Quagga/NHRP has tight integration with IKE daemon.
Currently strongSwan is supported using the VICI protocol. strongSwan
is connected using UNIX socket (default /var/run/charon.vici use configure
argument --with-vici-socket= to change).
Thus nhrpd needs to be run as user that can open that file.

Currently, you will need patched strongSwan. The working tree is at:
	http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras

And the branch with patches against latest release are:
	http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release