19
votes

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!

11
Bridged adapter works for me just fine. Both host and guest are using DHCP, both get distinct IP addresses, both can connect to the router (i.e. to Internet) and to each other. Try configuring it that way. Say A is router, B is host, C is guest. B and C are using DHCP. C configured with bridged adapter. Then try pinging: A -> B, B -> A, A -> C, C -> A, B -> C, C -> A. What you see?akhikhl
Thanks for replying. If I set the Virtualbox connection to bridged adaptor and then set the TCP/IP connection in Windows XP to "Obtain an IP Address automatically" nothing seems to happen - the output from ipconfig shows that the guest is using a self-assigned IP address and does not have an IP address set for the gateway (router?).Noel Whitemore
For the benefit of anyone else that's having this problem, the solution that worked for me in the end was simply to switch to VMware Fusion - no issues whatsoever and it all worked first time with no configuration needed. In fairness to VirtualBox, some aspects of the software work very well, the performance is generally very good and for some people it works out-of-the-box just fine, but not being able to get the internet connection working was for me a real non-starter.Noel Whitemore
Experiencing this issue on OS X Mojave, I have an Airport Extreme. My PC running a Vbox VM works fine (no internet issues). Though nothing works on my MacBookPro, I’ve tried both Vbox and VMware Fusion. For debugging purposes I decided to use my phone as a hotspot and connect my MBP to it... funny enough I the virtual machine can now connect to the internet. Which brings up the questions: Is the problem the Airport Extremem or the MacBookPro...?Sakiboy
@Sakiboy Your MBP is likely to be a lot newer than mine, but my guess is that there's still some underlying incompatibility/bug in Apple's Airport drivers when it's trying to manage a "bridged" connection from a software application. I never found a way to get Virtual Box working but VMware Fusion works fine for me with my current setup, although I've noticed with Vista that the connection sometimes doesn't work if the VM has been suspended. The fix is to open IE9 and load any site (?) and that somehow makes the connection accessible to any other Vista software that needs it.Noel Whitemore

11 Answers

16
votes

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.

10
votes

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.

7
votes

Chose Bridged Adapter and PCnet-FAST III in Network Settings.

5
votes

I tried all of this but it did not work for me, instead I tried to shutdown vb mac and go to the settings in the "Network" part and enable all "Adapters" like in the screenshots. It works for me.

Tab 1:

enter image description here

Tab 2:

enter image description here

Tab 3:

enter image description here

Tab 4:

enter image description here

4
votes

I have to choose following to make it works.

My settings:

  1. MacOS Majave, 10.14.3;
    2) Virtual Box, VirtualBox VM 6.0.8 r130520 darwin.amd64 (May 13 2019 15:40:24) release;
    3) Ubuntu 16.04 LTS, 64 bit.

I choose "NAT" and "PCnet Fast III" and it worked now.

Thanks for other suggestions here.

3
votes

I know this is more than likely not the issue with most, but after many hours of trying to fix my internet connection from a Mac Air host to an Virtual Box XP guest I finally went into my network settings in XP and realized that the network was disabled. Hopefully most are smart enough to look here first, but I wasn't. Again the law of parsimony proves true. Hope this helps some other poor dumb bastard.

2
votes

MacBook Pro - Mojave:

Network settings - NAT

Go to advanced settings and click on Advanced.

Click on port forwarding and click on add a connection. Enter 0 in the first PORT box and 1 in the second port box. Leave the IP addresses blank.

Click apply.

Make sure the "Cable Connected" box is checked. Worked for me with no other issues. All of the suggestions above did not resolve the problem on my MacBook Pro.

Hope this helps someone....

1
votes

OS X El Capitan (10.11.6) and VirtualBox 5.1.30

For me it was just changing the Adapter Type to PCnet-FAST III:

Attached to: NAT
Name: -
Adapter Type: PCnet-FAST III (Am79C973)
Promiscuous Mode: Deny
1
votes

In case anyone had the same problem, here is my case:

Settings:

  1. macOs Mojave 10.14.6
  2. VirtualBox Version 6.0.12 r133076 (Qt5.6.3)
  3. ISO: CentOS Linux release 7.7.1908 (Core)

I tried NAT,Bridged Adapter and other adapters,they just won't work. When i typed "ip addr",the result looks like this, there's no ipv4 address assigned to the enp0s3 interface.

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 08:00:27:43:59:bf brd ff:ff:ff:ff:ff:ff

So i guess maybe there's something wrong with the network interface config, which is not that obvious when you are not familiar with linux. We can check specified network interface config through following command.

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=0b1aa850-85ba-478d-8efb-94f3c16d47e1
DEVICE=enp0s3
ONBOOT=no

The ONBOOT field is set to no,which indicates the network interface is not activated.We can start the enp0s3 interface by following command.

[root@localhost ~]# ifup enp0s3

The Internet is back on. ^_^

0
votes

What ended up working for me on OS X El Capitan with a Windows 7 VirtualBox was the following settings:

Attached to: Bridged Adapter
Name: en0: Wi-Fi (AirPort)
Adapter Type: Intel PRO/1000 MT Desktop (82540EM)
Promiscuous Mode: Allow All
0
votes

Had the same issue, used Bridged adaptor & Wifi Airport, Installed generic ethernet card drivers off internet, reboot and boom found it. Works.