I am trying to figure out a firewall configuration for a device running 18.06.1. I realise 18.06 is old, but I need to understand some of this before I can migrate to a more recent version.
The device (MT7628 based) is not being used as a home router, so I've named the firewall (firewall3
) zones differently — they're no longer called 'lan'
and 'wan'
but are split up and named differently eg. the closest thing to 'wan'
is currently called 'internet'
. I have completely replaced the default /etc/config/firewall
so I'm not appending to it or anything.
When I run service firewall reload
over serial, I see (I'm only posting the warnings here):
Warning: fw3_ipt_rule_append(): Can't find target 'input_internet_rule'
Warning: fw3_ipt_rule_append(): Can't find target 'output_internet_rule'
Warning: fw3_ipt_rule_append(): Can't find target 'forwarding_internet_rule'
It seems that iptables
has some custom chains defined to match the zones in /etc/config/firewall
eg. iptables -L
contains these chains (again, not posting whole output):
Chain zone_lan_forward (0 references)
target prot opt source destination
Chain zone_lan_input (0 references)
target prot opt source destination
Chain zone_lan_output (0 references)
target prot opt source destination
Chain zone_wan_forward (0 references)
target prot opt source destination
Chain zone_wan_input (0 references)
target prot opt source destination
Chain zone_wan_output (0 references)
target prot opt source destination
I can see that in the firewall3
source code, in zones.c
, there is indeed a list of chains to create eg.
C(ANY, FILTER, CUSTOM_CHAINS, "input_?_rule"),
C(ANY, FILTER, CUSTOM_CHAINS, "output_?_rule"),
C(ANY, FILTER, CUSTOM_CHAINS, "forwarding_?_rule"),
What I can't figure out is why my own aren't being created? If I replace the zones in /etc/config/firewall
with eg.
config zone 'internet'
option name internet
list network 'modem0'
list network 'modem1'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
...and reload
or restart
the firewall
service, iptables has none of these chains (neither the previous lan
/wan
ones or my own). Even if I reboot. But if I put the old /etc/firewall/config
back (from /rom
) and reboot, the lan
/wan
chains show up!
What is the step or service that causes these to be created? I'm struggling to debug it because I don't even know when or where I should start looking for the issue beyond what I've found.