Hi,

I've been using the dnscache feature that allows DNS requests for
certain domains to be directed to specific DNS servers for 2 or 3 years
now by editing the contents of the /etc/dnscache/root/servers/ directory
directly (and modifying dnscache's backup exclude list so I can save the
contents of this directory).

I decided to be it "properly" by using a new file in /etc/dnscache/env
to hold the configuration and modifying the /etc/init.d/dnscache to
populoate the /etc/dnscache/root/servers directory from this cache.

I've attached the results of my efforts as a couple of patches and an
example configuration file (which I call /etc/dnscache/env/INTERNAL for
want of a better name!).  I'm currently using Bering-uClibc 2.3-beta4.

Maybe I'll try the same thing for DNSmasq one day, but I can't think of
a reason for me to switch from dnscache at the moment.

Some notes on my setup: I have a Windows 2003 server on the internal
network acting as a DNS server for an internal domain, updated by a DHCP
server on the same machine.  All the machines on the local network use
dnscache on the LEAF box as their DNS server, which directs requests for
the internal domain (and reverse DNS look-ups for the internal IP
addresses) to the internal DNS server and directs all other DNS requests
to the internet.

I hope this is useful to others.  It would be nice if it could be
incorporated into future releases!

Best regards,
Ian Abbott.


::::::::::::::
dnscache.conf.patch
::::::::::::::
--- ../old/var/lib/lrpkg/dnscache.conf  2001-06-24 17:47:52.000000000 +0100
+++ var/lib/lrpkg/dnscache.conf 2005-07-24 17:52:33.000000000 +0100
@@ -3,6 +3,7 @@
 /etc/dnscache/env/QUERYLOG     Set to YES to set dnscache log on (default: NO)
 /etc/dnscache/env/QUERYFWD     Set to YES to set FORWARDONLY on  (default: NO)
 /etc/dnscache/env/DNS1         ISP DNS adresses (used when FORWARDONLY is on)
+/etc/dnscache/env/INTERNAL     DNS addresses for internal domains
 /etc/dnscache/env/CACHESIZE    Cache size (default: 1000000)
 /etc/dnscache/env/DATALIMIT    DATALIMIT  (default: 3000000)
 /etc/dnscache/log/run          Multilog dnscache parameters


::::::::::::::
dnscache.initd.patch
::::::::::::::
--- ../old/etc/init.d/dnscache  2001-07-08 16:13:34.000000000 +0100
+++ etc/init.d/dnscache 2005-07-24 17:47:53.000000000 +0100
@@ -74,6 +74,22 @@
                touch $ROOT/ip/$IPQ
                echo "dnscache queries allowed from "$IPQ
        done < $ENVDIR/IPQUERY
+       while read INTDOMAIN INTDNS
+       do
+               if expr "$INTDOMAIN" = "" "|" "$INTDOMAIN" : "#" > /dev/null
+               then
+                       continue
+               fi
+               rm -f $ROOT/servers/$INTDOMAIN
+               touch $ROOT/servers/$INTDOMAIN
+               set $INTDNS
+               while [ $# -gt 0 ]
+               do
+                       echo "$1" >> $ROOT/servers/$INTDOMAIN
+                       shift
+               done
+               echo "dnscache forwarding queries for "$INTDOMAIN" to "$INTDNS
+       done < $ENVDIR/INTERNAL
        if [ $MULTI -eq 0 ]; then
                echo "Starting dnscache without daemontools ..."
                $DAEMON < $ROOT/../seed 2>/dev/null 1>/dev/null &
@@ -98,6 +114,7 @@
        fi
        rm /var/run/dnscache.pid
        rm $ROOT/ip/*
+       rm $ROOT/servers/*
        ;;
 restart)
        $0 stop


::::::::::::::
/etc/dnscache/env/INTERNAL
::::::::::::::
# Defines where to send queries for internal domains.
# Each line contains a local domain name followed by a list of
# IP addresses of internal DNS servers that serve that domain.

# Example: Two DNS servers (192.168.0.10 and 192.168.0.11) on the
# internal network, serving the '.internal' domain and reverse look-ups
# for the 192.168.0 network.
#
# internal 192.168.0.10 192.168.0.11
# 0.168.192.in-addr.arpa 192.168.0.10 192.168.0.11




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

_______________________________________________
leaf-devel mailing list
leaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to