Nameservers not working on 2nd domain added to VPS as a new virtual server

So I added custom name servers and set my glue records at my domain register fine and my primary domain and it’s subdomains are working and propgating fine on my VPS.

I however am having a issue that when I add a new domain as a new virtual server I can not get the nameservers to work.

I tried 2 methods.

  1. I tried using the same nameserver as my first domain on the VPS. For this method I just changed the name server at the registrar on the new domain and added the NS servers to the DNS entry on the new domain. Never worked.

  2. Then I tried to create a new nameserver for the new domain. I added glue records at the domain registar for the new domain just as i did for the first domain and I added both A and NS records for the new name servers in the DNS for the new domain. Did not work.

Am I missing something I need to do when adding more then 1 domain to a VPS with 1 ip?

Thanks

SYSTEM INFORMATION
OS type and version Ubuntu 22.04
Virtualmin version 7.5

I’m having trouble figuring out what you are trying to do.
Setup a name server under your initial domain.
ns0.firstone.com
Setup new domain.
Use ns0.firstone.com as the name server.

It sounds like you are trying to set up a new nameserver for each domain? You only need one instance of dns running on the server.

I am trying to do something that I think is very common in Virtualmin.

I set up my primary domain on a virtual server. Nameservers are working fine on that domain and it’s subdomains.

I then setup a 2nd top-level virtual server with a new domain. I can not get the previous nameservers to work with it and I also can not get new nameservers to work with it setup like I did the first. Neither method is working for the new 2nd domain.

This clearly is not working because I have made an error in how I set things up.

When I setup DNS on the first domain I did all editing in Virtualmin at the domain level under Server Configuration>Dns Records.

I also did the same for the 2nd domain.

On the 2nd domain I only need to add NS records to the DNS records not A records as well like I did for the first domain?

When you add a new domain, Virtualmin should add the appropriate records.

At the registrar they only want the names of the first name servers you set up. They will not match your current domain. You don’t want to set up an actual name server for each domain. You just want to point them to the one you already have set up.

One of these is the name server. All the rest point to it.
image

This screenshot is in webmin under Bind?

Here I do not have a name server listed as zone because I setup my nameserver for the 1st working domain in Virtualmin at the domain level under Server Configuration>Dns Records.

Do I need to go back and resetup my name servers even though they are working for the first domain in Webmin> Bind by creating a new master zone?

You create the first set of nameserves.
ns1.example.com
ns2.example.com
That seems to have worked for you.

You create second domain.
mydomain.com.x
Virtualmin adds a record as shown above
Go to regstrar for mydomain.com.x and add as nameserves
ns1.example.com
ns2.example.com

You do not create new name servers with an IP address.

For the 2nd domain, I do not have to add NS servers to Server Configuration>Dns Records.like i did for the first domain?

That should have been done for you when you created the domain unless you somehow managed to turn it off.

I guess I need to just erase the 2nd domain server and start from scratch because when I added the previous domains name servers to my domain register it does not work for the 2nd domain.

I created a new server to see what nameserver is auto-created. It auto-creates a name server that is just my primary domain but does not include the ns2. and ns2. name servers that I created for the primary domain.

When I saw this I edited it to what I thought would be the correct nameserver ns1.domain.com and then added a 2nd nameserver ns2.mydomain.com

Should I not edit the new domains nameservers?

Your first domain is the nameserver.

Your second domain should have NS records for for those nameserves.
Your second domain should not be set up as a nameserver.
It should only have NS records.

Bottom line. We don’t seem to understand each other. Maybe I best leave this for someone else. Sorry I can’t help more.

Yea, I am not understanding your logic. I hope someone can help thanks for trying.

I am 99% sure the issue is the A record is not correct somewhere and that is the issue.

If you have NS records setup on your bind server when you first setup virtualmin, You must use those NS records on all your virtualservers you will be hosting dns for.

The NS record is what bind uses to serve your domains.
So, if you created NS.mainhostserver.com than it will get added to all your virtualservers.

That NS.mainhostserver.com will need to get added to the virtualservers Domain Register nameserver records and NOT their glue records.

The only domain that should have the glue record is the mainhostserver.com

You can not create individual NS records for each virtualserver running on one instance of bind.

ok, but the name server is ONLY working for the original domain and not working for any additional domains added.

The name server for the original domain was set up in Virtualmin at the domain level under Server Configuration>Dns Records NOT when I set up Virtualmin or on the bind server if this matters.

I spent 4 hours last night and 4 hours today reading everything online, asking AI, and asking in this form to try and figure out why the nameserver that works fine for the first domain will not work on the new domains and new virtual servers on the same VPS.

When I setup the new domains on Virtualmin they DO NOT add the same nameserver as the first domain they just add a nameserver entry that does not include ns1 or ns2. I must add ns1 and ns2 to the new domains on the new virtual servers.

I posted above the DNS screenshots of my working first domain and the non-working 2nd domain.

Do I need an A record in the first domain pointing to the 2nd domain to have the nameservers work properly? Or is there some other configuration needed?

For your ns1 and ns2 there should be A records setup in your DNS.
Then those ns1 and ns2 should have glue records setup at your register.

After that you should be able to add ns1 and ns2 to your virtualservers dns and their Domain register nameservers.

What? Why would you do that?

Have you ever seen anyone else in the world run web and mail on the domain names that they use as name servers?

You don’t need to create virtual servers in Virtualmin for the domain names that you use as nameservers.

In Virtualmin’s post install wizard, you need to do a one time entry of your nameservers when the wizard asks you to specify them. That’s all. You need not do anything else to get the nameservers to work if you have configured your domain correctly and got the glue records set up - which you already have.

So I should delete all NS and A records related to the nameservers from all my virtual servers, leave the glue records as is and go back and run the post-install wizard to set up the name servers? How do I restart the post-install wizard?