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?
Regards,
Chris
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.
You need to port forward port 22 on the VirtualBox NAT to 22 on the Guest machine.
On your Host machine run:
Before running those commands, replace the following with your personal settings:
From http://sk.c-wd.net/wp/2008/01/05/virtualbox-port-forwarding-with-linux-host/