A script to configure a Solaris system as a DNS server is available
at
http://www.bolthole.com/solaris/configdns.sh. After downloading
the script make it executable with chmod, e.g.
chmod 755 configdns.sh
. When you run the
script, /etc/resolv.conf and either /etc/named.boot or /etc/named.conf
will be replaced, so you may want to make a backup copy of those files
beforehand. The output of the script, which should be run from the root
account, is shown below:
# sh configdns.sh
This script will automatically configure your machine to run a
DNS server. It will completely destroy /etc/resolv.conf, and
either /etc/named.boot, or /etc/named.conf, as appropriate
It may also modify /etc/nsswitch.conf if neccessary.
Continue? (y/n)
y
copied /etc/resolv.conf to /etc/resolv.conf.pre-config
Made /etc/resolv.conf
nsswitch.conf already okay
Restarting namedemon
cat: cannot open /etc/named.pid
As soon as your internet link is up, you should be set to go!
Please note: This script assumes you are setting up a single isolated
machine. If this machine needs to allow others to query DNS through it,
please read the comments in /etc/named.conf
The /etc/named.conf file produced by the script is shown below:
options {
directory "/etc/named";
# use 127.0.0.1 if you are an isolated machine. Otherwise, either
# comment out the "listen-on" line entirely, or supply the appropriate
# internal or external address
listen-on { 127.0.0.1; };
};
zone "." in {
type hint;
file "named.cache";
};
zone "0.0.127.in-addr.arpa" in {
type master;
file "named.local";
};
The "listen-on" line, by default, will have the system listen for name queries only on the loopback port, 127.0.0.1, which means that you could perform host lookups only on the system itself. You could use the nslookup command to verify that the system is responding to name queries as below:
# nslookup
Default Server: localhost
Address: 127.0.0.1
> cisco.com
Server: localhost
Address: 127.0.0.1
Name: cisco.com
Address: 198.133.219.25
But, if you configure another system to use the Solaris system as a
DNS server, it won't respond, since it is only listening on the local
loopback port. If the Solaris system has an IP address of 192.168.1.1,
you could replace the listen-on line in /etc/named.conf with
listen-on { 127.0.0.1; 192.168.1.1; };
or comment out or
remove the listen-on line to have the system respond to queries on any
network interface. If you change /etc/named.conf, you will need to
restart the name server, which you can do with the commands below:
kill `cat /etc/named.pid` 2>/dev/null
/usr/sbin/in.named
If you create a script to restart the name server, put a sleep 1
between the two lines above.
The /etc/resolv.conf file that you will have when you run the installation script will look something like the one below:
domain mycompany.com
nameserver 127.0.0.1
I've used the configdns.sh script on a Solaris 2.7 system. Other Solaris scripts are available from the creator of the script, Philip Brown, at Phil's Solaris Hints or mirrored at Phil's Solaris hints.
Download Script | ||
---|---|---|
Bolthole | MoonPoint | Phil's Solaris Mirror Site |