Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2004 19:55:12 +0000
From:      Andrew Boothman <andrew@cream.org>
To:        Jonathan Chen <jonc@chen.org.nz>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Domain name for local network?
Message-ID:  <40102AA0.1000009@cream.org>
In-Reply-To: <20040122193855.GB90949@grimoire.chen.org.nz>
References:  <20040122193236.GA55754@dogma.freebsd-uk.eu.org> <20040122193855.GB90949@grimoire.chen.org.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
Jonathan Chen wrote:

> On Thu, Jan 22, 2004 at 07:32:36PM +0000, Jonathon McKitrick wrote:
> 
>>If I have a couple of boxes in a home network that connects to the Internet
>>via ppp, is there any way I can name my network?  I don't want to register
>>a name, just use it locally.  This way I can refer to 'neptune.jonathon.org'
>>or something similar rather than '10.0.0.1'.
> 
> 
> You can name it anything you like. If it were me, I'd set up an
> internal DNS which is authoritative for the local domain name you've
> chosen. That way it'll pick up the local machines for the domain-name
> but still work for non-local domains.

I use this method all the time.

If you look at the headers of this email you'll find that my mail server 
on my LAN refers to my desktop machine as "spatula.flat" which clearly 
isn't a valid domain name :)

Here's how I set my local DNS up. Whenever I have to set it up again 
somewhere else I always struggle to get it right, so hopefully this'll 
help you out and mean that I can look it up in the archives next time I 
forget. :D

I add the following to /etc/namedb/named.conf

-- start --
zone "flat" {
	type master;
	file "flat.fwd";
};

zone "0.168.192.IN-ADDR.ARPA" {
	type master;
	file "0.168.192.rev";
};
-- end --

Create /etc/namedb/flat.fwd with :

-- start --
; Zonefile for .flat
$TTL	86400	;default ttl 1day
@	IN	SOA	myriad.flat	root.myriad.flat. (
			2003102501	;serial number 	YYMMDDNN
			28800		;refresh 	8 hours
			7200		;retry 		2 hours
			864000		;expire		10 days
			86400 )		;min ttl	1 day

		NS 	myriad.flat.

$ORIGIN flat.

ewen	IN	A	192.168.0.1
spatula IN	A	192.168.0.2
simmy	IN	A 	192.168.0.2

guest0	IN	A	192.168.0.100
guest1	IN	A	192.168.0.101
guest2	IN	A	192.168.0.102

myriad 	IN	A	192.168.0.254

smtp	IN	PTR	myriad.flat.
mail	IN	PTR	myriad.flat.
pop3	IN	PTR	myriad.flat.
imap4	IN	PTR	myriad.flat.
-- end --

And create /etc/namedb/0.168.192.rev containing:

-- start --
$TTL 86400

@IN SOA myriad.home. root.myriad.home (
	200401080
	86400
	7200
	8640000
	86400 )

	IN NS myriad.home.

1 IN PTR ewen.flat.
2 IN PTR spatula.flat.
3 IN PTR simmy.flat.
4 IN PTR spatula.home.

100 IN PTR guest0.flat.
101 IN PTR guest1.flat.
102 IN PTR guest3.flat.

254 IN PTR myriad.flat.
-- end --

Hopefully they're not to difficult to understand. The syntax of the 
files is pretty specific though.

Oh and you need named_enable="YES" in /etc/rc.conf

Mail back if you have any problems!

Andrew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40102AA0.1000009>