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 it’s 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.linuxnix.com

mx2.in.linuxnix.com

www.in.linuxinx.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 Surendra on  26-1-2011
$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.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.