LinuxQuestions.org
Visit Jeremy's Blog.
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-26-2013, 03:18 AM   #1
jaksis
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Rep: Reputation: Disabled
Iptables established connection


Hello all.

I just want to understand a little bit more iptable rules.
So, I allowed all outgoing connections from server, blocked all incoming. I want to "dig" and "ping" from server, so I create rule
Quote:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
Dig is working, but ping not. Why so?
When I create
Quote:
iptables -A INPUT -p icmp -j ACCEPT
ping is going to work too.

Thanks.
 
Old 09-26-2013, 05:30 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
TBH I can't see anythign offhand to confirm it, but it just seems that ICMP isn't covered by the state module. You can filter ICMP down much more if you want to, to only allow, for example, echo reply to come in to your outbound interface.
 
Old 09-26-2013, 05:36 AM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Code:
iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -d [machine_IP] -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -s [machine_IP] -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT
this could be a help, type 0 for echo-reply and type 8 for echo-request. the above will work even you don't use --icmp-type.
 
Old 09-26-2013, 05:47 AM   #4
jaksis
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks you!

Looks like I somewhere failed with my script, because now it is working how I expected.
 
  


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
iptables to drop packets from an established connection o2cool Linux - Networking 2 09-04-2012 09:43 AM
iptables: using ESTABLISHED and RELATED together seems dangerous linuxStudent11 Linux - Networking 6 04-16-2011 11:30 AM
iptables dropping established packet ? zitak Linux - Security 2 02-01-2011 02:31 AM
How to disconnect established connection in IPTables SlowCoder Linux - Security 8 07-02-2007 09:23 AM
Time out in Connection established state if no Data flows on that connection asurya Linux - Networking 2 04-10-2005 03:54 PM

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

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