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 have VirtualBox 4 running on Win 7 with a Centos 6 guest VM set up for hosting my dev server. When I'm connected to my home network the guest can be accessed via a static IP address that I configured (192.168.56.2), but not when I'm in the office. I'm guessing that the DHCP server in the office doesn't have a gateway configured for the 192.168.56.x IP range. I read something about the VB host-only adapter that should allow me to set this guest VM up in such a way that I don't need to be on any network to be able to access the guest from the host using a static IP. I've not been able to find out exactly how to configure this though. Can anyone give me an example configuration, thanks.

UPDATE:

Thanks for your responses. I've now set up a single virtual network adapter in VirtualBox and set it to host-only:

C:\Users\Ben>vboxmanage list hostonlyifs
Name:            VirtualBox Host-Only Ethernet Adapter
GUID:            d419ef62-3c46-4525-ad2d-be506c90459a
Dhcp:            Disabled
IPAddress:       192.168.56.2
NetworkMask:     255.255.255.0
IPV6Address:     fe80:0000:0000:0000:78e3:b200:5af3:2a57
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 08:00:27:00:94:e8
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter

On the guest I've set up eth0 to use the same IP address as the host-only adapter (192.168.56.2) but when I try to log in using Putty I still get "Network Error : connection refused". VirtualBox DHCP servier is enabled but I can't ping the gateway (192.168.56.1) from either host nor guest. There's no firewall running on either OS. What next?

share|improve this question
    
Your guest will not get updates, if there is no access to the world. For a complete configuration you have to enable shared Internet access. This enables routing and masquerading for your guest. –  ceving Sep 5 '11 at 9:53

2 Answers 2

The manual explains how to do it. You have to create a host-only interface. It can be done with VBoxManage hostonlyif. You can check the current configuration with VBoxManage list hostonlyifs. This is a typical output:

Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
Dhcp:            Disabled
IPAddress:       192.168.56.254
NetworkMask:     255.255.255.0
IPV6Address:     fe80:0000:0000:0000:0800:27ff:fe00:0000
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

Name:            vboxnet1
GUID:            786f6276-656e-4174-8000-0a0027000001
Dhcp:            Disabled
IPAddress:       192.168.13.254
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:01
MediumType:      Ethernet
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet1

share|improve this answer

You can add a second (or replace the existing) NIC to the guest with a "Host-Only" as the networking type. The "Host-Only" NIC will also contain a DHCP server for the guest.

You can then access the guest VM from the host via the assigned IP address (you check the assigned IP for the guest via "ifconfig").

share|improve this answer

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.