Linux – block ip with iptables ubuntu server

ipiptableslinuxSecurityUbuntu

I am trying to block one IP with iptables in my Ubuntu server 12.04.

The foreign IP is 117.16.18.95.dyna. You can take a look at the next image:

enter image description here

I have added this ip to iptables with the next command:

sudo iptables -A INPUT -s 117.16.18.95 -p tcp -j DROP
sudo service iptables-persistent save
sudo service iptables-persistent restart

However, when i run again the command netstat -tap, this IP is not blocked.

How can I remove/block/delete this IP from my Ubuntu server?

Best Answer

IP adresses contains only digits. So '117.16.18.95.dyna' is definitely not IP, it is FQDN. I suspect that real ip is reversed. So, try to block 95.18.16.117
Or just to ensure try netstat with '-n' arg, it will prevent IPs from resolving to FQDNs

Related Topic