Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Let's say there is a host OS (Mac OS X) and a virtual machine running Ubuntu as guest OS. The guest OS has the IP 192.186.56.101 and some virtual hosts, e.g. ubuntu.server

So, how to really map a request to the virtual host ubuntu.server on the guest OS?

I tried:

Configure the host OS in /etc/hosts to map ubuntu.server to 192.186.56.101 On the guest OS we have the trouble. It accepts the request for 192.186.56.101 which is not ubuntu.server and therefor the ubuntu.server virtual host will never be requested. Just the localhost on the guest OS. It might surely be possible to simply then use 192.168.56.101. But this would only work for one host per guest OS.

Any idea? Or is there a bug in my train of thoughts?

share|improve this question

3 Answers 3

Gotta use bridge networking instead of NAT (Uses same connection/ip as the host computer is)

Are you using Parallels/VMWare/Virtual Box?

They all have options for bridged.

share|improve this answer
    
Bridged networking really make sense. I have just installed VMware and tried different settings. How do I tell my host to map the "ubuntu.server" host request no to the world wide web? –  Bernd Jan 5 '10 at 19:55
    
There is even no internet connection when using bridged networking only. Maybe I should solve this first. –  Bernd Jan 5 '10 at 20:02

Is the VM using bridged networking?

Did you establish that the VM guest is seeing the network properly, and that hosts outside on the network can connect to the guest VM (ping, ssh, etc.)?

Once you do that, then you should be able to configure virtual IP's and such to the guest.

share|improve this answer
    
At the moment it is NAT and Host-only with Virtual Box. –  Bernd Jan 5 '10 at 14:00
    
You'll probably want it bridged. NAT, especially in Virtualbox, I've found to be problematic with getting connections from physical to virtual systems to work well. It involves a lot of hoop-jumping and getting virtual IP's to work? I'd never even try it. –  Bart Silverstrim Jan 5 '10 at 14:30

You have to configure the network that the guests connect to as a "bridged" network. This will give them direct access to the network that the host is connected to. It will also permit the network direct access to the guests as if they were real hosts.

Note that this means that either you have to have valid network IP addresses to assign to your guests, or that the network in question is able and willing to hand out valid DHCP leases to your guests.

Alternatively you may be able to set up a route between your guests on the "host-only" network and your real network. But this will be more work, and at the very least the router on your network will probably be required to know about your private "host-only" network IP space and the fact that it is reachable through your host.

Bridged networking is the simplest to set up and use.

share|improve this answer
    
With Virtualbox I think there are additional steps involved to get it's NAT'ed IP to allow incoming connections. Not fun or easy. –  Bart Silverstrim Jan 5 '10 at 14:31
    
Which I know is why you said to add bridged networking (I just hadn't thought to mention it) but I think the poster was using NAT with Virtualbox at the moment. Personally for playing with server stuff I'd recommend considering VMWare or something else...I've found VirBox to be great for workstation VM's, but not server tasks. Just my opinion, though. –  Bart Silverstrim Jan 5 '10 at 14:40
    
I don't think you could add external access to the NAT network because even if packets were routed in, the replies would get NAT'd back out and the connection wouldn't work. You might be able to port-forward certain ports back into the guests, but it would be fiddly to get right. (I agree that VMware Server is a better option for VMs that are going to be actual services.) –  David Mackintosh Jan 5 '10 at 15:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.