Bypass Tests

The following scenario shows different configuration alternatives to improve the OSDx firewall performance.

../../../_images/topology25.svg

Test Local Bypass

Description

Builds a scenario with three DUTs in which a performance test is carried out between DUT1 and DUT2, and DUT0 is the router running the firewall. “Local bypass” is set to allow the firewall to internally skips packets belonging to a flow that must be bypassed. The performance test may produce better results than the general tests.

Scenario

Step 1: Run command file copy http://10.215.168.1/~robot/test-performance.rules running:// force at DUT0 and expect this output:

Show output
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129  100   129    0     0  28641      0 --:--:-- --:--:-- --:--:-- 32250

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.215.168.64/24
set interfaces ethernet eth0 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 vif 101 address 40.0.0.1/8
set interfaces ethernet eth1 vif 101 traffic policy in FW_PLAN
set interfaces ethernet eth1 vif 201 address 20.0.0.1/8
set interfaces ethernet eth1 vif 201 traffic policy in FW_PLAN
set protocols static route 0.0.0.0/0 next-hop 10.215.168.1
set service dns static host-name WAN inet 10.215.168.1
set service firewall FW logging level config
set service firewall FW logging outputs fast
set service firewall FW mode inline queue FW_Q
set service firewall FW ruleset file 'running://test-performance.rules'
set service firewall FW stream bypass
set service firewall FW validator-timeout 20
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set traffic policy FW_PLAN rule 1 action enqueue FW_Q
set traffic queue FW_Q elements 1

Step 3: Ping IP address 20.0.0.2 from DUT1:

admin@DUT1$ ping 20.0.0.2 count 1 size 56 timeout 1
Show output
PING 20.0.0.2 (20.0.0.2) 56(84) bytes of data.
64 bytes from 20.0.0.2: icmp_seq=1 ttl=63 time=0.730 ms

--- 20.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.730/0.730/0.730/0.000 ms

Step 4: Ping IP address 40.0.0.2 from DUT2:

admin@DUT2$ ping 40.0.0.2 count 1 size 56 timeout 1
Show output
PING 40.0.0.2 (40.0.0.2) 56(84) bytes of data.
64 bytes from 40.0.0.2: icmp_seq=1 ttl=63 time=0.767 ms

--- 40.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.767/0.767/0.767/0.000 ms

Step 5: Initiate a bandwidth test from DUT2 to DUT1

admin@DUT1$ monitor test performance server port 5001
admin@DUT2$ monitor test performance client 40.0.0.2 duration 10 port 5001 parallel 1
Expect this output in DUT2:
Connecting to host 40.0.0.2, port 5001
[  5] local 20.0.0.2 port 32856 connected to 40.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  95.2 MBytes   798 Mbits/sec  160   1.41 MBytes
[  5]   1.00-2.00   sec  50.0 MBytes   420 Mbits/sec    0   1.50 MBytes
[  5]   2.00-3.00   sec  50.0 MBytes   419 Mbits/sec    0   1.58 MBytes
[  5]   3.00-4.00   sec  43.8 MBytes   367 Mbits/sec    0   1.63 MBytes
[  5]   4.00-5.00   sec  47.5 MBytes   398 Mbits/sec    0   1.66 MBytes
[  5]   5.00-6.00   sec  47.5 MBytes   398 Mbits/sec    0   1.68 MBytes
[  5]   6.00-7.00   sec  45.0 MBytes   377 Mbits/sec    0   1.69 MBytes
[  5]   7.00-8.00   sec  46.2 MBytes   388 Mbits/sec    0   1.70 MBytes
[  5]   8.00-9.00   sec  46.2 MBytes   388 Mbits/sec    0   1.70 MBytes
[  5]   9.00-10.00  sec  45.0 MBytes   377 Mbits/sec    0   1.70 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   516 MBytes   433 Mbits/sec  160             sender
[  5]   0.00-10.02  sec   515 MBytes   432 Mbits/sec                  receiver

iperf Done.

Step 6: Run command service firewall FW show logging fast | tail at DUT0 and check if output matches the following regular expressions:

(?m)^.+(Skipping test network performance traffic).+$
Show output
07/17/2024-17:46:14.523167  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:32854 -> 40.0.0.2:5001
07/17/2024-17:46:14.524113  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:32856 -> 40.0.0.2:5001

Test Capture Bypass

Description

Builds a scenario with three DUTs in which a performance test is conducted between DUT1 and DUT2, and DUT0 is the router running the firewall. “Capture bypass” is set to allow the firewall to mark packets. An external tool can then decide what to do with the flow when the mark is seen. For this example, when packet marks are detected, the traffic is assigned a label, thereby allowing the possibility of classifying traffic. In particular, labeling avoids traffic from entering the firewall.

Performance must improve considerably compared to the previous test.

Scenario

Step 1: Run command file copy http://10.215.168.1/~robot/test-performance.rules running:// force at DUT0 and expect this output:

Show output
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129  100   129    0     0   7306      0 --:--:-- --:--:-- --:--:--  7588

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.215.168.64/24
set interfaces ethernet eth0 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 vif 101 address 40.0.0.1/8
set interfaces ethernet eth1 vif 101 traffic policy in FW_PLAN
set interfaces ethernet eth1 vif 101 traffic policy out FW-SKIP
set interfaces ethernet eth1 vif 201 address 20.0.0.1/8
set interfaces ethernet eth1 vif 201 traffic policy in FW_PLAN
set interfaces ethernet eth1 vif 201 traffic policy out FW-SKIP
set protocols static route 0.0.0.0/0 next-hop 10.215.168.1
set service dns static host-name WAN inet 10.215.168.1
set service firewall FW logging level config
set service firewall FW logging outputs fast
set service firewall FW mode inline queue FW_Q
set service firewall FW ruleset file 'running://test-performance.rules'
set service firewall FW stream bypass mark 129834765
set service firewall FW stream bypass mask 129834765
set service firewall FW validator-timeout 20
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set traffic label BYPASS
set traffic policy FW-SKIP rule 1 log prefix SKIP
set traffic policy FW-SKIP rule 1 selector MARKED-PACKETS
set traffic policy FW-SKIP rule 1 set label BYPASS
set traffic policy FW_PLAN rule 1 action enqueue FW_Q
set traffic policy FW_PLAN rule 1 selector FW_SEL
set traffic policy FW_PWAN rule 1 selector FW_SEL
set traffic queue FW_Q elements 1
set traffic selector FW_SEL rule 1 not label BYPASS
set traffic selector MARKED-PACKETS rule 1 mark 129834765

Step 3: Ping IP address 20.0.0.2 from DUT1:

admin@DUT1$ ping 20.0.0.2 count 1 size 56 timeout 1
Show output
PING 20.0.0.2 (20.0.0.2) 56(84) bytes of data.
64 bytes from 20.0.0.2: icmp_seq=1 ttl=63 time=0.846 ms

--- 20.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.846/0.846/0.846/0.000 ms

Step 4: Ping IP address 40.0.0.2 from DUT2:

admin@DUT2$ ping 40.0.0.2 count 1 size 56 timeout 1
Show output
PING 40.0.0.2 (40.0.0.2) 56(84) bytes of data.
64 bytes from 40.0.0.2: icmp_seq=1 ttl=63 time=0.510 ms

--- 40.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.510/0.510/0.510/0.000 ms

Step 5: Initiate a bandwidth test from DUT2 to DUT1

admin@DUT1$ monitor test performance server port 5001
admin@DUT2$ monitor test performance client 40.0.0.2 duration 10 port 5001 parallel 1
Expect this output in DUT2:
Connecting to host 40.0.0.2, port 5001
[  5] local 20.0.0.2 port 32838 connected to 40.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   147 MBytes  1.24 Gbits/sec    4   2.05 MBytes
[  5]   1.00-2.00   sec   315 MBytes  2.64 Gbits/sec    0   2.24 MBytes
[  5]   2.00-3.00   sec   339 MBytes  2.84 Gbits/sec    0   2.40 MBytes
[  5]   3.00-4.00   sec   352 MBytes  2.96 Gbits/sec   21   1.80 MBytes
[  5]   4.00-5.00   sec   376 MBytes  3.16 Gbits/sec    0   1.93 MBytes
[  5]   5.00-6.00   sec   384 MBytes  3.22 Gbits/sec    0   2.06 MBytes
[  5]   6.00-7.00   sec   376 MBytes  3.15 Gbits/sec    0   2.18 MBytes
[  5]   7.00-8.00   sec   370 MBytes  3.11 Gbits/sec    0   2.28 MBytes
[  5]   8.00-9.00   sec   341 MBytes  2.86 Gbits/sec   51   1.67 MBytes
[  5]   9.00-10.00  sec   335 MBytes  2.81 Gbits/sec    0   1.85 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  3.26 GBytes  2.80 Gbits/sec   76             sender
[  5]   0.00-10.00  sec  3.26 GBytes  2.80 Gbits/sec                  receiver

iperf Done.

Step 6: Run command service firewall FW show logging fast | tail at DUT0 and check if output matches the following regular expressions:

(?m)^.+(Skipping test network performance traffic).+$
Show output
07/17/2024-17:46:44.322421  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:32824 -> 40.0.0.2:5001
07/17/2024-17:46:44.323462  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:32838 -> 40.0.0.2:5001

Step 7: Run command system journal show | cat at DUT0 and check if output matches the following regular expressions:

(?m)^.*\[SKIP\-1\].*$
Show output
Jul 17 17:46:36.281246 osdx systemd-journald[93647]: Runtime Journal (/run/log/journal/7135572a45764d02b8df631348eed5fb) is 2.1M, max 15.3M, 13.2M free.
Jul 17 17:46:36.284822 osdx systemd-journald[93647]: Received client request to rotate journal, rotating.
Jul 17 17:46:36.284878 osdx systemd-journald[93647]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7135572a45764d02b8df631348eed5fb.
Jul 17 17:46:36.291090 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'system journal clear'.
Jul 17 17:46:36.614219 osdx osdx-coredump[398493]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Jul 17 17:46:36.622267 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'system coredump delete all'.
Jul 17 17:46:37.108694 osdx OSDxCLI[398169]: User 'admin' entered the configuration menu.
Jul 17 17:46:37.221234 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.168.64/24'.
Jul 17 17:46:37.421831 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 traffic nat source rule 1 address masquerade'.
Jul 17 17:46:37.506583 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set protocols static route 0.0.0.0/0 next-hop 10.215.168.1'.
Jul 17 17:46:37.589464 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service dns static host-name WAN inet 10.215.168.1'.
Jul 17 17:46:37.718497 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 101 address 40.0.0.1/8'.
Jul 17 17:46:37.774052 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 201 address 20.0.0.1/8'.
Jul 17 17:46:37.890742 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'show working'.
Jul 17 17:46:37.992810 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 17 17:46:38.044815 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth1
Jul 17 17:46:38.072630 osdx (udev-worker)[398609]: Network interface NamePolicy= disabled on kernel command line.
Jul 17 17:46:38.208702 osdx cfgd[1240]: [398169]Completed change to active configuration
Jul 17 17:46:38.233908 osdx OSDxCLI[398169]: User 'admin' committed the configuration.
Jul 17 17:46:38.249407 osdx OSDxCLI[398169]: User 'admin' left the configuration menu.
Jul 17 17:46:40.252062 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'ping 10.215.168.1      count 1 size 56 timeout 1'.
Jul 17 17:46:40.323727 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'ping 40.0.0.2      count 1 size 56 timeout 1'.
Jul 17 17:46:40.439061 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'ping 20.0.0.2      count 1 size 56 timeout 1'.
Jul 17 17:46:40.931975 osdx file_operation[398687]: using src url: http://10.215.168.1/~robot/test-performance.rules dst url: running://
Jul 17 17:46:40.969528 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'file copy http://10.215.168.1/~robot/test-performance.rules running:// force'.
Jul 17 17:46:41.127613 osdx OSDxCLI[398169]: User 'admin' entered the configuration menu.
Jul 17 17:46:41.199727 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW ruleset file running://test-performance.rules'.
Jul 17 17:46:41.305617 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW mode inline queue FW_Q'.
Jul 17 17:46:41.357826 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW logging outputs fast'.
Jul 17 17:46:41.489200 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW logging level config'.
Jul 17 17:46:41.541631 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW validator-timeout 20'.
Jul 17 17:46:41.644522 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic queue FW_Q elements 1'.
Jul 17 17:46:41.718231 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 101 traffic policy in FW_PLAN'.
Jul 17 17:46:41.804879 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 201 traffic policy in FW_PLAN'.
Jul 17 17:46:41.861611 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW stream bypass mark 129834765'.
Jul 17 17:46:41.957872 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set service firewall FW stream bypass mask 129834765'.
Jul 17 17:46:42.015586 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic label BYPASS'.
Jul 17 17:46:42.116727 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW-SKIP rule 1 log prefix SKIP'.
Jul 17 17:46:42.177306 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW-SKIP rule 1 selector MARKED-PACKETS'.
Jul 17 17:46:42.280568 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW-SKIP rule 1 set label BYPASS'.
Jul 17 17:46:42.340044 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic selector MARKED-PACKETS rule 1 mark 129834765'.
Jul 17 17:46:42.431057 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic selector FW_SEL rule 1 not label BYPASS'.
Jul 17 17:46:42.484894 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW_PLAN rule 1 selector FW_SEL'.
Jul 17 17:46:42.574029 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW_PWAN rule 1 selector FW_SEL'.
Jul 17 17:46:42.636429 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 101 traffic policy out FW-SKIP'.
Jul 17 17:46:42.747421 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set interfaces ethernet eth1 vif 201 traffic policy out FW-SKIP'.
Jul 17 17:46:42.803352 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'set traffic policy FW_PLAN rule 1 action enqueue FW_Q'.
Jul 17 17:46:42.951561 osdx OSDxCLI[398169]: User 'admin' added a new cfg line: 'show working'.
Jul 17 17:46:43.457698 osdx systemd[1]: Reloading.
Jul 17 17:46:43.568804 osdx systemd-sysv-generator[398817]: stat() failed on /etc/init.d/README, ignoring: No such file or directory
Jul 17 17:46:43.685298 osdx systemd[1]: Starting suricata@FW.service - Suricata client "FW" service...
Jul 17 17:46:43.706214 osdx systemd[1]: Started suricata@FW.service - Suricata client "FW" service.
Jul 17 17:46:43.899495 osdx INFO[398798]: Rules successfully loaded
Jul 17 17:46:43.901196 osdx cfgd[1240]: [398169]Completed change to active configuration
Jul 17 17:46:43.903191 osdx OSDxCLI[398169]: User 'admin' committed the configuration.
Jul 17 17:46:43.922113 osdx OSDxCLI[398169]: User 'admin' left the configuration menu.
Jul 17 17:46:44.324840 osdx kernel: [SKIP-1] ACCEPT IN=eth1.201 OUT=eth1.101 MAC=de:ad:be:ef:6c:11:de:ad:be:ef:6c:30:08:00:45:00:00:59 SRC=20.0.0.2 DST=40.0.0.2 LEN=89 TOS=0x00 PREC=0x00 TTL=63 ID=9654 DF PROTO=TCP SPT=32824 DPT=5001 WINDOW=502 RES=0x00 ACK PSH URGP=0 MARK=0x7bd1f0d
Jul 17 17:46:44.324932 osdx kernel: [SKIP-1] ACCEPT IN=eth1.201 OUT=eth1.101 MAC=de:ad:be:ef:6c:11:de:ad:be:ef:6c:30:08:00:45:00:00:59 SRC=20.0.0.2 DST=40.0.0.2 LEN=89 TOS=0x00 PREC=0x00 TTL=63 ID=60890 DF PROTO=TCP SPT=32838 DPT=5001 WINDOW=502 RES=0x00 ACK PSH URGP=0 MARK=0x7bd1f0d
Jul 17 17:46:46.898213 osdx zebra[1205]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Jul 17 17:46:48.051708 osdx zebra[1205]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Jul 17 17:46:50.711679 osdx zebra[1205]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Jul 17 17:46:53.067874 osdx zebra[1205]: [WPPMZ-G9797] if_zebra_speed_update: eth1.201 old speed: 0 new speed: 4294967295
Jul 17 17:46:53.093566 osdx zebra[1205]: [WPPMZ-G9797] if_zebra_speed_update: eth1.101 old speed: 0 new speed: 4294967295
Jul 17 17:46:54.486243 osdx OSDxCLI[398169]: User 'admin' executed a new command: 'service firewall FW show logging fast | tail'.

Test Simple Capture Bypass

Description

Builds a scenario with three DUTs in which a performance test is conducted between DUT1 and DUT2, and DUT0 is the router running the firewall. This test sets the conntrack mark directly, thus skipping all the steps required to set it later.

Performance must improve considerably compared to the previous test.

Scenario

Step 1: Run command file copy http://10.215.168.1/~robot/test-performance.rules running:// force at DUT0 and expect this output:

Show output
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129  100   129    0     0  22337      0 --:--:-- --:--:-- --:--:-- 25800

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.215.168.64/24
set interfaces ethernet eth0 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 vif 101 address 40.0.0.1/8
set interfaces ethernet eth1 vif 101 traffic policy in FW_PLAN
set interfaces ethernet eth1 vif 201 address 20.0.0.1/8
set interfaces ethernet eth1 vif 201 traffic policy in FW_PLAN
set protocols static route 0.0.0.0/0 next-hop 10.215.168.1
set service dns static host-name WAN inet 10.215.168.1
set service firewall FW logging level config
set service firewall FW logging outputs fast
set service firewall FW mode inline queue FW_Q
set service firewall FW ruleset file 'running://test-performance.rules'
set service firewall FW stream bypass mark 129834765
set service firewall FW stream bypass mask 129834765
set service firewall FW stream bypass set-connmark
set service firewall FW validator-timeout 20
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set traffic policy FW_PLAN rule 1 action enqueue FW_Q
set traffic policy FW_PLAN rule 1 selector FW_SEL
set traffic policy FW_PWAN rule 1 selector FW_SEL
set traffic queue FW_Q elements 1
set traffic selector FW_SEL rule 1 not connmark 129834765

Step 3: Ping IP address 20.0.0.2 from DUT1:

admin@DUT1$ ping 20.0.0.2 count 1 size 56 timeout 1
Show output
PING 20.0.0.2 (20.0.0.2) 56(84) bytes of data.
64 bytes from 20.0.0.2: icmp_seq=1 ttl=63 time=0.956 ms

--- 20.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.956/0.956/0.956/0.000 ms

Step 4: Ping IP address 40.0.0.2 from DUT2:

admin@DUT2$ ping 40.0.0.2 count 1 size 56 timeout 1
Show output
PING 40.0.0.2 (40.0.0.2) 56(84) bytes of data.
64 bytes from 40.0.0.2: icmp_seq=1 ttl=63 time=0.606 ms

--- 40.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.606/0.606/0.606/0.000 ms

Step 5: Initiate a bandwidth test from DUT2 to DUT1

admin@DUT1$ monitor test performance server port 5001
admin@DUT2$ monitor test performance client 40.0.0.2 duration 10 port 5001 parallel 1
Expect this output in DUT2:
Connecting to host 40.0.0.2, port 5001
[  5] local 20.0.0.2 port 33142 connected to 40.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   185 MBytes  1.55 Gbits/sec  103   1.42 MBytes
[  5]   1.00-2.00   sec   360 MBytes  3.02 Gbits/sec    0   1.58 MBytes
[  5]   2.00-3.00   sec   349 MBytes  2.93 Gbits/sec    0   1.73 MBytes
[  5]   3.00-4.00   sec   370 MBytes  3.10 Gbits/sec    0   1.87 MBytes
[  5]   4.00-5.00   sec   378 MBytes  3.17 Gbits/sec    0   1.98 MBytes
[  5]   5.00-6.00   sec   358 MBytes  3.00 Gbits/sec    0   2.09 MBytes
[  5]   6.00-7.00   sec   334 MBytes  2.80 Gbits/sec    0   2.20 MBytes
[  5]   7.00-8.00   sec   340 MBytes  2.85 Gbits/sec    0   2.29 MBytes
[  5]   8.00-9.00   sec   336 MBytes  2.82 Gbits/sec    0   2.38 MBytes
[  5]   9.00-10.00  sec   326 MBytes  2.74 Gbits/sec   22   1.80 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  3.26 GBytes  2.80 Gbits/sec  125             sender
[  5]   0.00-10.01  sec  3.26 GBytes  2.79 Gbits/sec                  receiver

iperf Done.

Step 6: Run command service firewall FW show logging fast | tail at DUT0 and check if output matches the following regular expressions:

(?m)^.+(Skipping test network performance traffic).+$
Show output
07/17/2024-17:47:16.574910  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:33126 -> 40.0.0.2:5001
07/17/2024-17:47:16.576111  [**] [1:40:0] Skipping test network performance traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:33142 -> 40.0.0.2:5001

Step 7: Run command system conntrack show at DUT0 and check if output matches the following regular expressions:

(?m)^tcp\s+.*src=20.0.0.2 dst=40.0.0.2.+dport=5001.*mark=129834765.*$
Show output
icmp     1 19 src=20.0.0.2 dst=40.0.0.2 type=8 code=0 id=66 packets=1 bytes=84 src=40.0.0.2 dst=20.0.0.2 type=0 code=0 id=66 packets=1 bytes=84 (Sc: not-bypass) mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=56739 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=56739 packets=0 bytes=0 mark=0 use=1
udp      17 19 src=127.0.0.1 dst=127.0.0.1 sport=46645 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=46645 packets=0 bytes=0 mark=0 use=1
tcp      6 19 TIME_WAIT src=20.0.0.2 dst=40.0.0.2 sport=33126 dport=5001 packets=14 bytes=1198 src=40.0.0.2 dst=20.0.0.2 sport=5001 dport=33126 packets=13 bytes=1018 [ASSURED] (Sc: not-bypass) mark=129834765 use=1
icmp     1 19 src=40.0.0.2 dst=20.0.0.2 type=8 code=0 id=412 packets=1 bytes=84 src=20.0.0.2 dst=40.0.0.2 type=0 code=0 id=412 packets=1 bytes=84 (Sc: not-bypass) mark=0 use=1
tcp      6 9 CLOSE src=20.0.0.2 dst=40.0.0.2 sport=33142 dport=5001 packets=2414902 bytes=3622313765 src=40.0.0.2 dst=20.0.0.2 sport=5001 dport=33142 packets=54398 bytes=2827532 [ASSURED] (Sc: not-bypass) mark=129834765 use=1
udp      17 19 src=127.0.0.1 dst=127.0.0.1 sport=48268 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=48268 packets=0 bytes=0 mark=0 use=1
udp      17 23 src=127.0.0.1 dst=127.0.0.1 sport=40839 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40839 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=39731 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=39731 packets=0 bytes=0 mark=0 use=1
udp      17 23 src=127.0.0.1 dst=127.0.0.1 sport=41253 dport=53 packets=1 bytes=62 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=41253 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.7 (conntrack-tools): 10 flow entries have been shown.

Test Traffic Early Dropping

Description

Builds a scenario with three DUTs and a simple ruleset to drop TCP traffic between DUT1 and DUT2. Such traffic must pass through port 5000 for the rule to match. Later, XDP is queried to check if packets are being dropped at the specified interface.

The contents of the rule file are:

drop tcp any any -> any 5000 (msg: "Dropping TCP performance test traffic"; sid: 1; flow: established, to_server;)

This rule allows the connection to be established and traffic to be dropped later.

Scenario

Step 1: Run command file copy http://10.215.168.1/~robot/drop-performance.rules running://drop-performance.rules force at DUT0 and expect this output:

Show output
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   200  100   200    0     0   4736      0 --:--:-- --:--:-- --:--:--  4651

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.215.168.64/24
set interfaces ethernet eth0 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 vif 101 address 40.0.0.1/8
set interfaces ethernet eth1 vif 101 traffic policy in FW_PLAN
set interfaces ethernet eth1 vif 201 address 20.0.0.1/8
set interfaces ethernet eth1 vif 201 traffic policy in FW_PLAN
set protocols static route 0.0.0.0/0 next-hop 10.215.168.1
set service dns static host-name WAN inet 10.215.168.1
set service firewall FW logging level config
set service firewall FW logging outputs fast
set service firewall FW mode inline queue FW_Q
set service firewall FW ruleset file 'running://drop-performance.rules'
set service firewall FW stream bypass action drop set xdp-early-drop eth1
set service firewall FW validator-timeout 20
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set traffic policy FW_PLAN rule 1 action enqueue FW_Q
set traffic queue FW_Q elements 1

Step 3: Ping IP address 20.0.0.2 from DUT1:

admin@DUT1$ ping 20.0.0.2 count 1 size 56 timeout 1
Show output
PING 20.0.0.2 (20.0.0.2) 56(84) bytes of data.
64 bytes from 20.0.0.2: icmp_seq=1 ttl=63 time=0.752 ms

--- 20.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.752/0.752/0.752/0.000 ms

Step 4: Ping IP address 40.0.0.2 from DUT2:

admin@DUT2$ ping 40.0.0.2 count 1 size 56 timeout 1
Show output
PING 40.0.0.2 (40.0.0.2) 56(84) bytes of data.
64 bytes from 40.0.0.2: icmp_seq=1 ttl=63 time=1.01 ms

--- 40.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.007/1.007/1.007/0.000 ms

Step 5: Initiate a bandwidth test from DUT2 to DUT1

admin@DUT1$ monitor test performance server port 5000
admin@DUT2$ monitor test performance client 40.0.0.2 duration 10 port 5000 parallel 1
Expect this output in DUT2:
^C- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
iperf3: interrupt - the client has terminated
admin@osdx$

Step 6: Run command service firewall FW show logging fast | tail at DUT0 and check if output matches the following regular expressions:

(?m)^.+(Dropping TCP performance test traffic).+$
Show output
07/17/2024-17:47:46.314806  [Drop] [**] [1:1:0] Dropping TCP performance test traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:45960 -> 40.0.0.2:5000

Step 7: Run command service firewall FW show early-drop-stats eth1 at DUT0 and check if output matches the following regular expressions:

yes\s+201\s+\d+\s+[1-9]\d*\s+[1-9]\d*
Show output
------------------------------------------------------------------------
  src       dst     src port  dst port  tcp  vlan_0  vlan_1  pkts  bytes
------------------------------------------------------------------------
20.0.0.2  40.0.0.2     45960      5000  yes     201       0     8    673
40.0.0.2  20.0.0.2      5000     45960  yes     201       0     0      0

Step 8: Run command interfaces ethernet eth1 monitor xdp-stats times 1 at DUT0 and expect this output:

Show output
Pin path: /sys/fs/bpf/eth1
Period of 0.250173s ending at 1721238469.936504
XDP_DROP               9 pkts (         0 pps)           0 KiB (     0 Mbits/s)
XDP_PASS         5458341 pkts (         0 pps)     7733018 KiB (     0 Mbits/s)
XDP_TX                 0 pkts (         0 pps)           0 KiB (     0 Mbits/s)
XDP_REDIRECT           0 pkts (         0 pps)           0 KiB (     0 Mbits/s)

Step 9: Initiate a bandwidth test from DUT2 to DUT1

admin@DUT1$ monitor test performance server port 5001
admin@DUT2$ monitor test performance client 40.0.0.2 duration 30 udp port 5001 parallel 1
Expect this output in DUT2:
^C- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
iperf3: interrupt - the client has terminated
admin@osdx$

Step 10: Run command service firewall FW show logging fast | tail at DUT0 and check if output matches the following regular expressions:

(?m)^.+(Dropping UDP performance test traffic).+$
Show output
07/17/2024-17:47:46.314806  [Drop] [**] [1:1:0] Dropping TCP performance test traffic [**] [Classification: (null)] [Priority: 3] {TCP} 20.0.0.2:45960 -> 40.0.0.2:5000
07/17/2024-17:47:50.066287  [Drop] [**] [1:2:0] Dropping UDP performance test traffic [**] [Classification: (null)] [Priority: 3] {UDP} 20.0.0.2:37245 -> 40.0.0.2:5001

Step 11: Run command service firewall FW show early-drop-stats eth1 at DUT0 and check if output matches the following regular expressions:

yes\s+201\s+\d+\s+[1-9]\d*\s+[1-9]\d*
Show output
------------------------------------------------------------------------
  src       dst     src port  dst port  tcp  vlan_0  vlan_1  pkts  bytes
------------------------------------------------------------------------
20.0.0.2  40.0.0.2     45960      5000  yes     201       0    12    905
40.0.0.2  20.0.0.2      5000     45960  yes     201       0     0      0
40.0.0.2  20.0.0.2      5001     37245  no      201       0     0      0
20.0.0.2  40.0.0.2     37245      5001  no      201       0     0      0

Step 12: Run command interfaces ethernet eth1 monitor xdp-stats times 1 at DUT0 and expect this output:

Show output
Pin path: /sys/fs/bpf/eth1
Period of 0.250172s ending at 1721238473.689349
XDP_DROP              12 pkts (         0 pps)           0 KiB (     0 Mbits/s)
XDP_PASS         5458381 pkts (         0 pps)     7733021 KiB (     0 Mbits/s)
XDP_TX                 0 pkts (         0 pps)           0 KiB (     0 Mbits/s)
XDP_REDIRECT           0 pkts (         0 pps)           0 KiB (     0 Mbits/s)