Restricting output to only allow localhost using iptables
Posted
by
Dave Forgac
on Server Fault
See other posts from Server Fault
or by Dave Forgac
Published on 2012-03-22T16:29:26Z
Indexed on
2012/03/22
17:33 UTC
Read the original article
Hit count: 222
I would like to restrict outbound traffic to only localhost using iptables. I already have a default DROP policy on OUTPUT and a rule REJECTing all traffic. I need to add a rule above that in the OUTPUT chain.
I have seen a couple different examples for this type of rule, the most common being:
-A OUTPUT -o lo -j ACCEPT
and
-A OUTPUT -o lo -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
Is there any reason to use the latter rather than the former? Can packets on lo
have an address other than 127.0.0.1?
© Server Fault or respective owner