Solved

Squid not checking hosts file? :(

Posted on 2001-08-19
3
404 Views
Last Modified: 2012-06-21
Hello all.

  my squid caching program is not checking my /etc/hosts file and by default it should be :(  How can i please check / fix this?


*details*
I've modifed my /etc/hosts (as root) and added a score of ip's that point to localhost ... eg. image.ads.fairfax.com.au  127.0.0.1  so if the proxy is asked to get an something from image.ads.faifax.com.au then it try to find it on the local machine, instead of the real one.  This is a poor spam advertisment filter method ;)

If i ping image.ads.fairfax.com.au, it pings 127.0.0.1.
if i connect to there with netscape, no proxy, it connects to localhost (apache). If i turn proxy ON, in netscape, it connects to the real website.



Please help :(

I can list any /etc/squid/squid.conf or /etc/host* if this helps?

Also, i'm sure my bindings is Hosts, DNS, NIS+, NIS+. (but don't quote me on that becuase i'm not TOO sure if where i checked that is correct).

-PK-
0
Comment
Question by:pure032398
3 Comments
 
LVL 15

Accepted Solution

by:
samri earned 200 total points
Comment Utility
pure,

perhaps you need to recompile squid to disable usage of it's internal DNS dns.

Go to your squid source tree and do a

./configure --disable-internal-dns
and do a
make to reconpile squid
and make install (this will install your squid in /usr/local/squid)

Another option is to work on redirector modules/program for your squid. I personally use squirm (http://squirm.foote.com.au/).

good luck.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
assuming that /etc/nsswitch.conf contains something like:
   hosts: files dns

As you describe the problem, I also assume that
   127.0.0.1  localhost
is top of your other aliases in /etc/hosts. Then I think it will be hard to aquire what you want, 'cause gethostbyname() would return the first name which matches.
I don't know how squid resolves hostnames, but I thing you need to pach it to get what you want.
0
 
LVL 1

Author Comment

by:pure032398
Comment Utility
thanks buddy.

after a hell of a lot mukng around as root, i got it working.

for some reason, my 3.2stable2 was installed in /usr/sbin/squid and /etc/squid/squid.conf

so i had lots of trouble doing a squid -z and squid -NCd1

and now my webmin doesn't report properly :(

but it runs.

(for now)

AND IT FILTERS THE SPAM ADDS! WOOT!

Thanks buddy

-PK-
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now