I’m running a Windows 7 host and a Linux Mint guest vm in Virtualbox using a bridged adapter. I have multiple web sites set up in the guest os. Currently, I can only access the page at var/www/html from the host by ip address. All sites use var/www/site.name as their root.
The goal is to be able to access any site configured on the guest using any capable device on the lan. But, there’s a catch…
In theory anyway, what I’d like to do is have the vm take over all requests to the internet when it is running. So that, if a site is configured on the guest it will serve the lan version to the device that requests it. However, the physical machine I am working on is not always running and this is a home network which uses a cheapo(limited functionality) router provided by the Isp.
I started to set up bind9 on the guest to handle Dns using this tutorial, but it seems like I’d have to point all devices to it with static ip addresses and that I would manually have to keep up with device/site changes to the lan. I’m also not sure how that will affect the network when the vm is not present.
The tutorial also mentions the ability to have DHCP pass updates to the Dns records, but then I can only use the vm DHCP which means I would have to have it running all of the time. Is that right?
Anyhow, I’m out of my element when it comes to networking in general. Is there a way to spin up a vm and have it serve its virtualhosts to the lan, preferably without continually editing devices and files?
Not the full answer, but some thoughts.
If the devices in you network uses DHCP to get the ip address, you can configure the DNS Server details also in the DHCP server. Then you VM can run a DNS Server which will map URLs to absolute paths (like IP-Address/location/). You can give the IP address of your VM (DNS Server) on top (in DNS list), then the IP of a normal DNS (like google dns (188.8.131.52)).
If your VM is not running, browser will first try your VM’s IP, if no response, it will try the consequent DNSs, hence will resolve the URL.