Setup multiple VPS with single domain name and two set of nameservers (glue records)

dns-zoneglue-recordnameserver

I am stuck in a bit complicated situation(complicated for me, might not be for you).

What I have:

I have 2 virtual private servers on two different IPs eg. 192.0.0.1, 192.0.0.2(let's name these vps1 and vps2) and one domain name eg. foo.com.

What I want to produce:

I want to host multiple websites on these two vps eg.
on vps1, I want to host one-bar.com, two-bar.com and, on vps2, I want to host three-bar.com, four-bar.com.

What have I done:

I have created 4 glue records with my registrar of foo.com ie. ns1.foo.com, n2.foo.com, ns3.foo.com, ns4.foo.com,

  1. ns1.foo.com and n2.foo.com resolve to IP address of vps1 (192.0.0.1)
  2. ns2.foo.com and n3.foo.com resolve to IP address of vps2 (192.0.0.2)

I updated,

  1. nameservers for foo.com, one-bar.com and two-bar.com to ns1.foo.com and n2.foo.com.
  2. and, nameservers for three-bar.com and four-bar.com to ns3.foo.com and n4.foo.com.

I have installed webmin on both vps to manage websites and dns, This is stripped down copy of my zone files,

vps1 and domain foo.com:

@ IN SOA ns1.foo.com. root.ns1.foo.com. (
1465031833
10800
3600
604800
38400 )
foo.com. IN A 192.0.0.1
ns1.foo.com. IN A 192.0.0.1
ns2.foo.com. IN A 192.0.0.1
ns3.foo.com. IN A 192.0.0.2
ns4.foo.com. IN A 192.0.0.2
foo.com. IN NS ns1.foo.com.
foo.com. IN NS ns2.foo.com.

vps1 and domain one-bar.com:

@ IN SOA ns1.foo.com. root.ns1.foo.com. (
1465031833
10800
3600
604800
38400 )
one-bar.com. IN A 192.0.0.1
@ IN NS ns1.foo.com.
@ IN NS ns2.foo.com.

vps2 and three-bar.com:

@ IN SOA ns3.foo.com. root.ns3.foo.com. (
1465031833
10800
3600
604800
38400 )
three-bar.com. IN A 192.0.0.2
three-bar.com. IN NS ns3.foo.com.
three-bar.com. IN NS ns4.foo.com.

What I am able to produce:
Websites on vps1 ie. foo.com, one-bar.com and two-bar.com are resolving properly but, websites on vps2 aren't.

Can anybody help me to find out what am I doing wrong?

PS: Thanks in advance!

Best Answer

NS1 is the primary DNS for foo.com. you should add records for all 4 sites, one-bar, two-bar , three-bar and four-bar to both NS1 and NS2. NS2 should act as a redundant DNS server for you.

Related Topic