Linux Settings DNS

Need to create a zone in /etc/named.conf. The zone name must match the domain name.
Additional sub-domains can go in the same zone, but other domains can not. For example, it is not possible to create a zone name of "example.com" then to put an "A record" of "somesite.com" in it. Instead, other domains must go in their own zone.
Here is an example zone.
zone "example.com" {
type master;
file "/var/named/joel/example.com.hosts";
};


Once you've created the zone, you need to create a zone file in /var/named. Of course, the filename must match the name you specified above. I group my zone files by username. In this case, I have a user named “joel”, so I create a directory called /var/named/joel and I create a zone file called example.com.hosts in that directory.
Usually, there will be other zone files you can copy from. Below is an example of what the
example.com.hosts file might look like.

$ttl 1800
example.com. IN SOA ns1.example.com.
admin.example.com. ( 1089054655
10800
3600
604800
1800 )
example.com. IN NS ns1.example.com.
example.com. IN NS ns2.example.com.
example.com. IN A 127.161.144.16
ns1.example.com. IN A 127.161.144.16
ns2.example.com. IN A 127.161.144.17
www.example.com. IN CNAME example.com.
mail.example.com. IN CNAME example.com.
example.com. IN MX 1 mail.example.com.


The lines that have “NS” in them show the name servers. In this case, there are two name servers doing DNS for example.com. Those are ns1.example.com and ns2.example.com.
The lines that have “A” in them are “A records”. These specify IP addresses for those domain names. So, example.com points to 127.161.144.16 (this is a fake example).
The lines that have “CNAME” in them are like shortcuts or links to A records. For example,
www.example.com is a CNAME of example.com. The A record for example.com points to
127.161.144.16, so www.example.com also points to 127.161.144.16.