ipfw blocks IP address not in table
FreeBSD theranch 10.3-RELEASE-p11 FreeBSD 10.3-RELEASE-p11 #0: Mon Oct 24 18:49:24 UTC 2016 email@example.com:/usr/obj/usr/src/sys/GENERIC amd64
Here is the situation. I am using IPFW to block ranges of IPs from accessing email ports other than 25. (Port 25 is needed for incoming mail). I’m blocking all the IMAP and POP ports using several tables I have created. The particular problem is with IPFW table 1 that I create with a shell script. Occasionally my IP address starts with 208 (i.e. 208.xxx.xxx.xxx) and the table blocks it EVEN though my IP is not contained in the table.
As a test, I comments out any line that puts an IP starting with 208 in the table. For example
#joes datacenter ipfw table 1 add 188.8.131.52/21 ipfw table 1 add 184.108.40.206/19 ipfw table 1 add 220.127.116.11/20 ipfw table 1 add 18.104.22.168/22 ipfw table 1 add 22.214.171.124/21 ipfw table 1 add 126.96.36.199/21 ipfw table 1 add 188.8.131.52/21 ##ipfw table 1 add 184.108.40.206/21
Using ipfw table 1 list >file and editing that file, here is the proof that IPs starting with 208 are not in the table:
220.127.116.11/18 0 18.104.22.168/20 0 22.214.171.124/32 0 126.96.36.199/20 0 188.8.131.52/16 0 184.108.40.206/20 0 220.127.116.11/23 0 18.104.22.168/23 0 22.214.171.124/22 0
From /var/log/security (with a little sanitizing):
Feb 20 10:04:17 theranch kernel: ipfw: 553 Deny TCP 126.96.36.199:18791 mydoip.198:143 in via vtnet0
Here is the relevant rc.firewall line that creates rule 553:
00553 deny log ip from table(1) to any dst-port 143
In summary, I have shown that there are no entries in ipfw table 1 that start with 208 (i.e. 208.xxx.xxx.xxx). Yet my IP is blocked.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.