Question

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

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.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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?