Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 1996 03:25:40 -0400 (EDT)
From:      Will Mitayai Keeso Rowe <mitayai@dreaming.org>
To:        Jason Lixfeld <carrera@idirect.com>
Cc:        questions@freebsd.org
Subject:   Setting up caching name service. (Re: rc file discrepency)
Message-ID:  <Pine.BSI.3.95.961025021852.25410m-100000@dreamlabs.dreaming.org>
In-Reply-To: <326F23CF.446B9B3D@idirect.com>

next in thread | previous in thread | raw e-mail | index | archive | help
 
> How do I setup this ifconfig line?!  it has to go into the /etc/rc or
> /etc/sysconfig?

It's best to look it up in the handbook at
http://www.freebsd.org/handbook/handbook.html... it will help you a bit
more than i could, but if after reading it you still have questions, 
contact me and/or questions@freebsd.org

> 
> Is that the process for setting up local DNS?!  if you specify a domain,
> do you not need it dome from Internic?!
> 

Oh, my. Ok, i'll try to explain myself, but i encourage you to use my
words only as a guideline. There are, i believe, entried in the handbook,
and many good books, such as the O'Reilly book 'DNS and Bind'
(http://www.ora.com/). And, to top it off, i suck at explaining things,
but i have to try and explain this all to my father later, so here's a dry
run. If anyone else sees any inconsistencies in my explanation, flame me
on low and correct me, please.

I'm assuming your machine is connected via dialup, although you can apply
a lot of this on a LAN too..

As for your IP, depends on whether your provider gives you a static
(fixed) IP or a dynamic (variable) one. If it is static, in all likelihood
they have associated a name with it already from their domain. On a
machine with a working namesever, try 'nslookup x.x.x.x' where the x.x.x.x
is your IP, or ask me and i'll try to help.

If it is dynamic, don't worry about it, and make up a name. It doesn't
matter, since if you have dynamic people shouldn't be sending mail to your
computer or accessing it via ftp/telnet/whatever. I usually tell people to
take their provider's domain (in my case, dreaming.org) and prepend their
username (thus 'mitayai.dreaming.org' for the hostname). This is merely
for my own aesthetical quirk and to make local stuff easy for me... i can,
internally, associate my machine when i'm testing something on it, by a
name, such as my test webserver http://mitayai.dreaming.org. And it helps
my partner understand better rather when i call up and ask how the
'machine in the basement' is doing and he has to reply 'which of the
four?' :)

Note, however, that if you send mail from your computer, and you want a
reply, it's best to set the domain it comes from to the domain of your
email address. For example, i have a computer that gets assigned a
dynamic IP that i call, for all intents and purposes,
liquid.dreaming.org. 'chemically' is NOT a valid DNS entry at my provider.
And no one access that machine from the outside, so the name doesn't
matter to anyone but me. So, sending mail from liquid and having the mail
header come out as 'mitayai@chemically.dreaming.org' would be a good way
to make sure i NEVER get replies to my mail. :).

Instead, I use 'pine' to send my mail from it, and use the 'hostname=' in
my .pinerc set to 'dreaming.org'.. therefore, all my mail appears to have
come from 'mitayai@dreaming.org' which is a valid user at a valid DNS
host, and when people reply, it gets sent to a place actually set up to get
mail.  Anything beyond that means playing with MX records and your
sendmail.cf file, which are longer stories than even this ramble, 
although i'll try and help you if you want. The books are better, though.

Ok, the fun part:

For Host Name Resoloution, that is, you type in 'telnet dreaming.org',
your machine has to find the number associated with dreaming.org (the IP)
in order to know how to contact it and where. 

Your machine looks at /etc/host.conf first (mine follows):

######
# $Id: host.conf,v 1.2 1993/11/07 01:02:57 wollman Exp $
bind
hosts
######

'bind' means to check a name server first, and then failing that,
'hosts' makes it check to see if it is hard-coded in your /etc/hosts file.

Some people reverse this order to make things faster, especially for when
you are not connected to the Internet full-time, or have a slow
connection.

Next, your machine looks at /etc/resolv.conf if it exists.

#####
domain dreaming.org
nameserver 127.0.0.1
nameserver 207.107.8.200
nameserver 142.77.1.1
#####

the 'domain' line allows me to shorten local names withing my domain...
if i did 'telnet dreamlabs' it would first try dreamlabs.dreaming.org and
then plain 'dreamlabs'.

The 'nameserver' lines are nameservers queried in order.

127.0.0.1 is, of course, my local machine, which runs a cacheing
nameserver. The rest are the nameserver closest to my dialup point (my 
provider) and other good, solid nameservers for backup in the case of a
timeout from it or other problems. (142.77.1.1 = ns.uunet.ca)

'named', the nameserver daemon, is invoked at bootup by my line in
/etc/sysconfig (running FreeBSD-2.1.5, but you shouldn't have problems... 
if you  are runnning some old FreeBSD version like 2.0 it may be in
/etc/netstart, or if not running FreeBSD you could always pop it in
/etc/rc manually as noted below:

#####
#####/etc/sysconfig
namedflags="-b /etc/namedb/named.boot"
#####

which caused the command

named -b /etc/namedb/named.boot

to be made at startup. If you don't have /etc/sysconfig, you could always
use the option of entering that named -b...  line in /etc/rc or
/etc/rc.local. But put it in /etc/sysconfig; a lot of people have put time
into making things easy for us and let's respect that. :)

in /etc/namedb/ i have two files: named.boot and named.root.
You can copy them from here or get updates, if any, from the sites
mentioned in the comments. named.root *may* be present as root.cache on
your system, which is fine. The name is only important in that
/etc/namedb/named.boot is the file we have told namedb to read using the
-b option, and in that file it looks for the root name server list in the
name we specified. The names are based on standards and a drive towards
consistency, so i stick to them as best i can exept for when years of
habit take over.

;;;;;
;;;;; named.root
;       This file holds the information on root name servers needed to
;       initialize cache of Internet domain name servers
;       (e.g. reference this file in the "cache  .  <file>"
;       configuration file of BIND domain name servers).
;
;       This file is made available by InterNIC registration services
;       under anonymous FTP as
;           file                /domain/named.root
;           on server           FTP.RS.INTERNIC.NET
;       -OR- under Gopher at    RS.INTERNIC.NET
;           under menu          InterNIC Registration Services (NSI)
;              submenu          InterNIC Registration Archives
;           file                named.root
;
;       last update:    Nov 8, 1995
;       related version of root zone:   1995110800
;
;
; formerly NS.INTERNIC.NET
;
.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
;
; formerly NS1.ISI.EDU
;
.                        3600000      NS    B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET.      3600000      A     128.9.0.107
;
; formerly C.PSI.NET
;
.                        3600000      NS    C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
;
; formerly TERP.UMD.EDU
;
.                        3600000      NS    D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
;
; formerly NS.NASA.GOV
;
.                        3600000      NS    E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
;
; formerly NS.ISC.ORG
;
.                        3600000      NS    F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
.                        3600000      NS    G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
.                        3600000      NS    H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
;
; formerly NIC.NORDU.NET
;
.                        3600000      NS    I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
; End of File
;;;;;



;;;;;;
;;;;;; named.boot
;	$Id: named.boot,v 1.3 1995/03/23 08:43:02 rgrimes Exp $
;	From: @(#)named.boot	5.1 (Berkeley) 6/30/90

; boot file for secondary name server
; Note that there should be one primary entry for each SOA record.

directory	/etc/namedb

; type    domain		source host/file		backup file

cache		.			named.root
primary		0.0.127.IN-ADDR.ARPA	db.127.0.0
;;;;;

oh, of course i'd forget something, the 'primary' line calls the following
file; i'd suggest you create it manually as per the comments.

;;;;;
;/etc/namedb/db.127.0.0
;	From: @(#)localhost.rev	5.1 (Berkeley) 6/30/90
;	$Id: PROTO.localhost.rev,v 1.1 1995/03/21 16:33:44 wollman Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;

@	IN	SOA	dreamlabs.dreaming.org. root.dreamlabs.dreaming.org.  (
				96102401	; Serial
				3600	; Refresh
				300	; Retry
				3600000	; Expire
				3600 )	; Minimum
	IN	NS	dreamlabs.dreaming.org.
1	IN	PTR	localhost.dreaming.org.

;;;



Ok, so, when i do 'telnet dreaming.org' my machine queries the nameserver
ruinning on 127.0.0.1 for the correct IP, and fails, cause it doesn't know
it yet, but it compensates by asking the hosts in the named.root file for
it, and if it gets a response, gives it to you.

It remember this match for quite some time depending on your uptime,
memory, etc, so next time it doesn't have to go through all this stuff.
(Thus a 'cacheing' nameserver)
If it fails, your machine goes to the next nameserver and repeats the
process.

If all listed nameservers fail, it goes to that second line in
/etc/host.conf and tries the /etc/hosts file. (Now do you see why some
people reverse the process and put 'hosts' first and hardcode familiar,
oft-used IPs? All of this lookup takes time which sucks on a low-speed
connection).

If that fails, it returns 'host not found' and your telnet fails.

Well, i hope this helps. Sorry it took so many worrds. But remember, the
'man' pages are yuor friends! Check:

man named
man host.conf
man hosts
man resolv.conf

Regards,
Mit




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.95.961025021852.25410m-100000>