Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a host machine which is connected to the internet via a usb 3g dongle and is not attached to a network. Basically from the client I want to be able to ssh into the client from the host and I also want the client to have internet access.

When I use a host only adapter the host can ping the client, but the client can't access the internet. When I use NAT I can access the internet but the host can't ping the client. I have also tried setting up two adaptors NAT and host only, but it just seems as if adaptor 1 overrides adaptor 2.

Could suggest a solution?



share|improve this question
Belongs on superuser. – Gleb Oct 5 '09 at 14:45

When you create a host network in VirtualBox it is just like you have a separatly networked machine set up on your local computer. This means it has it's own IP - and you can connect to it, but it also means that it is not able to access the internet unless it has some sort of gateway to it. The NAT mechanism on your host machine automatically translates this traffic.

The gateway in this case would be your host PC. You would need to set up a router to route the traffic from the VM to the internet. In Windows this would be "Internet Connection Sharing" but you did not mention what OS you are using, so it depends on this.

share|improve this answer
Thanks for the reply. Host = ubuntu 9.04, client = ubuntu server 9.04 – ChrisInCambo Oct 5 '09 at 13:18

You need to port forward port 22 on the VirtualBox NAT to 22 on the Guest machine.

On your Host machine run:

$ VBoxManage setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0 \
/Config/ssh/HostPort" 2222

$ VBoxManage setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0 \
/Config//ssh/GuestPort" 22

$ VBoxManage setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0 \ 
/Config/ssh/Protocol" TCP

Before running those commands, replace the following with your personal settings:

  • Replace "name of vm" with your virtual machine
  • Replace ssh with the preferred name you want. This is required to be unique among the three commands.
  • Replace 2222, 22, TCP respectively with your desired host port, guest port, and protocol.


share|improve this answer

Your Answer


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.