Thursday, October 2, 2008

Disable Ping Response in ubuntu Linux

Ping is used to check if a machine is up, Most of the hackers are using ping for finding the hackable machine. The hacking chances can be reduced by blocking ping.

in ubuntu ping can be disable by adding following line to /etc/init.d/networking (network init script)
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

to re-enable

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

1 comment:

Anonymous said...

in 8.04.1 /etc/sysctl.conf add:
# Ignore ICMP broadcasts
net/ipv4/icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net/ipv4/icmp_ignore_bogus_error_responses = 1
#
# Do not accept ICMP redirects (prevent MITM attacks)
net/ipv4/conf/all/accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
net/ipv4/conf/all/secure_redirects = 0
#
# Do not send ICMP redirects (we are not a router)
net/ipv4/conf/all/send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net/ipv4/conf/all/accept_source_route = 0

also add to /etc/ufw/sysctl.conf:

#Ignorar Broadcast.
net/ipv4/icmp_echo_ignore_broadcasts=1

#Ignorar pings.
net/ipv4/icmp_echo_ignore_all=1

#No responder a paquetes icmp defectuosos.
net/ipv4/icmp_ignore_bogus_error_responses=1