Saturday, March 26, 2016

How To Add Subdomain DNS Record In Linux?

Recently we got a requirement to configure a Sub-domain(sub-zone) record in DNS server.  Its little bit advanced concept but very much easy to configure. The most known records are as follows.

A record for Adding an IP address record

NS record for a Name Server record



PTR record for a pointer record( i.e. Reverse IP lookup record)

CNAME record for a Canonical name record(i.e. alias to a A record)

MX record for a Mail Exchange record ie Mail server.

SRV record for a Service record(for example Microsoft OCS server record) and this can be used for location based IP address record.

And many more records are there which are less used and for specific use. Here we are going to discuss about how to create sub-domain record and why its used?

Why is a sub-domain record is required?

Ans : To maintain a group of hosts with same sub-domain and for easy or administration.

How to create a sub-domain in Linux?

1. Through Fully delegate the sub-domain(which requires an entry in named.conf file and a separate zone file)

2. pseudo sub domain or virtual sub-domain(no need to give entry in named.conf file and just an entry in existing zone file)

In this post we will show you how to configure Pseudo sub domain.

For example my domain name is linuxnix.com I want to create 3 sub-domain records for following hosts

ns1.in.srinivaslinux.com

mx2.in.srinivaslinux.com

www.in.srinivaslinux.com
If  you observe above host entries we just created a sub-domain for all my Indian servers.

Go to last line of your existing zone file. Give below entries as follows

;Sub-domain definitions
;Req by Meghana_bm, added by srinivas on  26-1-2016
$ORIGIN          in.linuxnix.com.
ns1           IN      A        202.203.204.203
mx2           IN      A        202.203.204.204
www          IN      A           202.203.204.205
Let us explore above lines. We have given $ORIGIN to indicate my sub-domain is in linuxnix.com. So what ever mention after this line it will suffice our sub-domain(ie in, India) to ns1, mx2 and www respectively.

No comments:

Post a Comment