9

I must pretty bad at Googling as this seems like a very basic question but I can't seem to find the answer anywhere... and man iptables is a very long read!

I have two NICs - eth0 and eth1 - on a linux box and I want to block ALL outbound traffic (TCP and UDP across all ports) from one of the NICs, so that no traffic makes its way back up to the router.

What is the command for this? I have only seen examples with specific ports.

Thanks in advance.

9

With iptables -A OUTPUT -o eth1 -j DROP you can drop all outgoing traffic on interface eth1. You'll probably also want to drop all forwarded traffic using iptables -A FORWARD -o eth1 -j DROP.

4

To drop all the outgoing traffic on eth1

iptables -I OUTPUT -o eth1 -j DROP

will insert a rule at the begining of the OUTPUT chain to drop all outgoing traffic.

  • Thanks. Both were what I was looking for (no current rules so append or insert is fine) - but I've given it to kenny.r for being first. – edanfalls Feb 17 '11 at 22:54

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.