[squid-users] "Overriding" dnsserver

From: Manuel Capinha <mcapinha@dont-contact.us>
Date: 22 Oct 2002 17:52:52 +0100

Hi!

I'm in the process of changing the configuration of one of our web
servers, to allow it to serve requests made to UMLs
(user-mode-linux.sourceforge.net). Basically, the UML is a virtual linux
machine inside a "real" linux machine.

I'm setting up this UMLs in a dummy interface, at 10.0.0.x.
I've successfully used squid in the past, as a front-end redirector, to
various webservers, represented by a single external IP (the accelerator
mode). I was able to do this, because I had access to a DNS server to
provide the squid with the private IPs of this machines.

In the current task, I would prefer not to setup a dedicated DNS server
just to serve the squid. I am thinking of programming a dnsserver
replacement to achieve this.
So, I compiled squid with the --disabled-internal-dns option, and wrote
a small dnsserver replacement (from what I gathered from the dnsserver.c
code). It goes something like this:

#!/usr/bin/perl
$|=1;
while(<>){
    if($_ =~ /\$shutdown/) {
        exit(0);
    } elsif ( $_ =~ /\$hello/) {
        print "\$alive\n";
    } elsif ($_ =~ /clanhosted/){
        print "\$addr 0 10.0.0.3\n";
    } else {
        print "\$addr 0 10.0.0.2\n";
    }
}

Basically, anything that contains clanhosted is answered as 10.0.0.3,
anything else as 10.0.0.2. I've even thrown in the code to make it die
gracefully and respond to hellos.

But.. When I connect to the squid and ask for any of the URLs that it
should provide, it just hangs there. The squid is working if I use the
provided dnsserver (it just doesn't do what I want, but it works!).

Has I said, I've got some experience with setting up squid, I've did
this same setup in the past, except for the difference that previously I
used a dedicated dns server, instead of hacking it at the dnsserver
level.

So, can anyone shed some light on this ? Am I doing something wrong with
my dnsserver.pl ? Has someone hacked their own dnsserver before ?

On a slightly offtopic subject, if anyone knows of a
fast,small,lightweight server that supports DNS wildcards, I could use
that.

Many thanks in advance.
I've spent the whole day on this, and I'm really running out of ideas.
:)
Received on Tue Oct 22 2002 - 10:52:41 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:10:46 MST