0

When I am trying to apply an iptables rule on all interface but one, I am trying this, but I get this shown error, could some one help me in that please?

PS. it works without (!) mark, but of course not the case I want, but I mean that the interface name is correct.

XXX@YYY:/home/Server$ sudo iptables -t nat -A PREROUTING -p tcp -i !br-3404fb184b60 --dport 1234-j DNAT --to-destination 172.18.0.3:1234
-bash: !br-3404fb184b60: event not found

1 Answer 1

1

In bash the ! character is used for history substitution. You need to escape it to prevent this.

sudo iptables -t nat -A PREROUTING -p tcp -i \!br-3404fb184b60 --dport 1234-j DNAT --to-destination 172.18.0.3:1234

You must log in to answer this question.

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