I'm trying to learn some basic real-world-ish .NET deployment stuff (using Web Deploy, remote debugging) by getting a hello-world application to run on several virtual servers. What I want is to have a virtual machine, called
vbox-web on a VirtualBox host-only network, where it will be accessible from the host and from other guests on that same virtual network using that host name. (And later add another VM,
vbox-db, but that's outside the scope of this question.)
What I have done so far:
- The VirtualBox host-only network adapter is set to configure automatically, the network is 192.168.145.1/24, DHCP is enabled at .2, addresses it hands out start at .101
- The VM has Windows Server 2016 installed, with the DNS and IIS roles enabled, no further configuration to those. The host-only network adapter in the VM is also set to statically use 192.168.145.100 as the IP address, and as the DNS server. (Curiously, if have that adapter get the address over DHCP, it doesn't work - it just gets an automatic link-local address.) The computer name is also set to
- The host network adapter is set to get the address over DHCP, receives the address 192.168.145.1 as expected. I've also set it to use 192.168.145.100 as the DNS server.
What this gets me:
- In a browser in the VM, I can open the default IIS homepage through http://localhost/, as well as http://vbox-web/
- In a browser in the host, I can open that same homepage using http://192.168.145.1/, but not using http://vbox-web/ - i.e. what I want to accomplish here.
nslookup - localhostin the VM tells me the DNS request timed out; seems like the DNS server isn't even running?
This means the problem isn't about being able to connect to the guest; I'm missing the part of the puzzle that gets DNS to work correctly here.
Workarounds I'm not interested in:
- Using IPs directly - I want a somewhat realistic setup, nobody sane puts straight IPs into connection strings.
/etc/hosts- see above, there's a reason DNS exists.
- Using bridged networking and letting the wifi router's DNS handle this - this won't work in a workplace network; and also, something that wifi router firmware can do must be doable using a full OS.
- Docker automagical networking - I need VirtualBox working for other work stuff, Docker for Windows would require enabling HyperV and thus knocking out other hypervisors.