OPENNHRP-SCRIPT(8)
π NAME π
Okay so this page is all about opennhrp-script(8), bestie β itβs the NHRP peer configuration script, and opennhrp(8) is the one that invokes it. β¨
πΈ DESCRIPTION πΈ
This script can be used to establish a direct NBMA peer-to-peer connection after an NHRP Resolution Reply has been received, but right before injecting the peer address into the kernel neighbor table. The vibe? Maybe you wanna insert firewall rules allowing the traffic, and/or establish an IPsec connection (or some other secure communication channel). Itβs also called when the cached peer information expires. π«Ά
π« OPERATION π«
When opennhrp needs to invoke the peer configuration script, it defines a set of variables in the environment and then executes the script with exactly one argument. That argument is set to the name of the reason why the script has been invoked. The reasons currently defined are: interface-up, peer-register, peer-up, peer-down, nhs-up, nhs-down, route-up and route-down. No cap. π
π¦ INTERFACE-UP π¦
The interface has just been discovered, or it changed state from down to up. This is literally the place to clean up old routes if needed. π§Ή
π PEER-REGISTER π
A peer registration request has been received. The script is run before the internal peer cache is altered, and this allows the script to reject registration without deleting old peers. This could be used to check that the IPsec connection is up, or you might encode allowed protocol-addresses in the certificate and enforce that here. This hook is executed synchronously, so it should be fast β fr fr. β‘
π₯ PEER-UP π₯
A peer has been discovered β either by static configuration, dynamic client registration, or resolution reply arrival to initiate a shortcut. This hook is invoked right after the peerβs NBMA address is available. For all entries other than dynamic-map entries, the protocol address is available too. The information will not be injected into the kernel ARP cache until the script has returned zero.
π¨ If a non-zero return value is returned, the peer entry is marked as invalid and negative cached for a short period of time. So yeah, exit codes are kinda main character energy here.
π PEER-DOWN π
A peer connection is about to be cleared. This can happen for dynamic client registrations or cached information. Dynamic client registrations are torn down when the registration holding time expires (and no re-registration has occurred), or if itβs explicitly removed using a Purge Request. Cached entries are removed when the holding time expires (and there has been no traffic to trigger renewal of the peer address information), or when it is explicitly removed with a Purge Request. π«
π NHS-UP π
This is called for an NHS right after the first successful Registration Reply is received. This can be used to update application-level configuration about which servers to use. π
β NHS-DOWN β
Informs that the specified NHS is no longer available. Sad vibe, but necessary. π
π ROUTE-UP π
In reply to a resolution request, we have received a shortcut route with a destination off the NBMA subnetwork. The script should insert the appropriate entry into the kernel routing table. Slay. π£οΈ
π§ ROUTE-DOWN π§
The associated shortcut route information is no longer valid and should be removed from the kernel routing table. Cleanup era. π§½
π ENVIRONMENT π
NHRP_TYPEβ forpeer-upandpeer-downreasons this can bestatic(configured information),dynamic-nhs(configured NHS with only NBMA address known),dynamic(client registered) orcached(resolved since we had packets going there).
The nhs-up and nhs-down reasons are called for static entries with register keyword and dynamic-nhs entries.
For peer-register this is always dynamic.
For route-up and route-down reasons this is always defined as route.
For interface-up reason this is irrelevant, but always defined as interface.
NHRP_INTERFACEβ the network interface this event is related to.NHRP_GRE_KEYβ the GRE key assigned to the related network interface.NHRP_DESTADDRβ destination protocol address. E.g. for NBMA GRE tunnels this is the IP address assigned to the tunnel interface being used.NHRP_DESTPREFIXβ subnet prefix length for the destination protocol address.NHRP_DESTNBMAβ defined only forpeer-upandpeer-downreasons. This contains the NBMA address of the destination. E.g. for NBMA GRE this contains the public IP of the peer.NHRP_DESTMTUβ defined only forpeer-upreasons. This contains the MTU for the NBMA address of the destination.NHRP_NEXTHOPβ defined only forroute-upandroute-downreasons. This is the protocol address of the next hop to be used in routing.NHRP_PEER_DOWN_REASONβ defined only forpeer-downreason. This describes why the peer has been deleted. Currently it is one ofexpired,user-requestorlower-down.
π«Ά SEE ALSO π«Ά
π AUTHORS π
Timo Teras <timo.teras@iki.fi>
πΈ Thatβs the whole page, bestie β source/version: OpenNHRP Documentation, date: 20 May 2009, manual: OPENNHRP-SCRIPT(8). π
π¦ where this page comes from
- alpine 3.22: opennhrp-doc 0.14.1-r12 Β· MIT AND (BSD-2-Clause OR GPL-2.0-or-later)
- alpine 3.23: opennhrp-doc 0.14.1-r12 Β· MIT AND (BSD-2-Clause OR GPL-2.0-or-later)
- alpine 3.24: opennhrp-doc 0.14.1-r12 Β· MIT AND (BSD-2-Clause OR GPL-2.0-or-later)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms