Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 05-13-2006, 12:40 AM   #1
LQ Newbie
Registered: Jan 2006
Posts: 15

Rep: Reputation: 0
how do you block access to a site?

I have slackware 10.2 working as my asterisk pbx and a router. I use dhcpd and iptables. I need to block access to to save my bandwidth. Does anyone know how I would go about doing this?
Old 05-13-2006, 02:19 AM   #2
Jerre Cope
Registered: Oct 2003
Location: Texas (central)
Distribution: ubuntu,Slackware,knoppix
Posts: 323

Rep: Reputation: 37
I would use a program like squid ( ) as a proxy where you could easily filter by urls and save bandwidth by caching web access for your whole site. The simplest way to setup squid is with webmin (
Old 05-13-2006, 02:39 AM   #3
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,634

Rep: Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956Reputation: 2956
Edit /etc/hosts and set to
Old 05-14-2006, 11:09 AM   #4
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
& <every_other_host_at>

The problem is: the hosts file doesn't do wildcards, so you must track down & enumerate every offensive host at every blocked domain & put each one in a separate line in your hosts file. Not only that, when <blocked_domain>.<tld> adds a new server, you must discover it & add it.

Consider the HOSTS file from
I grepped it for each of the domains that had a host "ad250", piping the result through wc -l, here the results:
Code:     1065         877  269        269     267       266
(I know a guy whose hosts file runs over 30,000 entries! Of course, he is doing serious malware as well as ad blocking.)

You're much better off taking the proxy server suggestion or using DNS.

If you want to pursue using DNS, you might consider adding dnsmasq to your router. Besides being a small combo DHCP & DNS server, you can block whole domains w/ one simple line per entire domain in its config file.

If you already have Bind running, then see for information on how to get it to block domains.
are especially useful.


filter, squid, webmin

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to block people from accessing my site if they came from a certin url? abefroman Linux - Security 5 02-14-2006 12:16 AM
allow specific ip to browse the block site space_beyond Linux - Newbie 1 06-03-2005 10:15 AM
How I can block a IP to view my web site?? AZIMBD03 Linux - Networking 6 02-26-2004 04:19 PM
squid acl how to block all site except some mikmok Linux - Networking 1 12-22-2003 09:20 AM
block local user to access a site xen_chris Linux - Newbie 3 04-15-2003 10:55 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration