How to create Nameserver with a name that is different than hostname

Cemtos 8
OK. I am setting up the new virtualmin server but I am having an issue setting up a nameserver on the same machine.

The hostname for the server is

If I following the directions here: DNS Frequently Asked Questions | Virtualmin I go to Server Configuration -> DNS Records, and create a new “A - IPv4 Address”
When I do, under record name I have the option of Same as domain or If I choose the first the new record is like it says, the same as the domain ( if I choose the second the nameserver record will be ns5.

Is there any way to have a nameserver on this box that is simply To me it looks like I would have to change the hostname to This is not ideal. Does anyone know how to accomplish this? Do I have to create a new Virtualmin server called

I know it will throw an error if the nameserver name hasn’t been registered or is registered to a different IP; but as far as I know, it will still accept the entry.

I just created one named “bobby.” Virtualmin voiced its objections, but still recorded the entry.

As an aside, some of my nameserver pairs over the years:

bonnie and clyde
joshua and caleb
sacco and vanzetti
sonny and cher

Now I’m old and boring. I just use NS1 and NS2.


1 Like

Hi RJM_Web_desing,
Sorry. I am not sure if I understand. Are you saying I need to create a new Virtual server for the Nameserver Like

No, not at all. But if you haven’t registered the nameserver names with the registrar holding the domain registration (or if they’re registered to different IP’s), Virtualmin will tell you about it. But it will still make the entries in BIND.

It’s not unusual for nameservers to be incorrect temporarily. Lots of hosts migrate accounts to new servers and re-point the same nameservers to the new IP’s when they’re finished with the migration. That’s to prevent the clients from having to change their domain namesevers with their own registrars, which invariably triggers tickets from the… let’s just say “challenged” clients.


Sorry RJM - I meant not ns6.

So this Virtualmin server is new. is hosted on a cPanel server as well as NS1-NS4.
I have already registered at the registrar using the IP for the new Virtualmin server.
In order to follow along with the documentation here: DNS Frequently Asked Questions | Virtualmin
Where it says:

“you’ll want to log into Virtualmin, select your “” domain, click Server Configuration -> DNS Records, and create a new “A - IPv4 Address” record for and”

The problem is (or in our discussion it is is already hosted on the cPanel server. To get inline with the documentation I added to the new Virtualmin server, and then followed the rest of the documentation.
Is there a way to add the nameservers without having set up on the virtualmin server? Or does the on Virtualmin need to match the record on the cPanel server.

I am so sorry I am not getting this.

Ah, okay. That’s clearer.

I’m sure you can do this; but everything that follows is something I’ve never actually done in your exact situation. So it could be wrong advice. Wait for verification from someone who’s actually done it.

What I personally would do would be give the new server a unique hostname on the same domain as the old one. So if the old one were server1.domain.tld, I might name the new one server2.domain.tld.

What I did next would depend on whether I intended to keep the old server in service or not. If so, I would create two new nameservers on the new server, for example, NS3.domain.tld and NS4.domain.tld , and register them with the registrar for domain.tld. That’s assuming that the old server was using NS1 and NS2. The important thing is that the new ones be unique.

I would also create entries in BIND on the old server pointing to the IP’s for server2, NS3, and NS4 on the new server. The old server remains authoritative for the domain. New accounts on the new server would have their nameservers pointed to the new ones on the new server, which would become authoritative for those new domains.

Now… if my intention were to decommission the old server, I would first shorten the TTLs on the old server to something absurdly short, like 300 or 600.

I would then create the identical nameservers on the new server as those on the old ones, but not register the change just yet. Virtualmin will complain, but will make the entries.

Next I would migrate all the sites and check to make sure everything was in order. Once certain of that, I would…

  1. Register the IP changes for the nameservers at domain.tld's registrar.
  2. Change the entries for the nameservers and all of the migrated domains, on the old server, to point to the IP’s on the new server.
  3. Wait until the old server hasn’t received any traffic for a few days, and decommission it.

In this way, no changes need to be made to the nameservers for the migrated domains. The IP’s for the nameservers themselves will have been changed, so there will be no need.

The old server’s role during the transition is reduced to a traffic cop, pointing any traffic that arrives during propagation or due to client-side caching to the new server. Typically it takes a few days to a few weeks for the server to no longer receive any traffic.That’s the point of shortening the TTL’s (“time to live”). It instructs connecting clients to query DNS if more than that many seconds have elapsed since their last connection. It’s useful for reducing client-side caching problems and speeding up propagation.

Again, I’ve never done this from cPanel > Virtualmin, so it’s very possible I’m missing something. When I did it, the migration was to a server with an entirely different FQDN from the old one; and because I owned all the domains to be migrated, I just batch-changed their nameservers at my registrar.

If they were client sites, I would have re-created the new server with the same FQDN and nameservers as the losing one; and with any luck, the clients wouldn’t have even noticed the change.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.