Date: Wed, 22 Jan 1997 11:25:52 +0000 () From: "Lenzi, Sergio" <lenzi@bsi.com.br> Cc: John Diggan <74361.2505@CompuServe.COM>, questions@freebsd.org Subject: DNS solution Message-ID: <Pine.BSF.3.91.970122111919.2703A-100000@sergio> In-Reply-To: <199701220604.XAA00372@obie.softweyr.ml.org>
index | next in thread | previous in thread | raw e-mail
Hello, I saw your question about setting up DNS....
Here is a small program that builds all dns related files in your machine.
It only needs the address of a root name server.
It can be any one like: 200.250.250.14 or 200.247.7.3 or 150.162.1.3 or ...
any computer in USA that runs a DNS.
1) First setup /etc/hosts with the name of your machine and ip
like:
a.b.c.d your.complete.machine.name (from the hostname)
2) execute the program (it will overwrite the /etc/named.boot,
/etc/resolv.conf and /var/named directory).
3) start named : named -b /etc/named.boot
Should work for the first setup of your machine.
other more sofisticated dns setting up has to be done by hand...
but.. is a "start".
Hope this will help...
-------------------------------------------cut--------------------
#!/bin/sh
if [ ! -d /var/named ]
then
mkdir /var/named
cd /var/named
touch localnet localnet.rev
fi
cd /var/named
host=`hostname`
localip=`grep $host /etc/hosts | awk '{print $1}'`
lastiptok=`echo $localip | awk -F. '{print $4}'`
revip=`echo $localip | awk -F. '{printf "%d.%d.%d",$3,$2,$1}'`
localdomain=`echo $host | awk -F. '{print $1,$2,$3,$4,$5,$6,$7}'`
set $localdomain
shift
localdomain=$1
shift
while [ $# -gt 0 ]
do
localdomain="$localdomain.$1"
shift
done
host=`hostname -s`
echo -n root name server ip:
read rootip
nroot=rootns
cat > /etc/named.boot <<%
;
; Boot file for name server
;
directory /var/named
cache . cache
primary $localdomain db.$localdomain
primary 0.0.127.in-addr.arpa db.local
primary $revip.in-addr.arpa $localdomain.rev
%
cat > cache <<%
; BIND data file for initial cache data for root domain servers.
;
$localdomain. IN NS $host.
. IN NS $nroot.
;
; ADDRESS
;
$host. IN A $localip
$nroot. IN A $rootip
%
cat > db.$localdomain <<%
;
; named definition for $localdomain
;
@ IN SOA $host.$localdomain. root.$localdomain(
1 ; Serial
3600 ; Refresh
300 ; Retry
3600000 ; Expire
3600 ) ; Minimum
NS $host.$localdomain.
MX 10 $host.$localdomain.
;
localhost IN A 127.0.0.1
$host IN A $localip
\$INCLUDE localnet
%
cat > db.local <<%
;
; named.local
;
@ IN SOA $host.$localdomain. root.$locadomain(
18 ; Serial
3600 ; Refresh
300 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS $host.$localdomain.
1 IN PTR localhost.
%
cat > $localdomain.rev <<%
@ IN SOA $host.$localdomain. root.$locadomain(
1 ; Serial
3600 ; Refresh
300 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS $host.$localdomain.
$lastiptok PTR $host.$localdomain.
\$INCLUDE localnet.rev
%
cat > /etc/resolv.conf <<%
domain $localdomain
search $localdomain
nameserver 127.0.0.1
%
----------------------------------cut-------------------------
Sergio Lenzi.
Unix consult.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970122111919.2703A-100000>
