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 4 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
Jul 24 16:33:42.296437 osdx systemd-journald[919354]: Runtime Journal (/run/log/journal/3a8dbab828fc40a183893e468c03e10b) is 1.8M, max 13.8M, 11.9M free. Jul 24 16:33:42.299217 osdx systemd-journald[919354]: Received client request to rotate journal, rotating. Jul 24 16:33:42.299284 osdx systemd-journald[919354]: Vacuuming done, freed 0B of archived journals from /run/log/journal/3a8dbab828fc40a183893e468c03e10b. Jul 24 16:33:42.306165 osdx OSDxCLI[1164323]: User 'admin' executed a new command: 'system journal clear'. Jul 24 16:33:42.536186 osdx OSDxCLI[1164323]: User 'admin' executed a new command: 'system coredump delete all'. Jul 24 16:33:42.753091 osdx OSDxCLI[1164323]: User 'admin' entered the configuration menu. Jul 24 16:33:42.835931 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 192.168.100.10/24'. Jul 24 16:33:42.925586 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-out LOG_NHRP'. Jul 24 16:33:43.041247 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-in LOG_NHRP'. Jul 24 16:33:43.102570 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 address 10.0.0.1/32'. Jul 24 16:33:43.233697 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 encapsulation gre'. Jul 24 16:33:43.290487 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 local-address 192.168.100.10'. Jul 24 16:33:43.387534 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 nhrp'. Jul 24 16:33:43.454000 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 log prefix NHRP__'. Jul 24 16:33:43.547746 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 selector NHRP_SEL'. Jul 24 16:33:43.642735 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'set traffic selector NHRP_SEL rule 1 ether-type 8193'. Jul 24 16:33:43.755785 osdx OSDxCLI[1164323]: User 'admin' added a new cfg line: 'show working'. Jul 24 16:33:43.840149 osdx ubnt-cfgd[1165675]: inactive Jul 24 16:33:43.923595 osdx systemd[1]: Reloading frr.service - FRRouting... Jul 24 16:33:43.940509 osdx watchfrr[1122835]: [NG1AJ-FP2TQ] Terminating on signal Jul 24 16:33:44.041546 osdx frrinit.sh[1165710]: Stopped watchfrr. Jul 24 16:33:44.042745 osdx frrinit.sh[1165710]: 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'. Jul 24 16:33:44.049565 osdx watchfrr[1165728]: [T83RR-8SM5G] watchfrr 10.6.0 starting: vty@0 Jul 24 16:33:44.049611 osdx watchfrr[1165728]: [QDG3Y-BY5TN] mgmtd state -> up : connect succeeded Jul 24 16:33:44.049640 osdx watchfrr[1165728]: [QDG3Y-BY5TN] zebra state -> up : connect succeeded Jul 24 16:33:44.049672 osdx watchfrr[1165728]: [ZCJ3S-SPH5S] nhrpd state -> down : initial connection attempt failed Jul 24 16:33:44.049675 osdx watchfrr[1165728]: [QDG3Y-BY5TN] staticd state -> up : connect succeeded Jul 24 16:33:44.049812 osdx watchfrr[1165728]: [YFT0P-5Q5YX] Forked background command [pid 1165729]: /usr/lib/frr/watchfrr.sh restart nhrpd Jul 24 16:33:44.053547 osdx frrinit.sh[1165729]: Cannot stop nhrpd: pid file not found Jul 24 16:33:44.054409 osdx watchfrr.sh[1165734]: Cannot stop nhrpd: pid file not found Jul 24 16:33:44.066499 osdx zebra[808392]: [V98V0-MTWPF] client 41 says hello and bids fair to announce only nhrp routes vrf=0 Jul 24 16:33:44.075950 osdx frrinit.sh[1165739]: sh: line 1: ipsec: command not found Jul 24 16:33:44.086216 osdx nhrpd[1165736]: [W9E3X-A5P3X] nhrpd: set-config-loaded received, marking as loaded Jul 24 16:33:44.087007 osdx watchfrr[1165728]: [QDG3Y-BY5TN] nhrpd state -> up : connect succeeded Jul 24 16:33:44.087017 osdx watchfrr[1165728]: [KWE5Q-QNGFC] all daemons up, doing startup-complete notify Jul 24 16:33:44.087456 osdx frrinit.sh[1165710]: Started watchfrr. Jul 24 16:33:44.184115 osdx systemd[1]: Reloaded frr.service - FRRouting. Jul 24 16:33:44.215222 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Jul 24 16:33:44.258634 osdx WARNING[1165835]: No supported link modes on interface eth0 Jul 24 16:33:44.259975 osdx modulelauncher[1165835]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on Jul 24 16:33:44.259986 osdx modulelauncher[1165835]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76. Jul 24 16:33:44.261225 osdx modulelauncher[1165835]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off -- Jul 24 16:33:44.261235 osdx modulelauncher[1165835]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75. Jul 24 16:33:44.275369 osdx (udev-worker)[1165852]: Network interface NamePolicy= disabled on kernel command line. Jul 24 16:33:44.696479 osdx cfgd[1923]: [1164323]Completed change to active configuration Jul 24 16:33:44.697001 osdx OSDxCLI[1164323]: User 'admin' committed the configuration. Jul 24 16:33:44.713088 osdx OSDxCLI[1164323]: User 'admin' left the configuration menu. Jul 24 16:33:46.535730 osdx OSDxCLI[1164323]: User 'admin' executed a new command: 'protocols ip show nhrp'. Jul 24 16:33:47.219236 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:9f:64:40:00:40:2f:51:87:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Jul 24 16:33:47.219321 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 Jul 24 16:33:47.219334 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 Jul 24 16:33:48.219477 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:a0:58:40:00:40:2f:50:93:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Jul 24 16:33:48.223223 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 Jul 24 16:33:48.223262 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 Jul 24 16:33:48.608112 osdx OSDxCLI[1164323]: 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