Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to disable my machine to reach a remote access and to block incoming traffic from the same network. so actually I need to block output traffic to network "X" and input traffic from network "x" but I want all other traffic to be open input and ouput


share|improve this question
up vote 3 down vote accepted

assuming you want to start with no other rules

iptables -F

iptables -X

iptables INPUT -p ACCEPT

iptables FORWARD -p ACCEPT

iptables OUTPUT -p ACCEPT

the rules you want:

iptables -I INPUT -s <ip> -j DROP

iptables -I OUTPUT -d <ip> -j DROP

then run

service iptables save

share|improve this answer

Your Answer


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.