Page 1 of 1
allow guest to access internet and host to access guest
Posted: 6. Aug 2011, 22:54
by ashish
How can I enable both of the following features at the same time:
- guest should be able to access the internet
- host should be able to access the guest
I tried this by enabling two network adapters, setting one to use NAT and the other to use Host-only, but it does not work. I can get each feature to work independently by setting an adapter to either NAT or Host-only, but I cannot get both to work at the same time. Is my approach of enabling 2 adapters even the correct thing to try? Or should I be able to do this with a single adapter?
Re: allow guest to access internet and host to access guest
Posted: 7. Aug 2011, 03:16
by Sophira
The easiest way to do that is by setting the virtual machine to use bridged networking. That'll cause it to appear as another machine on the same network you're on, and other computers on the same network will also be able to access it directly.
If you don't want to do that, then there are basically two options:
- If you only want access to a few ports on the VM, then you can use NAT and set up port forwarding. Unfortunately I don't believe there's any GUI for this yet, so you have to use the VBoxManage command. Bear in mind too that unless you specifically specify to use the loopback interface (127.0.0.1) as in the fourth example command on that page, you'll still be allowing other computers to access the port, and thereby the VM.
- If you need full access, then you can set it up as Host-Only and configure the host itself to do NAT, with the VirtualBox interface as the LAN and your real network as the WAN. I'm not sure how to do this in Windows, but in Linux you can do this using iptables.
It would be nice to be able to have host-only mode with an optional NAT interface implemented by VirtualBox itself. Unfortunately, that's not available. :/
[edit: Sorry, just noticed that you tried two network adapters; that configuration should have worked. You might want to check the metric of the NAT interface in the guest operating system to make sure it's higher than the other one, otherwise it might attempt to route the Internet traffic through the wrong adapter.]
Re: allow guest to access internet and host to access guest
Posted: 7. Aug 2011, 11:30
by ChipMcK
Re: allow guest to access internet and host to access guest
Posted: 10. Aug 2011, 19:54
by ashish
Thanks for the replies. I've got it working using 2 network adapters. My original problem was due to misconfiguration of the guest's network interfaces. But I'll also try the Bridged option, which seems like a cleaner solution. I avoided that because the user manual says bridged networking is for advanced networking needs, but I was trying to accomplish something basic.