Solved

Squid not checking hosts file? :(

Posted on 2001-08-19
3
419 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
ID: 6405708
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
ID: 6407021
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
ID: 6408398
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
route 2 traffic streams on single NIC 6 49
Oracle 10g standard edition server with 4 processors 3 54
Linux VM 6 89
linux SFTP 8 44
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

777 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