LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   not responding to ping (https://www.linuxquestions.org/questions/linux-security-4/not-responding-to-ping-238736/)

Chuck23 10-04-2004 03:04 PM

not responding to ping
 
Hello. I'm a relative n00b to linux security, so pardon me if this question seems dumb.

How can I prevent my computer from responding to pings? I assume I need to edit some iptables conf file or another in some way. I'm currently running Fedora Core 1 with the most recent kernel.

More specifically, due to my broadband internet connection, I think I need to be able to respond to pings from my ISP, but I want to ignore all others. How can it be done? Please hold my hand on this one.

Thanks.

serz 10-04-2004 03:34 PM

You can do that with this command:

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

That would block all ping responses. As for only response pings from your ISP, I think you will need iptables.

dcostakos 10-04-2004 03:36 PM

Disabling all ping requests is easy (you should also add this to your startup scripts):
Code:

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
If you have sysctl, you could edit /etc/sysctl.conf and add this line:

Code:

net.ipv4.icmp_echo_ignore_all = 1
And run sysctl -p. This would automagically disable ping responses from your system at boot time.

To enable ping to only your ISP but deny it to everyone else, you'd have to use iptables and know what IP address(es) request ping. This example would allo ping from any address in the 10.0.0.0/255.255.255.0 subnet but deny it from everyone else.

Code:

iptables -A INPUT -p icmp -s 10.0.0.0/24 -j ACCEPT
iptables -A INPUT -p icmp -j REJECT


dcostakos 10-04-2004 03:37 PM

serz beat me to it -- Do'h

Chuck23 10-04-2004 06:49 PM

Will editing sysctl.conf alone do it?

[edit: Apparently so...]

Thanks again!


All times are GMT -5. The time now is 06:08 PM.