Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-26-2013, 03:18 AM
|
#1
|
LQ Newbie
Registered: Jul 2011
Posts: 4
Rep: 
|
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.
|
|
|
09-26-2013, 05:30 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
09-26-2013, 05:36 AM
|
#3
|
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: 
|
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.
|
|
|
09-26-2013, 05:47 AM
|
#4
|
LQ Newbie
Registered: Jul 2011
Posts: 4
Original Poster
Rep: 
|
Thanks you!
Looks like I somewhere failed with my script, because now it is working how I expected.
|
|
|
All times are GMT -5. The time now is 05:36 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|