Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Squid not checking hosts file? :(

Posted on 2001-08-19
3
Medium Priority
?
491 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
samri earned 800 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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 how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

604 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