Check Link Hook
This example demonstrates how to process outgoing NHRP traffic in a scenario using one Tunnel with GRE encapsulation.
Test Marks In NHRP Traffic
Description
In this scenario, a traffic policy was configured
to log outgoing NHRP traffic, which is non-IP Layer
3 protocol. The special hook link-out can be
used to process these outgoing frames.
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 address 192.168.100.10/24 set interfaces tunnel tun0 address 10.0.0.1/32 set interfaces tunnel tun0 encapsulation gre set interfaces tunnel tun0 local-address 192.168.100.10 set interfaces tunnel tun0 nhrp set interfaces tunnel tun0 traffic policy link-in LOG_NHRP set interfaces tunnel tun0 traffic policy link-out LOG_NHRP set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set traffic policy LOG_NHRP rule 1 log prefix NHRP__ set traffic policy LOG_NHRP rule 1 selector NHRP_SEL set traffic selector NHRP_SEL rule 1 ether-type 8193
Note
NHRP packets use ethertype 8193 (0x2001).
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 address 192.168.100.20/24 set interfaces tunnel tun0 address 10.0.0.2/32 set interfaces tunnel tun0 encapsulation gre set interfaces tunnel tun0 local-address 192.168.100.20 set interfaces tunnel tun0 nhrp holdtime 5 set interfaces tunnel tun0 nhrp nhs 10.0.0.1 nbma 192.168.100.10 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Run the command protocols ip show nhrp on DUT0 and check whether the output matches the following regular expressions:
tun0\s+dynamic\s+10\.0\.0\.2Show output
Iface Type Protocol NBMA Claimed NBMA Expires(s) Flags Identity tun0 local 10.0.0.1 192.168.100.10 192.168.100.10 - - tun0 dynamic 10.0.0.2 192.168.100.20 192.168.100.20 5 T
Step 4: Run the command system journal show | cat on DUT0 and check whether the output matches the following regular expressions:
\[NHRP__-1\] ACCEPT IN=tun0 OUT=\w+ \[NHRP__-1\] ACCEPT IN= OUT=tun0Show output
Jun 03 08:37:28.000287 osdx systemd-timedated[28681]: Changed local time to Wed 2026-06-03 08:37:28 UTC Jun 03 08:37:28.001827 osdx OSDxCLI[5794]: User 'admin' executed a new command: 'set date 2026-06-03 08:37:28'. Jun 03 08:37:28.004422 osdx systemd-journald[2255]: Time jumped backwards, rotating. Jun 03 08:37:28.351757 osdx systemd-journald[2255]: Runtime Journal (/run/log/journal/db6c204474e445bc870656488f91fc69) is 1.9M, max 13.8M, 11.8M free. Jun 03 08:37:28.352573 osdx systemd-journald[2255]: Received client request to rotate journal, rotating. Jun 03 08:37:28.352644 osdx systemd-journald[2255]: Vacuuming done, freed 0B of archived journals from /run/log/journal/db6c204474e445bc870656488f91fc69. Jun 03 08:37:28.361407 osdx OSDxCLI[5794]: User 'admin' executed a new command: 'system journal clear'. Jun 03 08:37:28.621382 osdx OSDxCLI[5794]: User 'admin' executed a new command: 'system coredump delete all'. Jun 03 08:37:28.870903 osdx OSDxCLI[5794]: User 'admin' entered the configuration menu. Jun 03 08:37:28.972758 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 192.168.100.10/24'. Jun 03 08:37:29.107468 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-out LOG_NHRP'. Jun 03 08:37:29.218056 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-in LOG_NHRP'. Jun 03 08:37:29.354053 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 address 10.0.0.1/32'. Jun 03 08:37:29.468269 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 encapsulation gre'. Jun 03 08:37:29.585761 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 local-address 192.168.100.10'. Jun 03 08:37:29.714160 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 nhrp'. Jun 03 08:37:29.832941 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 log prefix NHRP__'. Jun 03 08:37:29.946994 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 selector NHRP_SEL'. Jun 03 08:37:30.066510 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'set traffic selector NHRP_SEL rule 1 ether-type 8193'. Jun 03 08:37:30.226134 osdx OSDxCLI[5794]: User 'admin' added a new cfg line: 'show working'. Jun 03 08:37:30.317241 osdx ubnt-cfgd[28718]: inactive Jun 03 08:37:30.412785 osdx systemd[1]: Reloading frr.service - FRRouting... Jun 03 08:37:30.428485 osdx watchfrr[28545]: [NG1AJ-FP2TQ] Terminating on signal Jun 03 08:37:30.529546 osdx frrinit.sh[28751]: Stopped watchfrr. Jun 03 08:37:30.530608 osdx frrinit.sh[28751]: Starting watchfrr with command: ' /usr/lib/frr/watchfrr -d --min-restart-interval 1 --max-restart-interval 600 --timeout 600 --restart-timeout 600 mgmtd zebra nhrpd staticd'. Jun 03 08:37:30.537509 osdx watchfrr[28769]: [T83RR-8SM5G] watchfrr 10.6.0 starting: vty@0 Jun 03 08:37:30.537557 osdx watchfrr[28769]: [QDG3Y-BY5TN] mgmtd state -> up : connect succeeded Jun 03 08:37:30.537578 osdx watchfrr[28769]: [QDG3Y-BY5TN] zebra state -> up : connect succeeded Jun 03 08:37:30.537610 osdx watchfrr[28769]: [ZCJ3S-SPH5S] nhrpd state -> down : initial connection attempt failed Jun 03 08:37:30.537612 osdx watchfrr[28769]: [QDG3Y-BY5TN] staticd state -> up : connect succeeded Jun 03 08:37:30.537769 osdx watchfrr[28769]: [YFT0P-5Q5YX] Forked background command [pid 28770]: /usr/lib/frr/watchfrr.sh restart nhrpd Jun 03 08:37:30.541718 osdx frrinit.sh[28770]: Cannot stop nhrpd: pid file not found Jun 03 08:37:30.542666 osdx watchfrr.sh[28775]: Cannot stop nhrpd: pid file not found Jun 03 08:37:30.556993 osdx zebra[1839]: [V98V0-MTWPF] client 41 says hello and bids fair to announce only nhrp routes vrf=0 Jun 03 08:37:30.566890 osdx frrinit.sh[28780]: sh: line 1: ipsec: command not found Jun 03 08:37:30.579219 osdx nhrpd[28777]: [W9E3X-A5P3X] nhrpd: set-config-loaded received, marking as loaded Jun 03 08:37:30.580273 osdx watchfrr[28769]: [QDG3Y-BY5TN] nhrpd state -> up : connect succeeded Jun 03 08:37:30.580280 osdx watchfrr[28769]: [KWE5Q-QNGFC] all daemons up, doing startup-complete notify Jun 03 08:37:30.580807 osdx frrinit.sh[28751]: Started watchfrr. Jun 03 08:37:30.688923 osdx systemd[1]: Reloaded frr.service - FRRouting. Jun 03 08:37:30.724421 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Jun 03 08:37:30.791504 osdx WARNING[28876]: No supported link modes on interface eth0 Jun 03 08:37:30.793027 osdx modulelauncher[28876]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on Jun 03 08:37:30.793042 osdx modulelauncher[28876]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76. Jun 03 08:37:30.794754 osdx modulelauncher[28876]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off -- Jun 03 08:37:30.794767 osdx modulelauncher[28876]: Command '/sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off --' returned non-zero exit status 75. Jun 03 08:37:30.824734 osdx (udev-worker)[28902]: Network interface NamePolicy= disabled on kernel command line. Jun 03 08:37:31.316305 osdx cfgd[1899]: [5794]Completed change to active configuration Jun 03 08:37:31.316842 osdx OSDxCLI[5794]: User 'admin' committed the configuration. Jun 03 08:37:31.333287 osdx OSDxCLI[5794]: User 'admin' left the configuration menu. Jun 03 08:37:33.141857 osdx OSDxCLI[5794]: User 'admin' executed a new command: 'protocols ip show nhrp'. Jun 03 08:37:33.860421 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:e9:c4:40:00:40:2f:07:27:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Jun 03 08:37:33.860508 osdx kernel: [NHRP__-1] ACCEPT IN= OUT=tun0 MAC=45:01:00:00:00:00:40:00:40:2f:00:00:c0:a8:64:0a:c0:a8:64:14:00:00:20:01 Jun 03 08:37:33.860519 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT=eth0 MAC=00:01:08:00:00:00:00:00:00:40:00:70:2b:43:00:34:01:04:04:00:04:04:00:02 Jun 03 08:37:34.860154 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:ea:98:40:00:40:2f:06:53:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Jun 03 08:37:34.860426 osdx kernel: [NHRP__-1] ACCEPT IN= OUT=tun0 MAC=45:01:00:00:00:00:40:00:40:2f:00:00:c0:a8:64:0a:c0:a8:64:14:00:00:20:01 Jun 03 08:37:34.860468 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT=eth0 MAC=00:01:08:00:00:00:00:00:00:40:00:70:2b:42:00:34:01:04:04:00:04:04:00:02 Jun 03 08:37:35.214484 osdx OSDxCLI[5794]: User 'admin' executed a new command: 'protocols ip show nhrp'.
Step 5: Run the command traffic policy show on DUT0 and check whether the output matches the following regular expressions:
1\s+NHRP_SEL\s+\b[^0]\d*Show output
Policy LOG_NHRP -- ifc tun0 -- hook link-in prio very-high --------------------------------------------------------------- rule selector pkts match pkts eval bytes match bytes eval --------------------------------------------------------------- 1 NHRP_SEL 4 4 456 456 --------------------------------------------------------------- Total 4 4 456 456 Policy LOG_NHRP -- ifc tun0 -- hook link-out prio very-high --------------------------------------------------------------- rule selector pkts match pkts eval bytes match bytes eval --------------------------------------------------------------- 1 NHRP_SEL 2 2 272 272 --------------------------------------------------------------- Total 2 2 272 272