How to create a DNS server

segunda-feira, 16 de janeiro de 2012

1. Create a list of host names and correspondence IP addresses in your /etc/hosts file.
2. # mkdir /etc/named.data3. # cd /etc/named.data4. Create a file named param that will be used by hosts_to_named to create DNS data files-d DNS.com  --> it's your domain name
-n 192.168.3  --> it's your subnet
-z 192.168.3.10 --> it's your master server's IP.
-b /etc/named.conf


5. Now you have to make a data base to be used for your dns, the follow command will use the hosts contens to generate it.

# hosts_to_named –f param

6. download the db.cache file from ftp.rs.internic.net and copy it to /etc/named.data directory

# ftp ftp.rs.internic.net
Connected to ftp.rs.internic.net.
220-**********************************************************
220-**********************************************************
220-***** InterNIC Public FTP Server *************************
220-**********************************************************
220-***** Login with username "anonymous" ********************
220-***** You may change directories to the following: *******
220-**********************************************************
220-******* domain - Root Domain Zone Files ******************
220-**********************************************************
220-***** Unauthorized access to this system may *************
220-***** result in criminal prosecution. ********************
220-**********************************************************
220-***** All sessions established with this server are ******
220-***** monitored and logged. Disconnect now if you do *****
220-***** not consent to having your actions monitored *******
220-***** and logged. ****************************************
220-**********************************************************
220-**********************************************************
220
Name (ftp.rs.internic.net:root): anonymous
331 Please specify the password.
Password:Press Enter
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd domain
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.


-rw-r--r-- 1 ftp ftp 607 Nov 01 19:31 INTERNIC_ROOT_ZONE.signatures
-rw-r--r-- 1 ftp ftp 843Nov 01 19:31 INTERNIC_ROOT_ZONE.signatures.asc
-rw-r--r-- 1 ftp ftp 694Nov 01 19:15 arpa.zone.gz
-rw-r--r-- 1 ftp ftp 33 Nov 01 19:14 arpa.zone.gz.md5
-rw-r--r-- 1 ftp ftp 65 Nov 01 19:15 arpa.zone.gz.sig
-rw-r--r-- 1 ftp ftp 2938Jul 09 14:55 db.cache
-rw-r--r-- 1 ftp ftp 48 Jul 09 14:55 db.cache.md5
-rw-r--r-- 1 ftp ftp 1326 Jul 09 14:55 db.cache.sig
-rw-r--r-- 1 ftp ftp 2941Jul 09 14:55 named.cache
-rw-r--r-- 1 ftp ftp 51Jul 09 14:55 named.cache.md5
-rw-r--r-- 1 ftp ftp 1322Jul 09 14:55 named.cache.sig
-rw-r--r-- 1 ftp ftp 2940Jul 09 14:55 named.root
-rw-r--r-- 1 ftp ftp 50 Jul 09 14:56 named.root.md5
-rw-r--r-- 1 ftp ftp 1330Jul 09 14:56 named.root.sig
-rw-r--r-- 1 ftp ftp 83145Nov 01 19:32 root.zone
-rw-r--r-- 1 ftp ftp 21228 Nov 01 19:33 root.zone.gz
-rw-r--r-- 1 ftp ftp 33Nov 01 19:31 root.zone.gz.md5
-rw-r--r-- 1 ftp ftp 65 Nov 01 19:31 root.zone.gz.sig
-rw-r--r-- 1 ftp ftp 33 Nov 01 19:32 root.zone.md5
-rw-r--r-- 1 ftp ftp 65Nov 01 19:33 root.zone.sig

226 Directory send OK.
ftp> get named.cache
local: named.cache remote: named.cache
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for named.cache (2941 bytes).
226 File send OK.
2941 bytes received in 0.00444 secs (6.5e+02 Kbytes/sec)
ftp> quit
221 Goodbye

# cp named.cache /etc/name.data

7. modify /etc/rc.config.d/namesvrs file (NAMED=1) to start named process automatically with the server.

8. Start the named server

# /sbin/init.d/named start