LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2014, 12:21 PM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 258

Rep: Reputation: Disabled
Firewall block not working?


I have the two iptables records below. The 1.171.0.0/16 record was entered into the iptables some weeks ago. Today the 1.171.67.85 record hit with an invalid request, so it was blocked. My questions is, why didn't the 1.171.0.0/16 block the 1.171.67.85 hit? 1.171.67.85 falls within its CIDR range.

125 6 240 DROP all -- * * 1.171.0.0/16 0.0.0.0/0 /* tiawan */

156 0 0 DROP all -- * * 1.171.67.85 0.0.0.0/0 /* TW BOA 1 Sep 13 2014 07:05:02 AM */

Thanks.
 
Old 09-14-2014, 06:09 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Looking at the source IP filter alone, the first rule should cover all packets from 1.171.0.0/16. However, the rule could have other match criteria than the ones displayed above. Have a look at the output from iptables-save to see the entire ruleset with all details.
 
Old 09-14-2014, 07:44 AM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 258

Original Poster
Rep: Reputation: Disabled
My iptables-save file has
-A INPUT -s 1.171.0.0/16 -m comment --comment tiawan -j DROP

followed down the list by
-A INPUT -s 1.171.67.85/32 -m comment --comment "TW BOA 1 Sep 13 2014 07:05:02 AM" -j DROP

It seems to me that the first record should have caught and DROPped the second.
 
Old 09-14-2014, 09:24 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
I would think so too, unless the packet from 1.171.67.85 didn't have a destination address matching one on the firewall, in which case it would be processed by the FORWARD chain instead.

Are you saying you can see matches against the second rule in the logs, even though the rule is clearly a subset of the earlier rule? Did you add these rules manually?

(It's "Taiwan", BTW.)
 
Old 09-14-2014, 09:41 AM   #5
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 258

Original Poster
Rep: Reputation: Disabled
You caught me (It's "Taiwan", BTW.).

Yes, the rule (1.171.67.85/32) is clearly a subset of the earlier rule (1.171.0.0/16), a CIDR which I manually entered some time back. I had this happen with another IP recently. Apparently there is some kind of fluke going on with the firewall causing this. Most all other records show that IP are being dropped. Here are a few:

Code:
num   pkts bytes target     prot opt in     out     source               destination         
32      30  1326 DROP       all  --  *      *       60.169.0.0/16        0.0.0.0/0            /* china */
33       2   147 DROP       all  --  *      *       60.170.0.0/16        0.0.0.0/0            /* china */
34       3   218 DROP       all  --  *      *       60.172.0.0/16        0.0.0.0/0            /* china */
35     185  8702 DROP       all  --  *      *       60.173.0.0/16        0.0.0.0/0            /* china */
36       2   110 DROP       all  --  *      *       60.174.0.0/16        0.0.0.0/0            /* china */
I was told that 'pkts' represents packets that have hit and been dropped.

Periodic IPs getting through like this isn't a big problem. I'll just live with it and let them stay as /32.

Thanks for you input.

Last edited by battles; 09-14-2014 at 10:14 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 8.04: Transparent proxy using squid working but block domain not working bleketux Linux - Networking 10 03-16-2009 06:41 AM
how to block gtalk through pfsense firewall sreeraj.K.G. Linux - Server 1 01-09-2009 01:00 PM
Block 443 at SUSE firewall shifflav Linux - Networking 2 08-14-2007 03:01 PM
Block P2P on Shorewall Firewall bharathvn Linux - Security 6 02-13-2006 02:25 AM
Why doesnt my firewall block all ports ALInux Linux - Networking 4 12-05-2005 04:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration