How to Update A Records from the Command Line Interface in Linux

March 13, 2012 / How-to Guide

Server admins are well aware of the criticalities and complications that are involved in their jobs. Amongst the varied tasks, DNS forms one of the key areas that requires an eye for perfection. Any changes to the DNS configuration should be done by experts or someone who has fair experience with it.

In the previous article, we learnt the steps for changing a records in cPanel , In this tutorial, we would take a look at the steps to update the A record from the command line interface in Linux.

As we did in the last tutorial, here again we’d make certain assumptions,

  • We assume that you have BIND running on your Linux web hosting Server,
  • You have the essential knowledge of DNS and its entries, and
  • Most importantly, we assume that you are aware of the consequences of updating the zone file with incorrect details. Any incorrect entry to this configuration would cause your site to be inaccessible.

You may even prefer to lower the TTL- Time To Live value for the particular domains zone file, before proceeding with updating the DNS record.

Below is an example of what the zone file looks like from the command line.

; Zone file for yourdomain.co.uk
$TTL 14400
@ 86400 IN SOA ns1.yourdomain.co.uk. admin.yourdomain.co.uk. (
2010090802 ; serial, todays date+todays
86400 ; refresh, seconds
7200 ; retry, seconds
3600000 ; expire, seconds
86400 ) ; minimum, seconds yourdomain.co.uk. 86400 IN NS ns1.yourdomain.co.uk.
yourdomain.co.uk. 86400 IN NS ns2.yourdomain.co.uk.
yourdomain.co.uk. IN A 67.227.186.122
localhost.yourdomain.co.uk. IN A 127.0.0.1
yourdomain.co.uk. IN MX 0 yourdomain.co.uk.
mail IN CNAME yourdomain.co.uk.
www IN CNAME yourdomain.co.uk.
ftp IN A 67.227.186.122
cpanel IN A 67.227.186.122

NOTE : We would recommend you to make changes to the DNS configuration only when its the most needed.

Once you are aware of the severity of the issue and have taken the necessary measures to avoid mistakes, making changes to the A records are pretty simple.

Below is the procedure to amend the IP address to a sub-domain.

Step 1:

In the command line interface, enter the following command inorder to edit the zone file (You may use any of your preferred editors)

[root@host /var/named/]% vi /var/named/yourdomain.co.uk.db

Step 2:

Look for the line that states the IP address and ammend it with the new address.

ftp IN A 192.168.1.100

Step 3:

You must now update the Serial number of the Zone.

Step 4:

You must now inform BIND about the DNS updates and reload the DNS zone by using the below command

[root@host /var/named/]% rndc reload

Step 5:

You may then reload the named service using the following command

[root@host /var/named/]% /etc/init.d/named reload

Step 6:

Recheck whether the changes have been successfully implemented

[root@host /var/named/]% dig @localhost ftp.yourdomain.co.uk

Alternately, you may also make these changes via. WHM.

If you need any assistance, kindly contact our Support Department via. our 24×7 Live Chat available at our website or raise a ticket from the client area (helpdesk).

Spread the love