WebHostGear.com - the hosting resource for professionalshosting tutorials 
hosting howto webhost guide server managementJuly 04, 2009
server management, apache tutorials, hosting tutorials, cpanel, server security
Home / Hosting Tutorials / Ban an IP Address From The Server

Ban an IP Address From The Server



Printer Friendly Printer Friendly Send to a friend Send to a friend
By : ramprage Rating : Average Rating : 6.67 From 39 Voter(s)

Have a user that keeps hammering your FTP or trying to login over and over and over again that you just want to ban and never see again? We'll show a quick and dirty method to ban an IP address from the server.

We commonly receive questions like:
"I would like to ban that ip address to prevent the access to the server.

how can i ban that Ip address from the server?"

Simple!

1) Login to the server as and su  - to root.

2) If you are running iptables, you can enter:

iptables -A INPUT -s <IP> -j DROP

3) If you have APF firewall installed

apf -d <ip>

4) When you reboot this IP ban will be removed, meaning the IP will no longer be banned anymore.
If you have APF you can get around this by opening the deny hosts file.

pico /etc/apf/deny_hosts.rules

Scroll to the bottom and paste in the IP address.
Ctrl+X then Y to save the changes and exit.

5) Restart APF
/etc/apf/apf -r

New! - Need server help? Hire an Expert

Get professional help with your configuration, script installation or server issue.
Learn how we can help you with any server problem and make your server run like new. Professional staff will contact you, after submitting a quote request, by phone or email.

Rate this Article :

1

2

3

4

5

6

7

8

9

10
Poor Excellent

Related Articles


» Guide to Chkrootkit - checking for intruders
» Common SSH Commands - Linux Shell Commands
» How to install BFD (Brute Force Detection)
» How to install APF (Advanced Policy Firewall)


Discuss this article with others in our new hosting forums

Comments / Feedback

agreseanu vlad
how i can ban a intruder? i know his ip

Dusty
Do you people really enjoy banning other people,,Is it in your nature to do this.Maybe you should be ban as well to see how it feels.
tomofumi
Acutally you can save the current iptables entries and keep the setting after reboot by running "service iptables save"
jethbrown
Is there a way to ban a ip range with APF? Reason I am asking is for banning the Panscient Data Services bot, that seems to hammer my server regularly.

Read about it here: http://web-robot-abuse.blogspot.com/2006/09/panscientdataservices.html

Or is there a way to see the specific IP's they are using to block those?
omid
how can i delete an ip from the iptables?
Jim
When calling IPtables the first argument is the action. So -A is add, so you can guess how deleting is done:

iptales -D

When i forget i always run iptables-save, then you will (save) get a list with all rules in detail with info.


 Add Comment
Name
Email
Image Code
Refresh Image

Comments / Feedback



Our site offers free hosting tutorials, cpanel tutorial, web hosting news, shell commands, running a web hosting business, dedicated guides, linux tutorial, apache install, home web server, web server guide, ssh commands, dedicated servers, DNS nameservers, chkrootkit, apf firewall, exim configuration, server compromised, cron backup solution, ftp backup script

Server Tutorials


WebHostGear Reviewed by Ping Zine - Click here

Links:
Lunarpages Coupon