Hi there
I’m new to the VyOS, and what frustrates me is the firewall configuration.
Thus, I need your kind help to get it done.
Thanks in advance.
Context:
- VyOS 1.4
- Intel X710-DA2
- i5-8400T
- 32G RAM
Question is:
- How can I implement a correct Flowtable implementation for the below-running firewall configuration?
- Is a zone-based firewall supported flowable also?
- I noticed ⚓ T4502 Consider implementing (NAT/other) flow table offload, and it should be applied to 1.4.x sagitta
- And this thread also: how-to-use-flowtables-in-vyos-1-4-with-zone-based-firewall/13004/7
- What criteria can support/implement the hardware offload?
Here is the firewall configuration:
#
# Global Configuration Items
#
set firewall global-options all-ping 'enable'
set firewall global-options broadcast-ping 'disable'
set firewall global-options ip-src-route 'disable'
set firewall global-options ipv6-src-route 'disable'
set firewall global-options log-martians 'enable'
set firewall global-options receive-redirects 'disable'
set firewall global-options send-redirects 'disable'
set firewall global-options source-validation 'strict'
set firewall global-options state-policy established action 'accept'
set firewall global-options state-policy related action 'accept'
set firewall global-options state-policy invalid action 'drop'
set firewall global-options state-policy invalid log
set firewall global-options state-policy invalid log-level 'warn'
set firewall global-options syn-cookies 'enable'
set firewall global-options resolver-cache
commit
#
# IPV4
#
# Group: Network, Interfaces, Ports
set firewall group network-group HomeLAN-v4 network '192.168.1.0/24'
set firewall group ipv6-network-group HomeLAN-v6 network 'fd12:3456:789a:1::/64'
set firewall group interface-group WAN interface eth2
set firewall group interface-group WAN interface pppoe0
set firewall group interface-group LAN interface eth3
set firewall group interface-group LAN interface eth1
set firewall group interface-group Mgmt interface eth0
set firewall group port-group PORT-TEAMS-UDP port '3478-3481'
set firewall group port-group Web-TCP port '80'
set firewall group port-group Web-TCP port '443'
set firewall group port-group Service_TCP-UDP port '53'
set firewall group port-group Service_TCP-UDP port '7777'
set firewall group port-group Service_TCP-UDP port '67'
set firewall group port-group Service_TCP-UDP port '68'
set firewall group port-group Service_TCP-UDP port '3000'
set firewall group port-group Service_TCP-UDP port '3001'
commit
# Rules
set firewall ipv4 name CONN_FILTER default-action 'return'
set firewall ipv4 name CONN_FILTER rule 10 action 'accept'
set firewall ipv4 name CONN_FILTER rule 10 state established
set firewall ipv4 name CONN_FILTER rule 10 state related
set firewall ipv4 name WAN-IN default-action 'drop'
set firewall ipv4 name VyOS_Mgmt default-action 'return'
set firewall ipv4 name VyOS_Mgmt rule 10 action 'accept'
set firewall ipv4 name VyOS_Mgmt rule 10 state new
set firewall ipv4 name VyOS_Mgmt rule 10 state established
set firewall ipv4 name VyOS_Mgmt rule 10 inbound-interface group 'Mgmt'
set firewall ipv4 name VyOS_Mgmt rule 20 action 'accept'
set firewall ipv4 name VyOS_Mgmt rule 20 state related
set firewall ipv4 name VyOS_Mgmt rule 20 inbound-interface group 'Mgmt'
commit
# Chains
## Forward
set firewall ipv4 forward filter rule 10 action 'jump'
set firewall ipv4 forward filter rule 10 jump-target CONN_FILTER
set firewall ipv4 forward filter rule 100 action jump
set firewall ipv4 forward filter rule 100 jump-target WAN-IN
set firewall ipv4 forward filter rule 100 inbound-interface group WAN
set firewall ipv4 forward filter rule 100 destination group network-group HomeLAN-v4
## Input
### Allow internet access.
set firewall ipv4 input filter default-action 'drop'
set firewall ipv4 input filter rule 10 action 'jump'
set firewall ipv4 input filter rule 10 jump-target CONN_FILTER
### Allow Management access.
set firewall ipv4 input filter rule 20 action jump
set firewall ipv4 input filter rule 20 jump-target VyOS_Mgmt
set firewall ipv4 input filter rule 20 destination group port-group Service_TCP-UDP
set firewall ipv4 input filter rule 20 protocol tcp
### Allow services access
set firewall ipv4 input filter rule 30 action 'accept'
set firewall ipv4 input filter rule 30 icmp type-name 'echo-request'
set firewall ipv4 input filter rule 30 protocol 'icmp'
set firewall ipv4 input filter rule 30 state new
set firewall ipv4 input filter rule 30 inbound-interface group '!WAN'
set firewall ipv4 input filter rule 40 action 'accept'
set firewall ipv4 input filter rule 40 destination group port-group Service_TCP-UDP
set firewall ipv4 input filter rule 40 protocol 'tcp_udp'
set firewall ipv4 input filter rule 40 source group network-group HomeLAN-v4
### Allowing all connections coming from localhost
set firewall ipv4 input filter rule 50 action 'accept'
set firewall ipv4 input filter rule 50 source address 127.0.0.0/8
### Allowing ntopNG access
set firewall ipv4 input filter rule 60 action 'accept'
set firewall ipv4 input filter rule 60 description 'Allow ntopNG access'
set firewall ipv4 input filter rule 60 inbound-interface name 'lo'
commit
save
Here is the firewall summary.
ouzy@vyos:~$ show firewall
Rulesets Information
---------------------------------
ipv4 Firewall "forward filter"
Rule Action Protocol Packets Bytes Conditions
------- -------- ---------- --------- ------- -------------------------------------------------------
10 jump all 18030 1550241 jump NAME_CONN_FILTER
100 jump all 0 0 ip daddr @N_HomeLAN-v4 iifname @I_WAN jump NAME_WAN-IN
default accept all 18030 1550241
---------------------------------
ipv4 Firewall "input filter"
Rule Action Protocol Packets Bytes Conditions
------- -------- ---------- --------- ------- ------------------------------------------------------------------------------------
10 jump all 16803 2357884 jump NAME_CONN_FILTER
20 jump tcp 94 4852 tcp dport @P_Service_TCP-UDP jump NAME_VyOS_Mgmt
30 accept icmp 4 112 ct state new iifname != @I_WAN icmp type echo-request accept
40 accept tcp_udp 154 15852 meta l4proto { tcp, udp } th dport @P_Service_TCP-UDP ip saddr @N_HomeLAN-v4 accept
50 accept all 3 180 ip saddr 127.0.0.0/8 accept
60 accept all 4 224 iifname "lo" accept
default drop all 16547 2336784
---------------------------------
ipv4 Firewall "name CONN_FILTER"
Rule Action Protocol Packets Bytes Conditions
------- -------- ---------- --------- ------- -----------------------------------------
10 accept all 0 0 ct state { established, related } accept
default return all 34833 3908125
---------------------------------
ipv4 Firewall "name VyOS_Mgmt"
Rule Action Protocol Packets Bytes Conditions
------- -------- ---------- --------- ------- -----------------------------------------------------
10 accept all 91 4732 ct state { established, new } iifname @I_Mgmt accept
20 accept all 0 0 ct state related iifname @I_Mgmt accept
default return all 3 120
---------------------------------
ipv4 Firewall "name WAN-IN"
Rule Action Protocol Packets Bytes
------- -------- ---------- --------- -------
default drop all 0 0
The first try but no luck.
This one took the Flowtables Firewall Configuration — VyOS 1.4.x (sagitta) documentation as a reference.
### change Forward chain rule
set firewall ipv4 name CONN_FILTER rule 15 action 'offload'
set firewall ipv4 name CONN_FILTER rule 15 offload-target 'FT-WAN-LAN'
set firewall ipv4 name CONN_FILTER rule 15 state 'established'
set firewall ipv4 name CONN_FILTER rule 15 state 'related'
The 2nd try, but no luck too.
## official example as ref.
delete firewall ipv4 forward filter rule 10 action 'jump'
delete firewall ipv4 forward filter rule 10 jump-target CONN_FILTER
delete firewall ipv4 forward filter rule 100 action jump
delete firewall ipv4 forward filter rule 100 jump-target WAN-IN
delete firewall ipv4 forward filter rule 100 inbound-interface group WAN
delete firewall ipv4 forward filter rule 100 destination group network-group HomeLAN-v4
set firewall ipv4 forward filter default-action 'drop' // I have to change to delete given it blocked internet access after implementation.
set firewall ipv4 forward filter rule 10 action 'offload'
set firewall ipv4 forward filter rule 10 offload-target 'FT-WAN-LAN'
set firewall ipv4 forward filter rule 10 state 'established'
set firewall ipv4 forward filter rule 10 state 'related'
set firewall ipv4 forward filter rule 20 action 'accept'
set firewall ipv4 forward filter rule 20 state 'established'
set firewall ipv4 forward filter rule 20 state 'related'
set firewall ipv4 forward filter rule 100 action 'accept'
set firewall ipv4 forward filter rule 100 inbound-interface group WAN
set firewall ipv4 forward filter rule 100 destination group network-group HomeLAN-v4
Addtional info
show interfaces ethernet eth2 physical
Settings for eth2:
Supported ports: [ FIBRE ]
Supported link modes: 10000baseSR/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10000baseSR/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 10000Mb/s
Duplex: Full
Auto-negotiation: off
Port: FIBRE
PHYAD: 0
Transceiver: internal
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
Ring parameters for eth2:
Pre-set maximums:
RX: 4096
RX Mini: n/a
RX Jumbo: n/a
TX: 4096
TX push buff len: n/a
Current hardware settings:
RX: 4096
RX Mini: n/a
RX Jumbo: n/a
TX: 4096
RX Buf Len: n/a
CQE Size: n/a
TX Push: off
RX Push: off
TX push buff len: n/a
TCP data split: n/a
driver: i40e
version: 6.6.49-amd64-vyos
firmware-version: 8.30 0x8000a9c1 1.2766.0
expansion-rom-version:
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes
show interfaces ethernet eth2 physical offload
rx-checksumming on
tx-checksumming on
tx-checksum-ip-generic on
tx-checksum-sctp on
scatter-gather on
tx-scatter-gather on
tcp-segmentation-offload on
tx-tcp-segmentation on
tx-tcp-ecn-segmentation on
tx-tcp-mangleid-segmentation off
tx-tcp6-segmentation on
generic-segmentation-offload on
generic-receive-offload on
rx-vlan-offload on
tx-vlan-offload on
ntuple-filters on
receive-hashing on
highdma on
tx-gre-segmentation on
tx-gre-csum-segmentation on
tx-ipxip4-segmentation on
tx-ipxip6-segmentation on
tx-udp_tnl-segmentation on
tx-udp_tnl-csum-segmentation on
tx-gso-partial on
tx-udp-segmentation on
tx-nocache-copy off
loopback off
l2-fwd-offload off
hw-tc-offload on
rx-udp_tunnel-port-offload on
rx-gro-list off
rx-udp-gro-forwarding off