Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|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. –  Iain 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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