0

I m blocking an ip from my centos server using iptables:

iptables -A INPUT -s $ip -j DROP
service iptables save

however my ip is still able to access the ip and even view websites hosted on this ip. what's wrong?

1 Answer 1

3

You'll have to block the outgoing traffic to this ip address not the other-way around.

Use the OUTPUT keyword and the -d flag like this:

iptables -A OUTPUT -d $ip -j DROP
1
  • 2
    You'll also need to use the -d flag to specify the IP as destination, not source. And of course you may run afoul of the fact that order is important in iptables rules, and slapping one on the end of a chain doesn't guarantee it'll ever do anything at all.
    – MadHatter
    Sep 10, 2014 at 15:39

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