0

When I run this command :

sudo iptables -I FORWARD '!' -s x.x.x.x,y.y.y.y -d 172.18.0.3 -p tcp --dport 9114 -j DROP

I get the error :

iptables v1.6.1: ! not allowed with multiple source or destination IP addresses

Any ideas what is the correct command for this use case?

1 Answers1

0

Negated logic should work here:

sudo iptables -I FORWARD -d 172.18.0.3 -p tcp --dport 9114 -j DROP
sudo iptables -I FORWARD -s x.x.x.x,y.y.y.y -d 172.18.0.3 -p tcp --dport 9114 -j ACCEPT

Commands have to be entered in this order so that the DROP rule appears last in the chain.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63