![]() |
|
|
|
|
|
DNS Tutorial
By Vans Information <content@vansinfo.com>
In Linux, the networking related services could be set up in three different ways: The first line tells what would the network-related services like httpd, sendmail, nfsd, ypserv etc, which gets invoked at the time of booting from /etc/rc.d/init.d read, before doing remote communication. It also tells whether the /etc/hosts file mapping where the host entries for each machine is present on each machine or it should read a DNS implemented by BIND software or a nis/nis+ based networking which is dependent on either of the above setup. The second line says whether one machine can have multiple IPaddresses attached with same machine name or not as a Linux platform allows a machine name to have multiple IPaddresses. Example: Let’s say a system administrator wants to setup 3 IPaddresses with the same machine name associated with one Ethernet card with 192.192.192.0 Now in /etc/hosts if we write That means any another machine can access the services of kshounish1 machine by writing any of the ipaddress. Remember that the order means the searching order if it’s like Order hosts, bind. And note that once you change the order you need to start
DNS means Domain Name Service. It is actually a service that can keep large number of machines’ ipaddresses for huge network communication. Now the question arises why is this needed. Lets understand this with the help of an illustration. Example: Let’s say kshounish1, kshounish2, kshounish3, kshounish4, and kshounish5 are the 5 machines in a network, then for communication between each machine, each machine’s /etc/hosts file should have all the five entries of the machine name. Within this small network there would be no problem if you add another machine say kshounish6 in the network. But for this too, the network administrator has to go to each machine, add the kshounish6 in /etc/hosts file and then comeback to the new comer kshounish6 machine and add all the other entries (kshounish1...kshounish5) including its own name also in /etc/hosts file. But what if the network is setup with say 60 machines and a 61st machine has to be added? Then administrator will have to go to each machine again and write the new machine’s name at /etc/hosts/ file and again comeback and write all the 60 machines name on the 61st machine’s etc/hosts file which is a tedious and time taking job. Thus, it is better to keep a centralized server, where all the ipaddresses will stay and if a new one does enter into the network then the change will have to be done at the server and not on the client’s machine. And a better way of setting that client-server networking concept is having one master server and 3-4 slave servers for it.
DNS is a concept of client server network so both sides configuration is needed. Example: Note: Remember, to setup DNS, we need a domain name, as it understand the FQDN format (Fully Qualified Domain Name). So if we decide that our domain name will be bigleap.com. Then our machine names will be kshounish1@bigleap.com…kshounish10@bigleap.com.
1) # vi /etc/host.conf press “i” and write Remember that the machine which is a pure client, should not run the server daemon (“named” discussed below) but slave server can have both server and client process running in their Linux box.
“named” description: For running a proper DNS server a daemon should run something called ‘named daemon’. It merely refers to the names of the machines rather than their ipaddresses. For this, the mapping name should be resolved by a server called ‘name server’. In order to run a `name server’, named daemon is needed. The files needed for configuring and running DNS (master and slave server) are: Before starting configuration by dnsconf utility lets see what actually the DNS server needs to get configured. It needs the following: named configuration file (/etc/named.conf): It basically defines the parameters that point to the sources of domain database information, which can be local files or on remote servers. Hint file (cache file)(/var/named/named.ca): It actually provides the name of root server which gets activated in case the machine name, which is to be searched, is not there in user defined zone (discussed below). localhost file (/var/named.local): All configuration have a local domain Database for resolving address to the host name localhost. Zone: Basically a zone that keeps the information about the domain database. Later in named.conf file we will find that there are two predefined zones --named.local and named.ca --with database of localhost and database of root servers respectively. But zone needs another two files with Ipaddress to hostname mapping and hostname to Ipaddress mapping. The first one is called as Zone File and the second Reverse Zone File. Zone file: The zone file defines most of the information. It is used to map host names to address, to identify the mail servers, and to provide other domain information. Note that the above two files have to be user defined. Now let us configure the master server with a proper example. Example: Taking the above case of kshounish1.bigleap.com to kshounish10.bigleap.com, lets start with dnsconf. #dnsconf To see how it affects /etc/named.conf file, see the example below: Now lets open /etc/named.conf # This particular option tells about the file, which will keep hostname to Ipaddress mapping # this particular option tells about the localhost file mapping # This particular option tells about the file which will keep ippaddress to #hostname mapping If we open named.ca it will show us all the names of root servers, which will work if zone file or reverse zone file fails to serve the DNS queries. Here the zone and reverse zone files are bigleap.com and 192.192.192.reverse respectively.
The database records used in zone file are called as standard resource records or sometimes, just “RRs”. All records have the same basic format: In previous example @: It means from the origin to the lastname object that is bigleap.com. In: This stands for Internet servers SOA: This stands for `Start Of Authority’. It marks the beginning of a zone’s data and defines the parameter that affects the entire zone. Followed by the current machine name where the DNS server is maintained. And, the administrator login, which can be used while DNS is not working. 20000011301;serial: This is the serial number--a numeric value that tells or notifies the slave server, that the database has been updated. So slave server should also update it. 3600;refresh: This is the refresh cycle in seconds. In every refresh cycle the slave server comes to master server and checks for the updated database. 1800;retry: This particular line refers to the retry cycle which in turn means that the slave server should wait before asking the master server again in case master server doesn’t respond. 1209600;expire: This is the time for slave server to respond to queries of client for the expiration time if master server fails and has to be up and not getting up. After this period slave server also fails to solve the queries of clients and sits idle. 432100;default_ttl: This refers to the default time to leave, for this domain to work for, when named is once started. Remember the user doesn’t have to play with this unless he wants that the query time from the slave server should be somewhat less or more. In case we want to change, we should change only the refresh time in both master and slave. The best way is to make it 2, which means after each 2 seconds slave server will query to master server. @ IN SOA kshounish2.love.com. root@kshounish2.love.com. (
So, once the master server zone file and master server reverse zone file is configured well, just start Now our master server is configured. So, if any machine has its name server lookup as 192.192.192.1, we will be able to access it by a command called nslookup.
Slave Server setup: We go to dnsconf and configure secondaries option. It will ask for the master server. We write kshounish1.bigleap.com/ and save it # this particular option tells about the file which will keep hostname to ipaddress mapping got from master server # this particular option tells about the localhost file mapping # this particular option tells about the file which will keep ippaddress to #hostname mapping #/etc/rc.d/init.d/named restart (in kshounish2.bigleap.com.) Similarly, for slave’s slave configuration, we can simply make another slave as kshounish4.bigleap.com saying that its master will be kshounish2.bigleap.com. Remember Example: Normal database:
@ IN SOA kshounish2.love.com. root@kshounish2.love.com. ( @ IN SOA kshounish2.love.com. root@kshounish2.love.com. ( You must have noticed that after adding the new machine we have changed the serial number from 2000011301 to 2000011302. This is done because the slave server updates its database from master. It finds that its serial number is smaller than the master server and when you change the serial number while the slave server queries for updating, its serial number changes automatically as a result of which the slave’s slave also changes.
Other articles by Vans Information
Current Rating: [ 6.42 / 10 ]
Number of Times Rated: [ 396 ]
|
|
|
© 1998-2004 FreeOS Technologies (I) Pvt. Ltd. All rights reserved.
[Privacy Policy]
![]() |