Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet connection in Virtualbox won't work (Mac OS X host / Windows XP guest)

I have been trying (and failing) to set up any kind of internet connection for my Windows XP virtual machine and would appreciate some assistance.

Details are as follows:

Virtualbox 4.3.0

Mac OS 10.6.8 host

Windows XP SP 2 guest

My internet connection is via Airport, with the IP address of the host being 192.168.1.2 (dynamically assigned by the router) and the router 192.168.1.1.

I think the problem I'm having is either not knowing which settings I'm supposed to be changing or what configuration I need. Is Windows XP supposed to retrieve its settings from an in-built DHCP server in Virtualbox or do I need to manually specify the IP address and gateway? If so, how do I know which addresses I'm supposed to be using?

In the Virtualbox preferences I also tried adding a host-only network and switching on the DHCP server, but when I ping any of the IP addresses used in the default configuration I just got either a "request timed out" or "destination unreachable" message.

As a last resort I tried installing the guest additions but this stopped Windows from even being able to boot so that doesn't seem to be an option either.

Taking all those points into account and trying not to complicate things, I thought I'd start over from the beginning again and the easiest option seemingly was to set-up a bridged adaptor connection and then (in Windows XP) manually specify the same IP addresses that the host has been assigned. But this didn't work either - the guest was unable to ping the router and the host got automatically assigned a different IP address after a Finder alert appeared saying that another computer on the network was already using the same IP address.

Thanks for any assistance!

like image 844
Noel Whitemore Avatar asked Jan 17 '14 12:01

Noel Whitemore


People also ask

How do I connect my Windows XP to the Internet using VirtualBox?

Start > Control panel > Network connections > Create a new connection . In the wizard, select Connect to the internet and then choose the option which requires no username or password (or ISP).

Why is VirtualBox not connecting to Internet?

Start VirtualBox if not running. Click on Settings and select Network Settings. Check the Allow internet sharing option in the host machine adapter. Try to access the Internet and check if the Wi-Fi is working.


2 Answers

Choose "Bridged Adapter" and "PCnet-FAST III" in Network Settings.

Name en1: Wi-Fi (AirPort)

Worked for me, too. "PCnet-FAST III" is in the advanced options and can only be selected, when the machine is not running (but selected) via the 'Machine' > 'Settings' Menu option
Virtualbox 5.0.38

Would have put this in the comments, but as i just registered I don't have enough reputation points to do so.

like image 69
kai233 Avatar answered Oct 20 '22 06:10

kai233


This issue is essentially due to a the allocation of the same IP addresses to both the Host WiFi adapter (by the wifi router's DHCP server) and the Guest interface (by the VirtualBox DHCP server under Nat networking).

From the VirtualBox documentation about the integrated DHCP server Fine-tuning the VirtualBox NAT engine:

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24
by default where x corresponds to the instance of the NAT interface +2. So x is 2
when there is only one NAT instance active. In that case the guest is assigned to the 
address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at
10.0.2.3.

Looking at your host's WiFi adapter's IP address you will find that the address assigned to it is from the 10.0.2.0/24 network range as well.

This is the reason for the issue as now the Nat driver for VirtualBox is confused by the fact that the host and guest addresses are from the same subnet.

To fix this you can change the subnet served out by the VirtualBox DHCP server using the VBoxManage command(while the VM is powered down):

VBoxManage modifyvm VMName --natnet1 "192.168/16"

And you're good to go.

like image 33
Samveen Avatar answered Oct 20 '22 06:10

Samveen