iam use centos 5.2 on my PC
Download file bind-9.3.0.tar.gz from ftp://ftp.isc.org/isc/bind9/9.3.0/bind-9.3.0.tar.gz
Open the package tarbal bind-9.3.0.tar.gz
# tar -zxf bind-9.3.0.tar.gz
# cd bind-9.3.0
Configuration package bind-9.3.0
# ./configure --with-openssl=yes --with-libtool \
--enable-threads --sysconfdir=/etc --localstatedir=/var/named \
--enable-libbind --enable-ipv6 --enable-getifaddrs --enable-largefile
Compilation package bind-9.3.0
# make depend
# make
Installation package bind-9.3.0
# make install
Edit file /etc/ld.so.conf
# vi /etc/ld.so.conf
Add the following line
/usr/local/lib
Apply changes ldconfig
# ldconfig
Generate rndckey
# rndc-confgen
#Start of rndc.conf
options {
default-server localhost;
default-key "mykey";
};
server localhost {
key "mykey";
};
key mykey {
algorithm hmac-md5;
secret "IriCelUSbPMypSjImBsiTHMauOumRPMkdBjoxVINAx0vxJZNRKGWzFCKibad";
};
# End of rndc.conf
#Start of named.conf
key mykey {
algorithm hmac-md5;
secret "IriCelUSbPMypSjImBsiTHMauOumRPMkdBjoxVINAx0vxJZNRKGWzFCKibad";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { mykey; };
};
options {
directory "/var/named/";
auth-nxdomain yes;
};
# End of named.conf
Next create the file /etc/rndc.conf, /etc/rndc.key, and /etc/named.conf to generate results based on the above. Following successive contents of the salty-briny file:
/etc/rndc.conf
options {
default-server localhost;
default-key "mykey";
};
server localhost {
key "mykey";
};
key mykey {
algorithm hmac-md5;
secret "IriCelUSbPMypSjImBsiTHMauOumRPMkdBjoxVINAx0vxJZNRKGWzFCKibad";
};
File /etc/rndc.key
key mykey {
algorithm hmac-md5;
secret "IriCelUSbPMypSjImBsiTHMauOumRPMkdBjoxVINAx0vxJZNRKGWzFCKibad";
};
File /etc/named.conf
key mykey {
algorithm hmac-md5;
secret "IriCelUSbPMypSjImBsiTHMauOumRPMkdBjoxVINAx0vxJZNRKGWzFCKibad";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { mykey; };
};
options {
directory "/var/named/";
auth-nxdomain yes;
};
Then in the file /etc/named.conf, add the following configuration.
zone "." IN {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
Create the file /var/named/named.ca with the dig
Create the file /var/named/named.local.
# vi /var/named/named.local
Add the following configuration.
$TTL 86400
@ IN SOA localhost. root.localhost. (
200412300 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
Make a directory to save the process bind di /var/named/run
# mkdir /var/named/run
Now we will create a new domain name with chamceul.com,
with the assumption that the server name and IP are server.chamceul.com 202.145.6.71
Edit file /etc/named.conf
Edit the file /etc/named.conf and add the new zone as follows.
zone "chamceul.com" IN {
type master;
file "chamceul.com";
allow-update {none;};
};
Create a database file for the domain chamceul.com in /var/named/
# vi /var/named/chamceul.com
Fill in the following configuration.
$TTL 86400
$ORIGIN echamceul.com.
@ IN SOA chamceul.com. root.chamceul.com. (
200412301 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimal
IN NS server.chamceul.com.
IN MX 10 mail.chamceul.com.
IN A 202.145.6.71
www IN CNAME @
ftp IN CNAME @
mail IN CNAME @
Time to run a daemon, type the following command
# /usr/local/sbin/named
Make sure that named is running and LISTEN on port 53 and 953
# ps -ax | grep named
3670 ? Ssl 0:00 /usr/local/sbin/named
# netstat -tapn
tcp 0 0 202.155.6.42:53 0.0.0.0:* LISTEN 3670/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 3670/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 3670/named
So that the bind daemon (named) is running when the computer is turned on Linux system, edit the file
/etc/rc.local, and add the following line.
/usr/local/sbin/named
Edit file /etc/hosts.
# vi /etc/hosts
and add the following line
202.145.6.71 server.chamceul.com
202.145.6.71 chamceul.com
Next is the test with the ping domain names.
# ping excellent.com
PING chamceul.com (202.155.6.42) 56(84) bytes of data.
64 bytes from 202.145.6.71 : icmp_seq=1 ttl=64 time=0.086 ms
64 bytes from 202.145.6.71 : icmp_seq=2 ttl=64 time=0.098 ms
64 bytes from 202.145.6.71 : icmp_seq=3 ttl=64 time=0.083 ms
64 bytes from 202.145.6.71 : icmp_seq=4 ttl=64 time=0.089 ms
64 bytes from 202.145.6.71 : icmp_seq=5 ttl=64 time=0.084 ms
64 bytes from 202.145.6.71 : icmp_seq=6 ttl=64 time=0.088 ms
done :)
