Variables in named.conf

My server have one IP and several domains hosted.

One and same IP appear in named.conf and several zone files.

When the IP address of the server changes, I need manually to change all those IP's.

Is there a way to do something like:

in named.conf:

#define $IP 123.123.123.123

zone file:

        MX 10     mail
        A         $IP
www     A         $IP
mail    A         $IP
*       CNAME     www

any help will be appretiated


Solution 1:

Well, if the IP Address is always the same for @, www and mail, you can add an $INCLUDE directive to your zone files (see here).

Ideally, create a commons.db zone file with your common zone descriptions:

@        IN    A    1.2.3.4
wwww     IN    A    1.2.3.4
mail     IN    A    1.2.3.4
*        IN    CNAME    www

and then in your domain zone files simply do:

@        IN    MX 10    mail
$INCLUDE  commons.db