I have created an interface eth0:2 and I want to make curl requests from that interface only so I want to block all ports and incoming traffic on that interface.

This iptables rule used to work, but for some reason it doesn't anymore:

iptables -A FORWARD -i eth0:2 -j DROP

Hopefully someone can point me in the right direction.

  • 1
    you need to use the INPUT CHAIN for incoming traffic, wiki.centos.org/HowTos/Network/IPTables – c4f4t0r Mar 17 '14 at 17:57
  • If you block all incomming traffic, by definition you aren't allowing any of the stuff you are retrieving in either... make sure you understand what you are doing here first. – vonbrand Mar 18 '14 at 17:36

Seems that incoming traffic is directly addressed to the machine itself, so it will hit the INPUT chain.

You should use the INPUT chain instead :

iptables -A INPUT -i eth0:2 -j DROP

FORWARD chain is hit when traffic is routed from one interface to another.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.