1 Quagga / NHRP Design and Configuration Notes
2 ============================================
4 Quagga/NHRP is an NHRP (RFC2332) implementation for Linux. The primary
5 use case is to implement DMVPN. The aim is thus to be compatible with
6 Cisco DMVPN (and potentially with FlexVPN in the future).
13 - IPsec integration with strongSwan (requires patched strongSwan)
14 - IPv4 over IPv4 NBMA GRE
15 - IPv6 over IPv4 NBMA GRE -- majority of code exist; but is not tested
16 - Spoke (NHC) functionality
17 - Hub (NHS) functionality
22 - Multicast support (OSPF will not work)
23 - Full Cisco FlexVPN compatibility (IKEv2 routing)
29 In contrast to opennhrp routing design, Quagga/NHRP routes each NHRP
30 domain address individually (similar to Cisco FlexVPN).
32 To create NBMA GRE tunnel you might use following:
33 ip tunnel add gre1 mode gre key 42 ttl 64 dev eth0
34 ip addr add 10.255.255.2/32 dev gre1
36 sysctl net.ipv4.ip_forward_use_pmtu=1 #for kernels>=3.14
38 This has two important differences compared to opennhrp setup:
39 1. The 'tunnel add' now specifies physical device binding. Quagga/NHRP
40 wants to know stable protocol address to NBMA address mapping. Thus,
41 add 'dev <physdev>' binding, or specify 'local <nbma-address>'. If
42 neither of this is specified, NHRP will not be enabled on the interface.
43 Alternatively you can skip 'dev' binding on tunnel if you allow
44 nhrpd to manage it using 'tunnel source' command (see below).
46 2. The 'addr add' now has host prefix. In opennhrp you would have used
47 the GRE subnet prefix length here instead, e.g. /24.
49 Quagga/NHRP will automatically create additional host routes pointing to
50 gre1 when a connection with these hosts is established. The gre1 subnet
51 should be announced by routing protocol. This allows routing protocol
52 to decide which is the closest hub and get the gre addresses' traffic.
54 The second benefit is that hubs can then easily exchange host prefixes
55 of directly connected gre addresses. And thus routing of gre addresses
56 inside hubs is based on routing protocol's shortest path choice -- not
57 on random choice from next hop server list.
63 The configuration is done using vtysh, and most commands do what they
64 do in Cisco. As minimal configuration example one can do:
67 tunnel protection vici profile dmvpn
71 ip nhrp registration no-unique
72 ip nhrp nhs dynamic nbma hubs.example.com
74 There's important notes about the "ip nhrp nhs" command:
76 1. The 'dynamic' works only against Cisco (or nhrpd), but is not
77 compatible with opennhrp. To use dynamic detection of opennhrp hub's
78 protocol address use the GRE broadcast address there. For the above
79 example of 10.255.255.0/24 the configuration should read instead:
80 ip nhrp nhs 10.255.255.255 nbma hubs.example.com
82 2. nbma <FQDN> works like opennhrp dynamic-map. That is, all of the
83 A-records are configured as NBMA addresses of different hubs, and
84 each hub protocol address will be dynamically detected.
90 Sending Traffic Indication (redirect) notifications is now accomplished
94 iptables -A FORWARD -i gre1 -o gre1 \
95 -m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 \
96 --hashlimit-mode srcip,dstip --hashlimit-srcmask 16 --hashlimit-dstmask 16 \
97 --hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128
99 or similar to get rate-limited samples of the packets that match traffic
100 flow needing redirection. This kernel NFLOG target's nflog-group is configured
101 in global nhrp config with:
104 To start sending these traffic notices out from hubs, use the nhrp per-interface
108 opennhrp used PF_PACKET and tried to create packet filter to get only
109 the packets of interest. Though, this was bad if shortcut fails to
110 establish (remote policy, or both are behind NAT or restrictive
111 firewalls), all of the relayaed traffic would match always.
114 Getting information via vtysh
115 -----------------------------
117 Some commands of interest:
121 - show ip nhrp shortcut
123 - clear ip nhrp cache
124 - clear ip nhrp shortcut
127 Integration with strongSwan
128 ---------------------------
130 Contrary to opennhrp, Quagga/NHRP has tight integration with IKE daemon.
131 Currently strongSwan is supported using the VICI protocol. strongSwan
132 is connected using UNIX socket (hardcoded now as /var/run/charon.vici).
133 Thus nhrpd needs to be run as user that can open that file.
135 Currently, you will need patched strongSwan. The working tree is at:
136 http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras
138 And the branch with patches against latest release are:
139 http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release