Trying to get ping to work through iptables.

Martin McCormick martin at
Tue Jan 6 15:25:11 UTC 2009

	I have set up the following iptables rules:

sudo iptables -I INPUT 1 -i lo -j ACCEPT
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport echo -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -j DROP

	Everything seems to work as expected except for ping
(echo) which doesn't answer as long as the firewall is in

	I tried also adding

sudo iptables -A INPUT -p udp --dport echo -j ACCEPT

just after the tcp version of that rule and still, no ping.

sudo iptables -A INPUT -j DROP

Is the last rule here as everything that didn't match the
previous rules is supposed to be ignored.

	My thanks to the ubuntu howto for the iptables-howto
document which got me this far. Thanks in advance for any
suggestion as to how to get icmp to work.

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Telecommunications Services Group

More information about the ubuntu-users mailing list