Block IP Address in FreeBSD

The simple method is to add the offensive IP in your /etc/hosts.allow file and deny any access to that:

$ ee /etc/hosts.allow  (and add following line in it)
	all: <ip address> :deny

You can also use one quick and dirty hack:

$ route add <ip address> 127.0.0.1

All ACKs to specified IP address would be headed to 127.0.0.1, means going nowhere and no TCP connections could be established this way. No UDP or ICMP packets would reach the blocked IP address. You can also block a whole subnet this way. Though, it’ll not stop the traffic from that IP.

If you have ipfw installed, you can try this also:

$ ipfw add deny from <IP Address> to any

You may also like to read:
* 5 steps to secure your Linux Server
* Ensuring secure access to production Linux Servers
* Bash script to backup essential log files in Linux
* Quickly change your ssh port from defualt 22 to something higher
* SSH port forwarding from remote to local machine
* Save root or user history to check later
* Install and configure denyhost to prevent brute force attacks

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes