How To Block IP Addresses On Linux Server

By Angsuman Chakraborty, Gaea News Network
Wednesday, July 12, 2006

Take a look at your log file (/var/log/secure for Fedora Core 4) and you will discover numerous automated ssh hacking attempts using dictionary attack. So now you have identified the offending addresses. How do you stop them?

Here comes the magic mantra which uses iptables (packet) firewall:

iptables -A INPUT -s a.b.c.d -j DROP

Replace a.b.c.d with the offending IP address. Repeat this for each of the offending IP addresses.

Discussion

Vishal
May 27, 2010: 9:12 pm

I am using Fedora 7 core in my office, my IP has been blocked & i am not able to access internet.Plz provide a solution for the same.

Thankyou.


Amit
January 19, 2010: 9:44 am

how to block a website like http//:www.orkut.com in my centos 5.4 and it is connected to a link sis router please help as I just want it asap

September 24, 2008: 12:37 pm

I like that, thanks.


Soloport
June 26, 2008: 2:18 am

[...] This bans his IP address from accessing my network. However after a reboot of my server this ban will go away. For a permanent ban you will need to additionally add this command to your /etc/rc.local file. This ensures that the ban is in effect even after a reboot of my server. – Source. [...]

May 6, 2008: 7:47 am

[...] Their website is https://www.kuban.mts.ru/. They appear to be legitimate mobile & internet service provider. Most likely their internet service is being abused by the spammer. Nevertheless I decided to ban this IP address from accessing my server. [...]

December 28, 2007: 7:57 am

It’s always good to block service access that are not required for public - for example, SSH.

August 28, 2006: 9:52 am

I cannot do that as I do not connect from dedicated ip addresses. I connect using a provider (BSNL) who allocated IP’s from a countrywide pool.


pastri
August 28, 2006: 9:07 am

With even less worries: only allow certain IPs to access SSH. Next to that install “knockd” to allow you to temporarily open up the firewall from the IP you are working on when you are working mobile.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :