Solved

Squid not checking hosts file? :(

Posted on 2001-08-19
3
439 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 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

729 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