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 command protocols ip show nhrp at DUT0 and check if 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 UT
Step 4: Run command system journal show | cat at DUT0 and check if output matches the following regular expressions:
\[NHRP__-1\] ACCEPT IN=tun0 OUT=\w+ \[NHRP__-1\] ACCEPT IN= OUT=tun0Show output
Apr 17 00:25:36.000164 osdx systemd-timedated[1142036]: Changed local time to Fri 2026-04-17 00:25:36 UTC Apr 17 00:25:36.001550 osdx OSDxCLI[1117731]: User 'admin' executed a new command: 'set date 2026-04-17 00:25:36'. Apr 17 00:25:36.003324 osdx systemd-journald[126917]: Time jumped backwards, rotating. Apr 17 00:25:36.307477 osdx systemd-journald[126917]: Runtime Journal (/run/log/journal/a3fecc5be5e949c7a083b0adeea4bb21) is 1.9M, max 13.8M, 11.9M free. Apr 17 00:25:36.311360 osdx systemd-journald[126917]: Received client request to rotate journal, rotating. Apr 17 00:25:36.311431 osdx systemd-journald[126917]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a3fecc5be5e949c7a083b0adeea4bb21. Apr 17 00:25:36.318201 osdx OSDxCLI[1117731]: User 'admin' executed a new command: 'system journal clear'. Apr 17 00:25:36.532971 osdx OSDxCLI[1117731]: User 'admin' executed a new command: 'system coredump delete all'. Apr 17 00:25:36.780968 osdx OSDxCLI[1117731]: User 'admin' entered the configuration menu. Apr 17 00:25:36.863448 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 192.168.100.10/24'. Apr 17 00:25:36.956030 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-out LOG_NHRP'. Apr 17 00:25:37.016647 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-in LOG_NHRP'. Apr 17 00:25:37.109971 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 address 10.0.0.1/32'. Apr 17 00:25:37.166279 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 encapsulation gre'. Apr 17 00:25:37.271565 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 local-address 192.168.100.10'. Apr 17 00:25:37.341812 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 nhrp'. Apr 17 00:25:37.445392 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 log prefix NHRP__'. Apr 17 00:25:37.521862 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 selector NHRP_SEL'. Apr 17 00:25:37.584447 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'set traffic selector NHRP_SEL rule 1 ether-type 8193'. Apr 17 00:25:37.685554 osdx OSDxCLI[1117731]: User 'admin' added a new cfg line: 'show working'. Apr 17 00:25:37.750794 osdx ubnt-cfgd[1148023]: inactive Apr 17 00:25:37.827674 osdx systemd[1]: Reloading frr.service - FRRouting... Apr 17 00:25:37.846597 osdx watchfrr[1147899]: [NG1AJ-FP2TQ] Terminating on signal Apr 17 00:25:37.947564 osdx frrinit.sh[1148053]: Stopped watchfrr. Apr 17 00:25:37.948775 osdx frrinit.sh[1148053]: Starting watchfrr with command: ' /usr/lib/frr/watchfrr -d --min-restart-interval 1 --max-restart-interval 600 --timeout 600 --restart-timeout 600 zebra mgmtd nhrpd staticd'. Apr 17 00:25:37.958446 osdx watchfrr[1148071]: [T83RR-8SM5G] watchfrr 10.4.1 starting: vty@0 Apr 17 00:25:37.958532 osdx watchfrr[1148071]: [QDG3Y-BY5TN] zebra state -> up : connect succeeded Apr 17 00:25:37.958575 osdx watchfrr[1148071]: [QDG3Y-BY5TN] mgmtd state -> up : connect succeeded Apr 17 00:25:37.958628 osdx watchfrr[1148071]: [ZCJ3S-SPH5S] nhrpd state -> down : initial connection attempt failed Apr 17 00:25:37.958630 osdx watchfrr[1148071]: [QDG3Y-BY5TN] staticd state -> up : connect succeeded Apr 17 00:25:37.958814 osdx watchfrr[1148071]: [YFT0P-5Q5YX] Forked background command [pid 1148072]: /usr/lib/frr/watchfrr.sh restart nhrpd Apr 17 00:25:37.963752 osdx frrinit.sh[1148072]: Cannot stop nhrpd: pid file not found Apr 17 00:25:37.964969 osdx watchfrr.sh[1148077]: Cannot stop nhrpd: pid file not found Apr 17 00:25:37.975263 osdx zebra[913455]: [V98V0-MTWPF] client 36 says hello and bids fair to announce only nhrp routes vrf=0 Apr 17 00:25:37.984445 osdx frrinit.sh[1148082]: sh: line 1: ipsec: command not found Apr 17 00:25:37.995204 osdx nhrpd[1148079]: [W9E3X-A5P3X] nhrpd: set-config-loaded received, marking as loaded Apr 17 00:25:37.996088 osdx watchfrr[1148071]: [QDG3Y-BY5TN] nhrpd state -> up : connect succeeded Apr 17 00:25:37.996095 osdx watchfrr[1148071]: [KWE5Q-QNGFC] all daemons up, doing startup-complete notify Apr 17 00:25:37.996590 osdx frrinit.sh[1148053]: Started watchfrr. Apr 17 00:25:38.098152 osdx systemd[1]: Reloaded frr.service - FRRouting. Apr 17 00:25:38.127322 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Apr 17 00:25:38.171284 osdx WARNING[1148176]: No supported link modes on interface eth0 Apr 17 00:25:38.172894 osdx modulelauncher[1148176]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on Apr 17 00:25:38.172906 osdx modulelauncher[1148176]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76. Apr 17 00:25:38.174018 osdx modulelauncher[1148176]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off -- Apr 17 00:25:38.174026 osdx modulelauncher[1148176]: Command '/sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off --' returned non-zero exit status 75. Apr 17 00:25:38.196002 osdx (udev-worker)[1148204]: Network interface NamePolicy= disabled on kernel command line. Apr 17 00:25:38.467944 osdx cfgd[1833]: [1117731]Completed change to active configuration Apr 17 00:25:38.479645 osdx OSDxCLI[1117731]: User 'admin' committed the configuration. Apr 17 00:25:38.502491 osdx OSDxCLI[1117731]: User 'admin' left the configuration menu. Apr 17 00:25:40.143750 osdx OSDxCLI[1117731]: User 'admin' executed a new command: 'protocols ip show nhrp'. Apr 17 00:25:40.999463 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:95:38:40:00:40:2f:5b:b3:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Apr 17 00:25:41.003320 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 Apr 17 00:25:41.003362 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 Apr 17 00:25:41.999964 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:96:28:40:00:40:2f:5a:c3:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Apr 17 00:25:42.000032 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 Apr 17 00:25:42.000041 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 Apr 17 00:25:42.222869 osdx OSDxCLI[1117731]: User 'admin' executed a new command: 'protocols ip show nhrp'.
Step 5: Run command traffic policy show at DUT0 and check if 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