LinuxQuestions.org
Help answer threads with 0 replies.
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 02-11-2014, 02:30 AM   #1
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Rep: Reputation: 12
iptables packet filtering issue ? How iptables working.


Hi all,

I got following issue in my project.. I have added the iptables timeout support in my project.

But having following issue.

System Firewall: Second rule is not getting executed when we give different timeouts for the same ip address.
Description : Steps To Reproduce:

1.try following command to block a client form 13 to 16

iptables -A INPUT -s 10.0.6.191 -m time --kerneltz --datestart 2014-2-11T13 --datestop 2014-2-11T16 -j DROP

2.Try the following command to accept the same client from 13.30 to 14

iptables -A INPUT -s 10.0.6.191 -m time --kerneltz --datestart 2014-2-11T13:30 --datestop 2014-2-11T14 -j ACCEPT
Actual Result:

First rule only got executed. (i.e) the client ip is blocked from 2/11/2014 13 to 2/11/2014 16.

Second rule not executed.
Expected Result:

Since the 2 rules differs with timeout, both rules should get executed. (i.e)the client ip should be blocked from 2/11/2014 13 to 2/11/2014 13:30 and 2/11/2014 14 to 2/11/2014 16 It should be accessible in the time period 2/11/2014 13:00 to 2/11/2014 13.30

Kindly tell the cause why the second rule did not executed.

I know it filter the packets.but what makes a packet unique like the ip,port or what . My understanding is once a packet get executed.iptables will not execute any rules for same packet.

But what makes a packet for iptables. and how can we tell this rule is not executed due to this reason..

Thanks
 
Old 02-11-2014, 03:17 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608
Quote:
Originally Posted by pradiptart View Post
Since the 2 rules differs with timeout, both rules should get executed.
Nope. Netfilter uses a "first match wins" strategy so once it hits a "decision" the next rule won't trigger.


Quote:
Originally Posted by pradiptart View Post
how can we tell this rule is not executed
Use logging and in your case ensure there's no time frame overlap. *FWIW also there is (or at least used to be) an iptables module that allowed for querying a /proc entry to make a decision. This means you could use say a cron job or other input to flip access on or off.
 
1 members found this post helpful.
Old 02-12-2014, 01:25 AM   #3
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Original Poster
Rep: Reputation: 12
Thanks for the reply it helped.
 
Old 02-13-2014, 01:16 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608
Then please mark the thread "solved".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
IPTABLES > MAC FILTERING not working rjdbarsal Linux - Server 8 11-20-2015 02:10 PM
IPTABLES > MAC FILTERING not working rjdbarsal Linux - Newbie 1 07-06-2013 11:13 AM
**Help Request - IPTables Packet Filtering** AleLes Linux - Networking 3 12-19-2008 12:25 PM
iptables packet data filtering firewall <Ol>Origy Linux - Networking 1 08-15-2005 06:07 AM
Per-program packet filtering with iptables? tumbelo Linux - Security 1 08-01-2005 10:53 PM

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

All times are GMT -5. The time now is 08:30 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