Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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