Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to block some packets in ppp0, and the target ip or source ip of packets are not in, how to add rules in Iptables? thanks!

share|improve this question
up vote 1 down vote accepted

i'm not sure if this is what you really want but this is what you are describing:

iptables -N ppp0traffic
iptables -A ppp0traffic -s -j ACCEPT
iptables -A ppp0traffic -d -j ACCEPT
iptables -A ppp0traffic -j DROP

iptables -A FORWARD -i ppp0 -j ppp0traffic
iptables -A FORWARD -o ppp0 -j ppp0traffic
share|improve this answer
Equivalently, ! -s ! -d -j DROP, but anyhow, that implements and while OP's question (as I read it) asks for or – ephemient Dec 1 '10 at 2:53

That would have been -A INPUT too.

But if you do not have a route to (check with ip route show table all), then these packets get automatically dropped; no need for rules.

share|improve this answer

Your Answer


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.