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.

I'm configuring a LAMP development environment inside a VM and I'm no Linux/networking champ but I'm trying.

I've installed Centos (5.6) in a VM (VirtualBox) on my local machine. I've set networking mode to "Network Bridge" which, if I understand correctly, means that the VM gets an IP adress from the network my local machine is connected to.

My question: what if I'm not connected to a network (like on an airplane) and I want to do some programming. I'm guessing that the VM doesn't get a connection to a network because there is no network. Because the VM is not connected to a network I can't reach it on my host machine.

How would I go about accessing (using HTTP) the LAMP-VM on my local machine without having to depend on an external network?

(I'm not looking for a solution where I run Apache locally, I need to have a duplicate of the production environment)

Update: host OS: Windows 7 Pro

share|improve this question
    
What is your host OS and distribution? Otherwise it is difficult to answer. This is easy to do with Ubuntu and KVM, just set up a bridge in the host, bind an IP to it and connect it to your guest and bind another IP there. Use RFC 1918 addresses for this virtual development network. Note that the bridge does not need to be connected to any real network interface in the host. –  snap Aug 3 '11 at 15:56
add comment

2 Answers

up vote 1 down vote accepted

You're getting your layer 2 and 3 mixed up.

The Bridged mode bit means your host and guest are on the same layer 2 network. That this mechanism allows your guest to access the same DHCP/BOOTP server as your host and get a (layer 3) IP address is a consequence of this network configuration, but not a direct result.

What this means is that if you manually set valid* IP addresses on both host and guest they'll still be able to communicate when the external network is no longer there.

*make sure you pick good addresses, maybe speak to your networkadmin/sysadmin.

share|improve this answer
    
A very educational answer, thanks! –  Niels Bom Aug 4 '11 at 7:30
add comment

If you are assigning a static IP address to you CentOS machine then it should work as it and your laptop are in effect on the same network (via the bridged adaptor) even if your laptop isn't attached to a network.

Note that your laptop needs a static IP address in the same network as the CentOS machine too.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.