I have a question about IPFW. EXTERNAL INTERFACE is the external address a router running FreeBSD as a network gateway. IPFW rules are as follows. These are dynamic rules.
It worked. But while tuning the firewall for other needs, it suddenly stopped.
I had to pull 1800 1900 rules before the static blocking rule, which blocking all incoming connections that are not established from the router.
It also doesn't work when instead of "me", which is the router's IP, there is "any", which is whatever is on that output.
At this point it is set up as follows, and it works:
The log shows blocking on rule 1300 when port 53 is placed under static rule.
My question is:
Why did it work at first?
How did it work why did it stop?
Code:
#EXTERNAL INTERFACE
ipfw -q add 1300 deny all from any to any in via $ext_if
ipfw -q add 1400 allow udp from me to any 68 out keep-state via $ext_if
ipfw -q add 1500 allow udp from me to any 67 out keep-state via $ext_if
ipfw -q add 1800 allow tcp from me to any 53 out setup keep-state via $ext_if
ipfw -q add 1900 allow udp from me to any 53 out keep-state via $ext_if
ipfw -q add 2000 allow tcp from me to any 80 out setup keep-state via $ext_if
ipfw -q add 2100 allow tcp from me to any 443 out setup keep-state via $ext_if
ipfw -q add 2200 deny all from any to any via $ext_if
It worked. But while tuning the firewall for other needs, it suddenly stopped.
I had to pull 1800 1900 rules before the static blocking rule, which blocking all incoming connections that are not established from the router.
It also doesn't work when instead of "me", which is the router's IP, there is "any", which is whatever is on that output.
At this point it is set up as follows, and it works:
Code:
ipfw -q add 1210 allow tcp from $my_ip to any 53 out setup keep-state via $ext_if
ipfw -q add 1220 allow udp from $my_ip to any 53 out keep-state via $ext_if
ipfw -q add 1300 deny all from any to any in via $ext_if
ipfw -q add 1400 allow udp from $my_ip to any 68 out keep-state via $ext_if
ipfw -q add 1500 allow udp from $my_ip to any 67 out keep-state via $ext_if
ipfw -q add 2000 allow tcp from $my_ip to any 80 out setup keep-state via $ext_if
ipfw -q add 2100 allow tcp from $my_ip to any 443 out setup keep-state via $ext_if
ipfw -q add 2200 deny all from any to any via $ext_if
The log shows blocking on rule 1300 when port 53 is placed under static rule.
My question is:
Why did it work at first?
How did it work why did it stop?