View Full Version : [SOLVED] Blocking address with ip tables
jmore9
October 27th, 2009, 02:43 PM
I keep blocking a ip by using the following but i keeps coming back !
What am i doing wrong here ?
This is the format i used ( not the correct ip of course )
iptables -A INPUT -s 111.222.33.444 -j DROP #
They keep returning and i keep blocking them.
dummy910
October 27th, 2009, 02:50 PM
you can also place and addy into your host file to prevent sites from loading.
gksudo gedit /etc/hosts
then place say a line that states:
127.0.0.1 111.222.33.444
for those interested in pesky ad-site blocking via the above method, check out the following text-file.
http://www.mvps.org/winhelp2002/hosts.txt
lovinglinux
October 27th, 2009, 03:39 PM
You can also use moblock (http://moblock-deb.sourceforge.net/) or iplist (http://iplist.sourceforge.net/).
Ghostbear121
October 28th, 2009, 03:09 PM
You don't happen to have INPUT set to "accept" do you? ;)
Also check that you aren't appending (-A = append, right?) AFTER an 'allow-all' rule or something. Insert the IP blocking rules at the top of your list of rules, instead of at the bottom. See if that helps.
Lars Noodén
October 29th, 2009, 07:40 AM
As ghostbear mentions, you want the new rules to be in the right place. --append puts the rule at the end of the chain, so if there was an earlier --jump ACCEPT that matches the packet then the packet gets accepted.
Try
iptables [b]-I[b] INPUT -s 111.222.33.444 -j DROP #
For connections that have a chance of coming from legitimate hosts, please consider using the target REJECT instead of DROP (http://www.chiark.greenend.org.uk/~peterb/network/drop-vs-reject).
jmore9
October 29th, 2009, 08:11 AM
OK I will try both of them i was doing it a little different
thanks for your time
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.