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 :-)

- 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 : - dnsserver.mydomain : Linux RH5.0 - m1.mydomain : win95 - m2.mydomain : win95 - 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

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

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

zone "" {
  type master;
  file "db.10.168.192.hosts";

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

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

File : /var/named/named.local

Create a file /var/named/db.192.168.10.hosts	IN	SOA	dnsserver.mydomain.	admin.dnsserver.mydomain. (
			86400 )	IN	NS	dnsserver.mydomain.	IN	PTR	dnsserver.mydomain.	IN	PTR	m1.mydomain.	IN	PTR	m2.mydomain.	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. (
		86400 )
mydomain.	IN	NS	dnsserver.mydomain.
dnsserver.mydomain.	IN	A
m1.mydomain.	IN	A
m2.mydomain.	IN	A
m3.mydomain.	IN	A

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 :

Name : m1.mydomain
Address :

Name: m2.mydomain

> 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).


Win95 clients shoud have 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  (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

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.