Version Franšaise
Linux DNS server for local network

Here's the method I used to create a DNS server on my local network.
Being a kind of newbie in this area, purists will certainly laugh (or cry ;-) ), but it works great like that. Also, please excuse my poor english; it's an effort to help more people than only french guys. I also wont translate this into German, Russian, Italian or Japanese :-)

Configuration
- 1 network with 30 Win95/Linux PC (I will now take only 3 PC for the demonstration)
- 1 NT 3.51 server (I don't use it, it's a file server on my network)
- 1 Linux RH5.0 (486 DX2/66, 12 Mb ram)
- The PC's address are :
192.168.10.1 - dnsserver.mydomain : Linux RH5.0
192.168.10.2 - m1.mydomain : win95
192.168.10.3 - m2.mydomain : win95
192.168.10.4 - m3.mydomain : linux

Note : all the following numerical values are default. If you want technical explanations, please refer to the HOWTO's. I wanted to make something that works without any brainstorm.


Let's go !

Warning : be careful for the syntax, there are dots "." everywhere. Don't forget them !!!

Also, be careful with Red Hat versions : with 5.1 and previous, you modify /etc/named.boot, but with RH 5.2 and later it's /etc/named.conf (see below).

File : /etc/resolv.conf

search		mydomain
nameserver	192.168.10.1

File : /etc/named.boot (for RH < 5.2)
directory				/var/named
cache		.			named.ca
primary		0.0.127.in-addr.arpa	named.local
primary		10.168.192.in-addr.arpa	db.192.168.10.hosts
primary		mydomain		db.mydomain.hosts
Please note the "." (dot) between cache and named.ca on the second line.

File : /etc/named.conf (for RH >= 5.2)

zone "10.168.192.in-addr.arpa" {
  type master;
  file "db.10.168.192.hosts";
};

zone "mydomain" {
  type master;
  file "db.mydomain.hosts";
};

File : /var/named/named.ca
Modify the line "A.ROOT-SERVERS.NET. to put your Linux box address :
A.ROOT-SERVERS.NET. 3600000 A 192.168.10.1

File : /var/named/named.local
unchanged

Create a file /var/named/db.192.168.10.hosts

10.168.192.in-addr.arpa.	IN	SOA	dnsserver.mydomain.	admin.dnsserver.mydomain. (
			23
			10800
			3600
			604800
			86400 )
10.168.192.in-addr.arpa.	IN	NS	dnsserver.mydomain.
1.10.168.192.in-addr.arpa.	IN	PTR	dnsserver.mydomain.
2.10.168.192.in-addr.arpa.	IN	PTR	m1.mydomain.
3.10.168.192.in-addr.arpa.	IN	PTR	m2.mydomain.
4.10.168.192.in-addr.arpa.	IN	PTR	m3.mydomain.

"admin.dnsserver.mydomain" is the guy to contact, just in case it doesn't work ;-).

Create a file /var/named/db.mydomain.hosts
mydomain.	IN	SOA	dnsserver.mydomain. admin.dnsserver.mydomain. (
		23
		10800
		3600
		604800
		86400 )
mydomain.	IN	NS	dnsserver.mydomain.
dnsserver.mydomain.	IN	A	192.168.10.1
m1.mydomain.	IN	A	192.168.10.2
m2.mydomain.	IN	A	192.168.10.3
m3.mydomain.	IN	A	192.168.10.4



Here you are ! You have to restart /etc/rc.d/init.d/named, so that the modifications are applied.

Small try locally (on the dnsserver PC) :
%> nslookup
Default Server : dnsserver.mydomain
Address : 192.168.10.1

>m1.mydomain
Name : m1.mydomain
Address : 192.168.10.2

>192.168.10.3
Name: m2.mydomain
Address: 192.168.10.3

> exit
%>

To add other machines, you have to modify /var/named/db.mydomain.hosts and /var/named/db.192.168.10.hosts.
This way, name resolution works forward and reverse.

Note : This configuration works only on internal networks. You won't resolve internet names/addresses. To do this, you have to modify /etc/resolv.conf so that it contains your ISP address (in most cases).


Clients

Win95 clients shoud have 192.168.10.1 for DNS server, eventually along with your ISP address.
I would suggest to put the Linux box _first_ in the list, otherwise Loose95 will call your ISP to resolve local addresses :-(

Linux box will have a /etc/resolv.conf like this :
search mydomain
nameserver 192.168.10.1
nameserver www.xxx.yyy.zzz  (your ISP)
In /etc/named.boot, add : forwarders xxx.yyy.zzz.ttt (your ISP's address) options forward-only This will allow you to resolve names from the internet, whene your linux box is a gateway between local and internet network.
Flames, advices, greetings :-) to Christophe Gerbier cgerbier@demeter.fr

Date June, 22 1999. v1.07


The Linux Webring: [ Previous | Next | Home | Random | List ]



Copy and distribution of this piece of art is granted to everybody on earth, except Micro$oft.

For Micro$soft, it has to be considered as a commercial product, and shouldn't be used before they buy it. List price : $1,000.00, Service Releases : $480.00, e-mail support : $150.00 per mail.

Hosting by WebRing.