2

I have a number of local websites in development on my Windows PC, set up as virtual hosts within Apache, with hostnames (along the lines of dev.example.com) resolved via the hosts file, so I can test them out them with various browsers.

I now want to extend browser testing to running browsers in various OSs in virtual machines, and want to be able to resolve dev.example.com from the VMs. Currently these are a mix of VMWare Server and VirtualPC.

I know I can edit the hosts file on any Windows VMs, but this is a bit fiddly and I'd like a solution which is independent of the individual VMs.

I think what I need is a nameserver, but what's the simplest way of going about this? I'd like everything to be self-contained on the one machine.

I think I can cover firewall and Apache permissioning issues.

1
  • You either have to change the hosts file or the DNS server (in network settings) on the VM. I mean to say: both are editing something. (or something+alot)
    – Rudie
    Apr 5, 2011 at 22:23

2 Answers 2

2

Host files are by far the easiest method to do what you want.

If you do not want to use them, then take a look at creating another Virtual Machine and installing either Linux with a DNS server (I can't really recommend any distributions over any others), or Windows Server 2003 (or 2008).

In Windows 2003/2008, you can install DHCP Server and DNS Server, create a new zone for each of the domains you want - and put the IP of your main machine. (In Linux, you can obviously do the same, but I can't really recommend much - in the past, I have used Ubuntu Server + Webmin to do the hard work, if you are good at Linux, you may find it easy - but I find using Windows Server to be much simpler for this.)

All you need to do from the client machines is set to automatic IP and make sure that the DHCP server is the only one accessible, or skip DHCP and just set the DNS server to the IP of the virtual machine. If you also set forwarders (or just use Root Hints) on the DNS server, it should be able to fully resolve all sites on the internet as well as serving the sites you want.

There is so much I can say on this, I almost didn't write an answer because I didn't think I would touch all the points I need to - if you want clarification or more information on any points, feel free to ask.

1
  • Many thanks for this. It does seem a bit more work than I had anticipated. I think I will probably use host files for now and investigate the options you have suggested at a later time.
    – e100
    Mar 11, 2010 at 8:40
1

On my home network, I have a Windows XP host with a VirtualBox FreeBSD guest, with a bridged network interface.

I have a router running Tomato firmware. Every machine on the network--real or virtual--gets a static DHCP entry that includes its hostname. I set the "Use Internal Caching DNS Forwarder" option in Tomato, and the result is that every DHCP client uses the Tomato router as its DNS server, and the router correctly answers requests with the static DHCP hostnames.

1
  • Thanks but I'd like it all running on the one PC - a laptop - so I'm not tied to a single location.
    – e100
    Apr 12, 2010 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .