#------------------------------------------------------------------------------ # /etc/rc.d/dnscache - configure dns # # Creation: 06.07.2000 fm # Last Update: $Id$ #------------------------------------------------------------------------------ echo "writing /etc/resolv.conf ..." rev_net=`netcalc dnsrev $IP_NET_1` ipaddr=$IP_ETH_1_IPADDR # use tinydns if [ "$ipaddr" = "0.0.0.0" -o "$ipaddr" = "" ] # PPPoE network ? then # yes ... ipaddr=$IP_ETH_2_IPADDR # use 2nd network card rev_net=`netcalc dnsrev $IP_ETH_2_NETWORK $IP_ETH_2_NETMASK` fi (echo "#----------------------------------------------------------------------------" echo "# /etc/resolv.conf" echo "# Automatically created by config.sh" echo "#----------------------------------------------------------------------------" echo "search $DOMAIN_NAME" echo "nameserver $ipaddr" ) >/etc/resolv.conf echo "writing tinydns-data ..." mkdir -p /etc/tinydns/root (echo ".$DOMAIN_NAME:127.0.0.1:a:259200" echo ".0.0.127.in-addr.arpa:127.0.0.1:a:259200" echo ".$rev_net:127.0.0.1:a:259200" echo "=localhost.$DOMAIN_NAME:127.0.0.1:86400" i=1 while [ $i -le $HOSTS_N ] do set `eval echo '$HOST_'$i` ipaddr=$1 hostname=$2 echo "=$hostname.$DOMAIN_NAME:$ipaddr:86400" i=`/usr/bin/expr $i + 1` done ) >/etc/tinydns/root/data tmp=`pwd` cd /etc/tinydns/root /usr/local/bin/tinydns-data cd $tmp echo "writing dnscache-data ..." mkdir -p /etc/dnscache/root/ip mkdir -p /etc/dnscache/root/servers echo '198.41.0.4 128.9.0.107 192.33.4.12 128.8.10.90 192.203.230.10 192.5.5.241 192.112.36.4 128.63.2.53 192.36.148.17 198.41.0.10 193.0.14.129 198.32.64.12 202.12.27.33' > '/etc/dnscache/root/servers/@' >/etc/dnscache/root/ip/127.0.0.1 i=1 while [ $i -le $IP_NET_N ] do net=`eval echo '$IP_ETH_'$i'_NETWORK' '$IP_ETH_'$i'_NETMASK'` net=`netcalc dnsnet $net` if [ ! -f /etc/dnscache/root/ip/$net ] then >/etc/dnscache/root/ip/$net fi i=`/usr/bin/expr $i + 1` done if [ ! -f /etc/dnscache/root/servers/$DOMAIN_NAME ] then echo 127.0.0.1 >/etc/dnscache/root/servers/$DOMAIN_NAME fi if [ ! -f /etc/dnscache/root/servers/$rev_net.in-addr.arpa ] then echo 127.0.0.1 >/etc/dnscache/root/servers/$rev_net.in-addr.arpa fi i=1 while [ $i -le $DNS_N ] do dns="`eval echo '$DNS_'$i`" set $dns # $1=firma.de, $2=192.168.1.12 if [ ! -f /etc/dnscache/root/servers/$1 ] then echo $2 >/etc/dnscache/root/servers/$1 fi i=`/usr/bin/expr $i + 1` done /usr/local/bin/colecho "starting dns server ..." gn ipaddr=$IP_ETH_1_IPADDR if [ "$ipaddr" = "0.0.0.0" -o "$ipaddr" = "" ] # PPPoE network ? then # yes ... ipaddr=$IP_ETH_2_IPADDR # use second network card fi if [ "$DNSCACHE_DO_DEBUG" = yes ] then set -x fi UID=tinydns GID=100 ROOT=/etc/tinydns/root IP=127.0.0.1 \ tinydns >/dev/null 2>&1 & CACHESIZE=50000 IPSEND=0.0.0.0 UID=dnscache \ GID=100 ROOT=/etc/dnscache/root IP=$ipaddr \ dnscache >/dev/null 2>&1 & set +x