Question

How to Use Two Domains with One Bind Server and One IP Address

Posted January 12, 2022 84 views
Initial Server Setup

Can I use two domains with one bind server and one IP address? I have two domains: domainold.com (successfully configured) and domainnew.com.

But every time I try to access domainnew.com, I am redirected to domainold.com instead.

Here is my named.conf.local:

zone "domainold.com" {
        type master;
        file "/etc/bind/db.domainold.com";
        allow-transfer { xxx.xxx.xxx.xxx; };
        also-notify { xxx.xxx.xxx.xxx; };
};

zone "domainnew.com" {
        type master;
        file "/etc/bind/db.domainnew.com";
        allow-update { none; };
};

Here is my domainnew.com file:

$TTL    604800
@   IN  SOA ns1.domainold.com. admin.domainnew.com. (
                  2     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  ns1.domainold.com.
@   IN  NS  ns2.domainold.com.

@   IN  A   103.121.122.180
;ns1    IN  A   103.121.122.180
;ns2    IN  A   103.121.122.180
;mx IN  A   103.121.122.180
;mail   IN  A   103.121.122.180

www IN  CNAME   domainnew.com.

And here is my domainold.com file:

$TTL    604800
@   IN  SOA domainold.com. admin.domainold.com. (
                  2     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  ns1.domainold.com.
@   IN  NS  ns2.domainold.com.

@   IN  A   xxx.xxx.xxx.xxx
ns1 IN  A   xxx.xxx.xxx.xxx
ns2 IN  A   xxx.xxx.xxx.xxx
mx  IN  A   xxx.xxx.xxx.xxx
mail    IN  A   xxx.xxx.xxx.xxx

www IN  CNAME   domainold.com.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Oops, sorry to add. xxx.xxx.xxx.xxx and 103.121.122.180 are actually same IP address. I forgot to edit the value.

On domainnew.com nameserver settings on my domain management provider, I am using ns1.domainold.com and ns2.domainold.com as nameservers. Is this correct?