Use BIND on one Virtualmin Instance to resolve a subdomain for another host running virtualmin

8 posts / 0 new
Last post
#1 Wed, 01/16/2019 - 13:23
palomnik

Use BIND on one Virtualmin Instance to resolve a subdomain for another host running virtualmin

I have one Virtualmin instance running with some virtual servers on a VPS: host2.domain.com I have the domain reg of domain.com pointing to the IP, and then all of the subdomains,e.g. test.domain.com and the serv host2.domain.com are resolved by BIND on that server.

I am out of room on that server and I am now setting up a second server: host3.domain.com. I would like for the BIND server on host2 to resolve the address for host3 and any virtual servers installed on that.

What is the best way to do this? I don't understand the whole master/slave thing, and I think I am looking for something simple if possible. I tried setting up a master zone for host3 in BIND on host2, pointing to the new IP address, but it doesn't resolve.

Any suggestions on the sanest and/or simplest way to do this?

TIA

Thu, 01/17/2019 - 01:19
adamjedgar

whilst i havent done this myself, i would have thought that it would be as simple as creating another "A record" in the zone file (on your nameserver) pointing at the new host where the subdomain is located?

for example sub.domain.com IP 123.456.789

then so long as virtualmin is installed on the new server, and you have created a "virtual server" account on the new server with the name "sub.domain.com", shouldn't that work?

Now i appreciate that normally virtualmin hierarchy appears to be Virtual Server>Sub Server ...should this really matter if the parent account on the second system is a subdomain? (ie the first level virtual server is "sub.domain.com")

I cant see how this wouldnt work...i dont see why virtualmin and apache would give a rats ass so long as the record exists, and correlates with a virtual server with same name, and the ip address is correct

Check out the following website http://content.websitegear.com/article/subdomain_setup.htm

Note the section titled "Record setup"

Address (A) Record Setup: A hostname DNS entry is required if the subdomain is pointing to a different IP address than that set for the domain name.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Thu, 01/17/2019 - 18:42
palomnik

I set up the second instance as a Slave DNS server as per the instructions at: https://www.virtualmin.com/node/44970

I may be having to wait for propagation, but the second host (slave is still not resolving).

Fri, 01/18/2019 - 05:35
adamjedgar

Eh?

I think we are talking about 2 different things here.

A slave dns (slave nameserver) has nothing to do with subdomains on different host to the primary domain.

You said that you already hve a server with primary domain and subdomains on it. This server is full and you have created an additional server (a new host) for more subdomains...but are having rpoblems getting dns to resolve for subdomains on the new server.

If what i have stated is correct, then you need to study the article i gave you in my other post above.

Otherwise, if what you in fact mean in that your hosting server is fully allocated and you are actually creating another virtualmin instance on a new host...then its even easier.

  1. Create the new server with virtualmin and set it up as a primary dns server
  2. at registrar, create a glue record for the new host/primary ns ip address
  3. All clients point an A record at the new server IP address

You dont need to even use your own nameserver...meaning steps 1 and 2 above are not required (use registrars free dns)..so long as the virtualmin server IP address is reserved for you its a no brainer (ie static ip that is yours and can be transferred to a new host if something bad happens to existing one)

This will save you a lot of dns issues and money and heartache having to run your own name servers.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Fri, 01/18/2019 - 07:42
palomnik

But doing things the hard way with money and heartache is how I roll! ;-) I took your advice and moved all of the DNS records to Namecheap - it took all of 20 minutes and everything was done - too easy!

Can I just turn off bind? How does the host select the virtual server without it?

Sat, 01/19/2019 - 01:38 (Reply to #5)
adamjedgar

i have turned Bind off in the past, however, i would urge a bit of caution here.

If there are any Virtualmin Subservers running on your machine, perhaps it might pay to ask someone with a little more experience than me about this one. I have found that attempting to turn off Bind (customising the default install) sometimes leads one to opening a can of worms that haunts to the point of hopelessness. A lot of errors may begin to appear from dependencies. I have managed to navigate my way through them in the past, but i would imagine that you should ask Jamie, Joe, or someone on here with plenty of experience, about the best way forward with that one.

If your server has plenty of resources, just leave it until you are sure of the potential side effects won't harm anything you already have in place.

I have always found that Virtualmin runs best when its defaults (from first install) are left alone!

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Mon, 01/21/2019 - 05:26
briand

I often setup a subdomain on a new server to test it prior to moving to the new server.

I just 'hack' the DNS records to add a new A record. :o)

xyz.co.uk. IN A 12.230.222.31 www.xyz.co.uk. IN A 12.230.222.31 new.xyz.co.uk. IN A 34.152.118.24

I then setup or transfer the domain to new server and the just manually add the same 'new' record to the new server.

this might be the hacky way to do it though ;o) Brian

Fri, 02/01/2019 - 06:00
palomnik

Thanks - I did turn off Bind. I also deleted some alias domains, and then nothing would load. I poured over my DNS settings, settings in Virtualmin, etc. and banged my head against the wall, until I looked at the WordPress Tables, and realized that I had set the URLs to the alias domains (which I use to install the site before domain switching so that there is no downtime) - it had the URLS from the gone alias domains - oops! fixed and working.

Topic locked