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
Dec 17 18:23:02.349558 osdx systemd-journald[123332]: Runtime Journal (/run/log/journal/a189e667ab9f46898dbfc92a68a94f73) is 1.8M, max 13.8M, 11.9M free. Dec 17 18:23:02.351374 osdx systemd-journald[123332]: Received client request to rotate journal, rotating. Dec 17 18:23:02.351448 osdx systemd-journald[123332]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a189e667ab9f46898dbfc92a68a94f73. Dec 17 18:23:02.379732 osdx OSDxCLI[142114]: User 'admin' executed a new command: 'system journal clear'. Dec 17 18:23:02.618326 osdx OSDxCLI[142114]: User 'admin' executed a new command: 'system coredump delete all'. Dec 17 18:23:03.000308 osdx OSDxCLI[142114]: User 'admin' entered the configuration menu. Dec 17 18:23:03.117672 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 192.168.100.10/24'. Dec 17 18:23:03.192596 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-out LOG_NHRP'. Dec 17 18:23:03.310722 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 traffic policy link-in LOG_NHRP'. Dec 17 18:23:03.409931 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 address 10.0.0.1/32'. Dec 17 18:23:03.510758 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 encapsulation gre'. Dec 17 18:23:03.590954 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 local-address 192.168.100.10'. Dec 17 18:23:03.694376 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set interfaces tunnel tun0 nhrp'. Dec 17 18:23:03.795430 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 log prefix NHRP__'. Dec 17 18:23:03.874569 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set traffic policy LOG_NHRP rule 1 selector NHRP_SEL'. Dec 17 18:23:03.945582 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'set traffic selector NHRP_SEL rule 1 ether-type 8193'. Dec 17 18:23:04.059417 osdx OSDxCLI[142114]: User 'admin' added a new cfg line: 'show working'. Dec 17 18:23:04.162538 osdx ubnt-cfgd[259013]: inactive Dec 17 18:23:04.247623 osdx systemd[1]: Reloading frr.service - FRRouting... Dec 17 18:23:04.262736 osdx watchfrr[239188]: [NG1AJ-FP2TQ] Terminating on signal Dec 17 18:23:04.363836 osdx frrinit.sh[259043]: Stopped watchfrr. Dec 17 18:23:04.364896 osdx frrinit.sh[259043]: 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'. Dec 17 18:23:04.371754 osdx watchfrr[259061]: [T83RR-8SM5G] watchfrr 10.4.1 starting: vty@0 Dec 17 18:23:04.371815 osdx watchfrr[259061]: [QDG3Y-BY5TN] zebra state -> up : connect succeeded Dec 17 18:23:04.371842 osdx watchfrr[259061]: [QDG3Y-BY5TN] mgmtd state -> up : connect succeeded Dec 17 18:23:04.371919 osdx watchfrr[259061]: [ZCJ3S-SPH5S] nhrpd state -> down : initial connection attempt failed Dec 17 18:23:04.371922 osdx watchfrr[259061]: [QDG3Y-BY5TN] staticd state -> up : connect succeeded Dec 17 18:23:04.372357 osdx watchfrr[259061]: [YFT0P-5Q5YX] Forked background command [pid 259062]: /usr/lib/frr/watchfrr.sh restart nhrpd Dec 17 18:23:04.377086 osdx frrinit.sh[259062]: Cannot stop nhrpd: pid file not found Dec 17 18:23:04.378169 osdx watchfrr.sh[259067]: Cannot stop nhrpd: pid file not found Dec 17 18:23:04.390324 osdx zebra[232217]: [V98V0-MTWPF] client 36 says hello and bids fair to announce only nhrp routes vrf=0 Dec 17 18:23:04.399542 osdx frrinit.sh[259072]: sh: line 1: ipsec: command not found Dec 17 18:23:04.400850 osdx watchfrr[259061]: [QDG3Y-BY5TN] nhrpd state -> up : connect succeeded Dec 17 18:23:04.400857 osdx watchfrr[259061]: [KWE5Q-QNGFC] all daemons up, doing startup-complete notify Dec 17 18:23:04.401362 osdx frrinit.sh[259043]: Started watchfrr. Dec 17 18:23:04.503771 osdx systemd[1]: Reloaded frr.service - FRRouting. Dec 17 18:23:04.531335 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Dec 17 18:23:04.576397 osdx WARNING[259164]: No supported link modes on interface eth0 Dec 17 18:23:04.577903 osdx modulelauncher[259164]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on Dec 17 18:23:04.577918 osdx modulelauncher[259164]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76. Dec 17 18:23:04.579208 osdx modulelauncher[259164]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off -- Dec 17 18:23:04.579217 osdx modulelauncher[259164]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75. Dec 17 18:23:04.604882 osdx (udev-worker)[259192]: Network interface NamePolicy= disabled on kernel command line. Dec 17 18:23:04.841830 osdx cfgd[1460]: [142114]Completed change to active configuration Dec 17 18:23:04.856875 osdx OSDxCLI[142114]: User 'admin' committed the configuration. Dec 17 18:23:04.881994 osdx OSDxCLI[142114]: User 'admin' left the configuration menu. Dec 17 18:23:06.722348 osdx OSDxCLI[142114]: User 'admin' executed a new command: 'protocols ip show nhrp'. Dec 17 18:23:07.599940 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:ca:4c:40:00:40:2f:26:9f:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Dec 17 18:23:07.603332 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 Dec 17 18:23:07.603378 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 Dec 17 18:23:08.600420 osdx kernel: [NHRP__-1] ACCEPT IN=tun0 OUT= MAC=45:00:00:74:ca:79:40:00:40:2f:26:72:c0:a8:64:14:c0:a8:64:0a:00:00:20:01 Dec 17 18:23:08.603334 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 Dec 17 18:23:08.603375 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 Dec 17 18:23:08.794335 osdx OSDxCLI[142114]: 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