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
$TTL 14400
@ 86400 IN SOA (
2010090802 ; serial, todays date+todays
86400 ; refresh, seconds
7200 ; retry, seconds
3600000 ; expire, seconds
86400 ) ; minimum, seconds 86400 IN NS 86400 IN NS IN A IN A IN MX 0
ftp IN A
cpanel IN A

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/

Step 2:

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

ftp IN A

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

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