0

I need to block some packets in ppp0, and the target ip or source ip of packets are not in

172.17.0.1/24, how to add rules in Iptables? thanks!

2 Answers 2

1

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 172.17.0.0/24 -j ACCEPT
iptables -A ppp0traffic -d 172.17.0.0/24 -j ACCEPT
iptables -A ppp0traffic -j DROP

iptables -A FORWARD -i ppp0 -j ppp0traffic
iptables -A FORWARD -o ppp0 -j ppp0traffic
1
  • Equivalently, ! -s 172.17.0.0/24 ! -d 172.17.0.0/24 -j DROP, but anyhow, that implements and while OP's question (as I read it) asks for or
    – ephemient
    Dec 1, 2010 at 2:53
0

That would have been -A INPUT too.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .