I'm trying to block a specific client access to the WAN with this:
iptables -I FORWARD -s 192.168.X.X -o $WAN_INTERFACE -j DROP
I however need a exception to allow outbound connections to a specific IP, so I need an ACCEPT rule before it in the right chain.
What is the best way to create this exception and block everything else?
If you specify
-I
on iptables then you need to specify the rule number, what you can do is:This way you will first insert a rule to deny this IP access to Internet, then you will put in first position a rule allowing specific access to this IP to somewhere.