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
@ 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 188.8.131.52
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 184.108.40.206
cpanel IN A 220.127.116.11
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:
- Edit the zone file with your favorite command line editor. In this example, we use ‘vi’.
- Locate the appropriate line and update the up address. You will see something like the following:
- Update the Zone’s Serial number.
- Make BIND aware of your DNS changes by reloading the DNS zone.
- Test that your changes worked correctly using ‘dig’.
[root@host /var/named/]% vi /var/named/example.com.db
ftp IN A 192.168.1.100
[root@host /var/named/]% rndc reload example.com
[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