Portal Home > Knowledgebase > Articles Database > APF to block an IP
APF to block an IP
Posted by SunShellNET, 11-27-2009, 03:15 PM |
Hi
I was wondering, how can we block an IP using APF ?
I tried
but not sure it is working or not.
Here is what I wanted
Suppose, if I want to block google.com
Their ip is 74.125.45.100
and it said the IP was blocked.
But when I type
I can see google.com home page.
Is there any method to block it ?
|
Posted by RBBOT, 11-27-2009, 03:45 PM |
apf -d blocks incoming connections from that IP, not outbound connections to it. You can add outbound blocks to your /etc/apf/deny_hosts.rules as explained in the comment at the top of it.
Last edited by RBBOT; 11-27-2009 at 03:48 PM.
|
Posted by khunj, 11-27-2009, 04:03 PM |
Google has a lot of IPs, in that case, better null-route the whole /16 block :
|
Posted by inspiron, 11-28-2009, 09:22 AM |
The second way is to manually edit the /etc/apf/deny_hosts.rules
configuration files you can specify the domain or IP address in this file.
For example to deny the IP address 0.0.0.0 and the domain take example.com
You must specify the following in etc/apf/deny_hosts.rules files:
0.0.0.0
|
Posted by mellow-h, 11-28-2009, 01:08 PM |
It is not working with google, most likely because google doesn't allocate you one IP for long term. It rotates the IP per period and sometimes it is very short. Try accessing the IP using lynx rather than using google.com
|
Posted by david510, 11-28-2009, 08:59 PM |
To block outbound connections add the entry to the /etc/csf/csf.deny file and restart csf.
|
Add to Favourites Print this Article
Also Read