Updating an A record from Command Line

Domain Name Service, or DNS, can be one of the most be one of the more complicated concepts in server administration. This article will walk through changing an A record from the Linux command line.
This article assumes that you are running BIND on a linux server, that you already have an understanding of what DNS is, the different types of DNS entries, and how DNS works. Please note: The incorrect editing of your zone file can take your site offline. All editing must be done on the authoritative nameservers for the given domain.

NOTE: Before updating any DNS record, you will want to lower the Time to Live (TTL) values for that zone file. A guide to dropping the TTL values can be found here.

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


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

When editing an A record, we are concerned with any of the lines that something ‘IN A IP-address’. You may want to change an A record because the IP of a subdomain has changed for whatever reason. Due to propagation times involved with making DNS changes, you will want to make sure that you only make changes if they are absolutely needed.

The steps to change the A record are rather straightforward. In this example, we will change the IP address of the ftp.example.com subdomain. To make these changes from the command line:

  1. Edit the zone file with your favorite command line editor. In this example, we use ‘vi’.
  2. [root@host /var/named/]% vi /var/named/example.com.db

  3. Locate the appropriate line and update the up address. You will see something like the following:
  4. ftp IN A 192.168.1.100

  5. Update the Zone’s Serial number.
  6. Make BIND aware of your DNS changes by reloading the DNS zone.
  7. [root@host /var/named/]% rndc reload example.com

  8. Test that your changes worked correctly using ‘dig’.
  9. [root@host /var/named/]% dig @localhost ftp.example.com

That is all you have to do to change an A record on the command line. If you are uncomfortable with the command line, you can also update your A records usingĀ Web Host Manager.

If you have any questions or are not comfortable making these changes yourself, please feel free to contact Heroic Support.

===

Liquid Web’s Heroic Support is always available to assist customers with this or any other issue. If you need our assistance please contact us:
Toll Free 1.800.580.4985
International 517.322.0434
support@liquidweb.com
https://manage.liquidweb.com/

Be Sociable, Share!
Here's $75, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support.