I found masquerading made simple howto very useful and everything works just fine. But I'm not sure about the last line:

iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! ppp0 -j ACCEPT
iptables -P INPUT DROP   #only if the first two are succesful
iptables -A FORWARD -i ppp0 -o ppp0 -j REJECT

There is no explanation in the howto. Why is that for?

I guess it's to reject outside-to-inside traffic, but how it works? Maybe it's better to write -i ppp0 -o eth0 (where eth0 is my local network interface)?


The FORWARD table is used to manage packets that are being routed though the box. That rule basically stops anything being routed via the ppp0 interface.

|improve this answer|||||
  • i still don't understand. My laptop is connected to internet through pc with that configuration. – koddo May 14 '11 at 20:56
  • iptables works from top down so anything that hasn't been previously matched with respect to the FORWARD table will be rejected by that rule. – user9517 May 14 '11 at 20:58
  • oh, i get it. Thanks. Is it better to drop instead of reject? – koddo May 14 '11 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.