Page 1 of 1
Sharing guest's (XP) internet connection with host (OS X)
Posted: 8. Jul 2013, 14:40
by mchangstein
Hi all,
I have an internet connection that can only be used on Windows operating systems (our school requires that we install an .exe login client to connect to the dorm internet). As I am currently using a Mac, my goal is to get the internet running in XP in a virtual machine, and then share the virtual machine's internet with the host. Here's what I've done so far (I'm pretty new to all this, so sorry if I leave out anything important!):
1) Installed VirtualBox, created a new XP virtual machine
2) Add a Bridged Adaptor NIC to the guest allowing it access to the ethernet port
With this, I can use the internet fine in the guest, but have no internet in the host. (Note: Making the NIC NAT does not work. When set to NAT, the login client in XP can't find the school's server and I can't use the internet). The next step is getting the guest to share it's internet with the host. Here's what I've tried:
3) Add a second Host-only Adaptor NIC to the guest specifying the following:
IP: 192.168.22.2
Network Mask: 225.225.225.0
DHCP Server unclicked (disabled)
4) In the guest, enable Internet Connection Sharing for the internet connection.
At this point, LAN 2 in the guest (the connection to the host, I think) gets automatically configured with an IP of 192.168.22.1 and same mask as above. Back in the host, I can ping 192.168.22.1 and get a response. But no internet.
I feel like I'm missing a step, namely how do I instruct the OS X host to use the Host-only connection as its internet connection? I can see the connection ("vboxnet0") when I use ifconfig in the terminal but I have no idea how to use the connection for internet. Anyone know how I can do this?
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 15:12
by mpack
This isn't really a VirtualBox question. If you network host and guest together using (say) bridged or host only networking, then you are in the same position as a person who has a physical Windows PC next to a Mac. You should search online for network configuration tips concentrating on the latter scenario.
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 15:30
by mchangstein
mpack wrote:This isn't really a VirtualBox question. If you network host and guest together using (say) bridged or host only networking, then you are in the same position as a person who has a physical Windows PC next to a Mac. You should search online for network configuration tips concentrating on the latter scenario.
Hi mpack, thanks for the quick reply.
The difference I guess is if the PC were plugged into my Mac with an ethernet cable I could configure the internet connection settings through the "Ethernet Connection" in the Mac's Network Settings panel. The connection through VirtualBox doesn't show up in Network Settings (as far as I can tell), so I don't know where I should go to adjust those settings. Is there any way to make that "vboxnet0" show up in Network Settings?
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 15:34
by mpack
I don't use a Mac, but on a Windows host the "VirtualBox Host-Only" adapter shows up the hosts network settings. If bridged mode is selected then both the host and the VM talk directly to the local router, and in that case the Mac has no business controlling the network settings of a network peer! To make two PCs "see" each other they would both have be on the same physical network (done), and both configured to be part of the same domain or workgroup. Of course one of your PCs is actually a Mac, so like I said you should search online for how to network those two together, and I'm sure it will include such tips as how to share an external (internet) connection.
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 16:45
by mchangstein
mpack wrote:I don't use a Mac, but on a Windows host the "VirtualBox Host-Only" adapter shows up the hosts network settings. If bridged mode is selected then both the host and the VM talk directly to the local router, and in that case the Mac has no business controlling the network settings of a network peer! To make two PCs "see" each other they would both have be on the same physical network (done), and both configured to be part of the same domain or workgroup. Of course one of your PCs is actually a Mac, so like I said you should search online for how to network those two together, and I'm sure it will include such tips as how to share an external (internet) connection.
For reference, here is an earlier topic I was using as a guide:
viewtopic.php?f=8&t=34623 .
Unfortunately, Sasquatch lost me in his explanation at:
"That is everything you can configure there, but your Host needs a gateway too, and that will be 192.168.0.1. DNS servers can be whatever the Host gets, but you can also use the OpenDNS servers."
and this:
"It's a bit of a shame that it can't be set on the Host side to use DHCP, but you can do that manually. Using the DHCP option means that the above steps to set a static IP are not needed, they will be overwritten by DHCP. You have to run the dhcp client from a terminal in order to get the complete configuration for use on the Host."
How do I configure the host's gateway and DNS settings? How/when do I run the dhcp client?
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 17:24
by mpack
Sasquatch obviously had a particular solution in mind, though I don't believe it's the only one. In my mind both guest and host must have physical access to the external connection, else how does the guest have it?
Still, what is it that you don't understand? Do you know what a gateway is, and a DNS?
... and please try to keep this brief. I'm uncomfortable about getting dragged into a discussion about networking configuration, (a) because I'm not a networking expert, and (b) because that would be off topic in these forums.
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 18:11
by mchangstein
I don't understand where/how on the Mac I am supposed to set the gateway and DNS settings for the "vboxnet0" connection. Also, I don't know how to get the Mac to use the "vboxnet0" connection as its default connection as opposed to sending internet requests through the ethernet cable ("en0").
Honestly, I don't know enough about this stuff to tell whether it's a problem with the Host-only adaptor I added in VB or a problem with my network settings on the Mac. I don't want to waste your time on off-topic discussions either. Maybe we can just wait and see if anyone using VirtualBox on a Mac host has done anything similar and can offer any experience?
Thanks again for your help

Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 8. Jul 2013, 19:29
by loukingjr
Since I know nothing about networking I can't help there but is there any chance the login client you have to use will run in Wine? There is a version of Wine for Macs. Btw, since I assume you have to pay for school, and I find it hard to believe there aren't more Mac users there, perhaps someone should get the school to develop a login client for Macs.
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 9. Jul 2013, 05:07
by mchangstein
Wine was the first thing I tried, couldn't get the .exe to run unfortunately. As for the school, I'm in China, and they just don't care...
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 9. Jul 2013, 11:23
by mpack
mchangstein wrote:I don't understand where/how on the Mac I am supposed to set the gateway and DNS settings for the "vboxnet0" connection. Also, I don't know how to get the Mac to use the "vboxnet0" connection as its default connection as opposed to sending internet requests through the ethernet cable ("en0").
As I said earlier, I don't use Macs and I'm no networking expert, however I would go with what Sasquatch suggested: assign a fixed IP to the VM. Make sure host and guest are on the same subnet, make sure the VM's IP address is selected as your gateway. Configure a DNS server address too - using one of the OpenDNS ones as suggested makes sense, ideally a local one.
After that, the interface should work if used. If the question is then how to get a Mac to start using that interface - pass.
Re: Sharing guest's (XP) internet connection with host (OS X
Posted: 9. Jul 2013, 23:56
by noteirak
To be honest, this really has nothing to do with Virtualbox... This is all about networking which is out of scope here.
On a side note, to be able to perform the connection sharing with your hardware, you must use Bridged + Host-Only at some point. The final design would look like this :
Code: Select all
[ Host ] ------ Host-Only ------ [ VM ] -------- Bridged -------- [ The world ]
How you achieve this is purely based on networking knowledge...