How do i block IP address.

carlos123

Verified User
Joined
May 4, 2007
Messages
19
Hi does anyone know how to block IP address , This address doesn't have access to server or www account.

thanks.:confused:
 
Be careful; don't lock yourself out of your system.

Before playing with a firewall you may not fully understand try just putting the IP# into your /etc/hosts.deny file to see if that will work for you.

Jeff
 
Thanks for your help. How do you use "/etc/hosts.deny" do you type
the ip address or what? I have view it but not sure where do you typed in
or what.

Can you tell me..
Thanks again..:)
 
If you want to block the IP# from being able to access any services on your server:
Code:
ALL : 00.00.00.00
where 00.00.00.00 should be replaced by the IP# you want blocked.
For multiple IP# blocking, separate the IP#s by a single space, keeping them on the same line:
Code:
ALL : 00.00.00.00 11.22.33.44
It doesn't matter how wide your file becomes; that's a human issue, not a system issue, but if you want to be able to read everything on your screen you can certainly do it this way:
Code:
ALL : 00.00.00.00
ALL : 11.22.33.44
If you don't want to block all protocols, study the man page:
Code:
$ man hosts.deny
Jeff
 
Thank you again. well know i will monitor if i see this ip keep on showing up.
Have a good one.

:p
 
I've tried just about all combination I could find on the net, no matter what I will get a warning
Code:
warning: /etc/hosts.deny, line 8: missing newline or line too long
line number is actual IP's, others are the # lines
its like I need to end the line with something?
#############################################################
further search and thanks to
I found this
WarningIf the last line of a hosts access file is not a newline character (created by pressing the Enter key), the last rule in the file fails and an error is logged to either /var/log/messages or /var/log/secure. This is also the case for a rule that spans multiple lines without using the backslash. The following example illustrates the relevant portion of a log message for a rule failure due to either of these circumstances:

warning: /etc/hosts.allow, line 20: missing newline or line too long
 
Last edited:
Back
Top