Page 1 of 1

How to configure dns with internet in virtualbox?

Posted: 19. Oct 2021, 08:53
by udaykiran2021
For a lab setup, I have created two vms in virtualbox(server 2019) Both are server 2019 datacenter. Both are connected to NAT and Hostonly adapters first machine, I have setup Domain controller and DNS linked to hostonly adapter. The same IP I kept in the 2nd machine as DNS server in the hostonly adapter. If I kept the NAT network as is, the dns routing is going to 8.8.8.8 and can't join to domain the second machine. So, I changed that to first machine hostonly network IP for the dns setting of 2nd machine nat network adapter. Then, I am able to join domain.But the result, I can't access internet from here in 2nd machine.

Also, can we keep the dns setting in the virtualbox configuration itself, instead of editing inside VM?

Please suggest.

Re: How to configure dns with internet in virtualbox?

Posted: 19. Oct 2021, 10:45
by mpack
Having both NAT and "host only" gives you two separate networks, each with their own IP address, DHCP (if provided) and DNS (if provided).

Are you assuming that connecting both networks to one PC turns it into one network? It doesn't btw. You would need to add your own routing software to connect the two networks.

ISTM you want to set up your own single isolated network which has DHCP and primary DNS inside that network, using the host (or host's router) as a gateway. I don't see a reliable way to include the host while you are (I'm guessing) reluctant to disconnect it from the physical network.

Re: How to configure dns with internet in virtualbox?

Posted: 19. Oct 2021, 16:51
by scottgus1
Please review Virtualbox Networks: In Pictures so you can see how the Virtualbox networks work.

Then describe what you're trying to do in general terms, like "I want a server VM running its own domain and DNS, and a client VM that uses the server VM's DNS & DHCP to access the internet. I do/don't want the host involved in the domain". We may then be able to show what network types ad connections to use.