BIND Change the IP Address of a Domain or HOST

by on February 5, 2008 · 1 comment· LAST UPDATED February 5, 2009

in , ,

Q. How do I Change the IP Address of a Domain or Host under BIND 8 or 9?

A. You can easily change the IP address of a Domain or host under BIND dns software. You need to update zone database. Usually, named.conf file contains the location for zone file for each domain. You need to open this file using a text editor such as vi and update the domain / HOST IP including serial number. You need to only make changes on master BIND DNS server.

Follow the steps below if you want to change IP address of a domain / host. Open named.conf on master dns server, enter:
# vi named.conf
Find domain name. For example, entry for theos.in, look like as follows:

zone "theos.in" {
        type master;
        file "/etc/bind/zones/master.theos.in";
        allow-transfer { key TRANSFER; };
};

Open zone database file called /etc/bind/zones/master.theos.in, enter:
# vi /etc/bind/zones/master.theos.in
Find A (IP Adress) dns recored for domain called theos.in, which may look like as follows:

@                      3600    IN A     75.126.168.153
www                    3600    IN A     75.126.168.153

Update it as follows to change IP from 75.126.168.153 to 64.12.54.5, enter:

@                      3600    IN A     64.12.54.5
www                    3600    IN A     64.12.54.5

Find serial number, which may look like as follows:
2007071012
And update it:
2007071013
Here is zone before any changes:

$ORIGIN theos.in.
$TTL 3h
@        IN SOA ns1.nixcraft.net. vivek.nixcraft.com. (
                       2007071012       ; Serial yyyymmddnn
                       3h                ; Refresh After 3 hours
                       1h                ; Retry Retry after 1 hour
                       1w                ; Expire after 1 week
                       1h)             ; Minimum negative caching of 1 hour
@                      3600	IN NS    ns1.nixcraft.net.
@                      3600	IN NS    ns2.nixcraft.net.
@                      3600    IN TXT "v=spf1 mx ~all"
@                      3600    IN A     75.126.168.153
www                    3600    IN A     75.126.168.153

Here is zone after the IP Address change:

$ORIGIN theos.in.
$TTL 3h
@        IN SOA ns1.nixcraft.net. vivek.nixcraft.com. (
                       2007071013       ; Serial yyyymmddnn
                       3h                ; Refresh After 3 hours
                       1h                ; Retry Retry after 1 hour
                       1w                ; Expire after 1 week
                       1h)             ; Minimum negative caching of 1 hour
@                      3600	IN NS    ns1.nixcraft.net.
@                      3600	IN NS    ns2.nixcraft.net.
@                      3600    IN TXT "v=spf1 mx ~all"
@                      3600    IN A     64.12.54.5
www                    3600    IN A     64.12.54.5

Save and close the file. Reload bind:
# rndc reload

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Edith Norstrud June 25, 2010 at 9:35 am

I have tried to write a response here and each time I try it refreshes the screen or provides an error. Can the writer could possibly look into the reason it keeps messing up?

Reply

Leave a Comment

Tagged as: , , , , , , , , , , ,

Previous Faq:

Next Faq: