Successful network bridge between XP host and Ubuntu guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
strangeelement
Posts: 21
Joined: 21. Oct 2008, 18:20
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Ubuntu 9.10

Successful network bridge between XP host and Ubuntu guest

Post by strangeelement »

I have been torturing myself all day trying to successfully set up a bridged network connection between a Windows XP host and an Ubuntu 9.04 guest on VirtualBox 3.0.4 that is itself capable of accessing the Internet without using a router. Since it seems to be a headache for many, I thought I would share. The Bridged adapter is supposed to achieve this, but it has not worked for me (and many it seems) without a router.

The goal:

I use Windows XP as a primary OS. I'm a Web developer and use a LAMP server for my development. Both OSes need to talk to each other, i.e. my Windows host needs to connect to the LAMP server for Samba, to access my source files, and an HTTP connection, to test on a browser. I also need to ssh the guest, but that is implicit in achieving the previous two.

Additionnally, the Ubuntu guest needs an Internet connection, primarily to commit my work to my main server and for the inevitable download when developing.

Normally this is easy to achieve using a router. But I lent it today for about two weeks and needed to change my configuration accordingly. As a side note, the network configuration is essentially the same for a router setup, except that the router's IP address is used as gateway instead of the shared connection LAN adapter.

The guest:
  • Ubuntu 9.04 Server
  • Static IP address (so I don't have to change my hosts file at every DHCP update)
The host:
  • Windows XP
  • Running VirtualBox 3.0.4
  • Virtual machine's network configured using Host-only adapter
  • Local Area Connection, Firewalled and Shared
The trick lies in the fact that sharing the connection on the Windows host creates a network adapter with address 192.168.0.1 on the local network.

The Ubuntu guest network configuration is:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.50 # Arbitrary static IP
netmask 255.255.255.0
gateway 192.168.0.1

At this point, the Windows host should be able to communicate with the Ubuntu guest, which should have a working Internet connection. Even without sharing the connection, the host should have been able to connect to the guest. But the guest would not be able to access the host and would not have Internet access.

There is a final piece of this, hardly necessary but which opened the way for the solution. Even with this configuration, the guest is not able to communicate with the host. This is not so much an issue since the guest is still able to connect to the outside world. But I was stuck at the fact that how can the guest access the Internet without being able to even ping the host? It turned out the problem lies in the Windows firewall, which blocked incoming connections from the VirtualBox Host-Only Network adapter.

The solution for this, if you ever need your Linux/Ubuntu guest to access your Windows host, is to disable the Windows firewall on the VirtualBox Host-Only Network adapter: Network Connections -> VirtualBox Host-Only Network -> Properties -> Advanced -> Windows Firewall -> Settings... -> Advanced -> Uncheck the "VirtualBox Host-Only Network adapter". Actually this can be done by going through the properties of any of the adapters. This way the Firewall remains active on the Internet connection, always a good idea when not using a router.

If anything is not clear and you're still stuck with this problem, please tell so as I would like this post to help the help the numerous people I have seen in forums trying to find a solution for this.
recursivelyConfused
Posts: 5
Joined: 4. Sep 2009, 22:39
Primary OS: MS Windows XP
VBox Version: OSE Debian
Guest OSses: Ubuntu 8.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by recursivelyConfused »

Thank you for the post. This sounds like the solution I have been looking for.

However, I use a work laptop and do not want to make changes to my Local Area Connection that would disconnect me from the company network. If I turn on internet connection sharing, Windows warns me that I will be disconnected from my current network when the IP changes to 192.168.0.1. This is where I get confused, because my connection to the company network provides my internet connection. What will happen if I do this?
strangeelement
Posts: 21
Joined: 21. Oct 2008, 18:20
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Ubuntu 9.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by strangeelement »

I don't think it would be a problem. I think when sharing a connection, Windows shows the sharing PC as 192.168.0.1 to the computers that receive connection from it but retains it's network identity, either from a local network router or switch or from the ISP. If I do ipconfig I still see my real IP from my ISP.

If it's work-related maybe a sysadmin could help on this. They generally tend not to be busy (though pretend otherwise) ;)
presumedhuman
Posts: 5
Joined: 11. Sep 2009, 16:51
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: fedora 11

Re: Successful network bridge between XP host and Ubuntu guest

Post by presumedhuman »

Thanks for the info.

Host: Windows XP SP3
Guest: Fedora 11 (i386 & x86_64)
VB: 3.0.4

I noticed that it only works if the Host-Only adapter is the first (#1) adapter of the 4 available adapters for each virtual machine configuration.
I had my 64-bit machine using adapter #2 without success (ifconfig showed no IP assigned) - changed the Host-Only adapter to #1 and had success.
Thanks.
-
ph
recursivelyConfused
Posts: 5
Joined: 4. Sep 2009, 22:39
Primary OS: MS Windows XP
VBox Version: OSE Debian
Guest OSses: Ubuntu 8.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by recursivelyConfused »

Didn't contact a sys admin, I'm new at work and don't know how to track those guys down. So I tried this out myself, but the internet connection is still not working on my guest Ubuntu 8.10. I can ping the guest from the host. I can also ping the host from the guest. I am also not confident that my work network is the same situation your solution is for. I know that everyone here at work gets a static IP. Maybe a NAT solution is what I need? I dunno, NAT hasn't worked so far. Here is where I'm at:

Host:
Win XP Pro
Local Area Connection is Shared
VirtualBox Host-only Network adapter has got the 192.168.0.1 IP address
VirtualBox 3.0.4 Adapter 1: VirtualBox Host-only adapter
I also tried to disable the firewall for VirtualBox Host only adapter, but I was not able to. The check boxes were not able to be edited. If I selected the VirtualBox Host only adpater I could click settings and see some exceptions which included DNS, HTTP, and others.

Guest:
Ubuntu 8.1
#auto eth1
static IP 192.168.0.50 (The host can ping this address and I can ping the host from the guest)
gateway 192.168.0.1
Netmask 24 (I try to manually put in 255.255.255.0, but it always reverts back to the value 24)

#auto lo
local loopback
127.0.0.1

Any ideas? What should my next steps be? I'm stumped right now, but I'll let you know if I figure it out.
strangeelement
Posts: 21
Joined: 21. Oct 2008, 18:20
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Ubuntu 9.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by strangeelement »

Well for a successful setup the VirtualBox adapter should not have IP 192.168.0.1. Enabling sharing on the LAN connection is supposed to attribute this address on the connection, after which you can use 192.168.0.1 as gateway.

Sometimes attributing the internal IP on the LAN connection does not work right away. I think de-selecting and re-selecting Share this connection in the LAN adapter properties should do it. The goal is for an alert box to display after clicking OK on the adapter properties to warn that it has to attribute an internal network IF of 192.168.0.1 to the adapter. You can then change the IP of the VirtualBox adapter to something else. I got my router back since then so I returned to Bridged mode, which works fine with a router, so I'm not sure, but I think the IP of the VirtualBox needs to be different from the assigned IP on the guest (/etc/networking/interfaces).
recursivelyConfused
Posts: 5
Joined: 4. Sep 2009, 22:39
Primary OS: MS Windows XP
VBox Version: OSE Debian
Guest OSses: Ubuntu 8.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by recursivelyConfused »

Ya. Every time I share the Local Area Connection I have to select a private network that I am sharing with. So I select virtualbox host-only network because the only other option is my WLAN. I click OK and am warned that my LAN adapter will be set to use 192.168.0.1. fine. But this changes the virtualbox host-only adapter to 192.168.0.1, not my Local Area Connection. I am starting to think this is different behavior than what you encountered. Do you have to select a private network to share with when sharing your internet connection? If I am just misinterpreting your instructions, I would appreciate it if you clarified for me. Thanks.

My VirtualBox 3.0.4 Adapter 1 is set to:
VirtualBox Host-only adapter

The Ubuntu guest network configuration is same as yours:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.50 # Arbitrary static IP
netmask 255.255.255.0
gateway 192.168.0.1
strangeelement
Posts: 21
Joined: 21. Oct 2008, 18:20
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Ubuntu 9.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by strangeelement »

Hum I did not have to select a private network to share with so I'm not sure what would be the proper configuration. Maybe it has to be shared with the WLAN network... Or maybe disabling the WLAN network...

Sharing the LAN connection changed the IP for the LAN adapter only on my PC. The only different setting with the VirtualBox host-only adapter would be to assign it a different IP.

The VirtualBox and interfaces configuration are correct.
recursivelyConfused
Posts: 5
Joined: 4. Sep 2009, 22:39
Primary OS: MS Windows XP
VBox Version: OSE Debian
Guest OSses: Ubuntu 8.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by recursivelyConfused »

Ok, so things are working (well... not working) a little different for me. I'll explain how my setup differed, for anyone else has this situation or knows how to resolve this.

I'll repeat the fact that I am on a work network using XP pro. When I share my local area connection I select the Virtualbox Host-only adapter as the shared network, which gives this host-only adapter the 192.168.0.1 address. Virtualbox is set to use the Virtualbox Host-only adapter, and I changed my Ubuntu guest configuration to static IP 192.168.0.50 and the 192.169.0.1 gateway as stated in above posts.

When I ping http://www.google.com I get nothing. But I get a little further if I put in a DNS address (which i got from my windows machine 'ipconfig /all'. Then go to Ubuntu guest and edit the auto Etho manually). With my DNS manually entered, my ping request resolves http://www.google.com to its IP address, but then times out.

This seems so close. How can I be resolving the google host name, but not able to open websites? My work's proxy settings? I'm gunna try this from my home network. Maybe it will work there.

Also, when I configure my VirtualBox adapter 1 to use NAT, I get the same timeouts. I resolve the host name to IP address, but timeout.
recursivelyConfused
Posts: 5
Joined: 4. Sep 2009, 22:39
Primary OS: MS Windows XP
VBox Version: OSE Debian
Guest OSses: Ubuntu 8.10

Re: Successful network bridge between XP host and Ubuntu guest

Post by recursivelyConfused »

I got my setup working now :) It turns out I was on the wrong track with sharing the internet connection.

I set my Virtualbox adapter1: NAT
Set the IP on the Ubuntu guest to be obtained automatically (default). It has the 10.0.2.15 address.
Set the System -> Preferences -> Network Proxy to my work proxy.
In my Ubuntu Firefox browser, set network preferences to use the System Network Proxy and... BAM. glorious Google.
Bit Hacker
Posts: 2
Joined: 5. Jun 2010, 09:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP

Motorola Clear usb x100 in WindowsXP guest

Post by Bit Hacker »

Awesome post, just what I've been looking for. I'm trying to use CLEAR Motorola WiMax USB in Ubuntu as there is no support for linux as yet. I've installed windowsxp as guest in ubuntu and the version I'm using is 3.2.2. USB is connecting fine in
WindowsXP but I can't use internet in Ubuntu. Can you please tell me how to do it. Here is the configuration that could help you guys. Thanks in advance.

I'm using Two Network Adapters.

Code: Select all

Network
Adapter 1:
PCnet-FAST III (NAT)
Adapter 2:
PCnet-FAST III (Host-only adapter, 'vboxnet0')
ipconfig [on Guest windowsXP]

Code: Select all

Windows IP Configuration
Ethernet adapter Local Area Connection:  PCnet-FAST III (NAT)

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 10.0.2.15
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.0.2.2

Ethernet adapter Local Area Connection 3: PCnet-FAST III (Host-only adapter, 'vboxnet0')

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.56.101
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :

Ethernet adapter Local Area Connection 2: 

        Connection-specific DNS Suffix  . : CLEAR Motorola USB
        IP Address. . . . . . . . . . . . : 10.168.242.33
        Subnet Mask . . . . . . . . . . . : 255.255.192.0
        Default Gateway . . . . . . . . . : 10.168.192.2
IFCONFIG [on Host Ubuntu]

Code: Select all

 (Ethernet) eth0      Link encap:Ethernet  HWaddr 00:14:22:b9:9d:76  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16 

eth1    (Wireless) Link encap:Ethernet  HWaddr 00:13:ce:f0:9b:0d  
          inet6 addr: fe80::213:ceff:fef0:9b0d/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:5 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:84 (84.0 B)
          Interrupt:17 Base address:0xe000 Memory:dfcff000-dfcfffff 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2292 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2292 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:171952 (171.9 KB)  TX bytes:171952 (171.9 KB)

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:21174 (21.1 KB)
bhanugangavarapu
Posts: 1
Joined: 30. Sep 2011, 14:38
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: UBUNTU

Re: Successful network bridge between XP host and Ubuntu gue

Post by bhanugangavarapu »

Hi,

I tried with "HOST-Only Adapter".

HOST (Local connection IP): 9.126.192.226 / 255.255.255.0 / 9.126.192.1
it has DNS server ip also.

HOST (Virtual Box Host-only adapter IP): 192.168.0.50 / 255.255.255.0 / 9.126.192.1

Guest details: UBUNTU latest version
In the configuration file i changed to:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.50 # Arbitrary static IP
netmask 255.255.255.0
gateway 192.168.0.1

and restarted the service.

but still i am not able to connect the IP from HOST to GUEST and vice versa ...
can you please let me know where i am doing wrong.
mschwartz
Posts: 92
Joined: 18. Oct 2010, 21:01
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: ubuntu

Re: Successful network bridge between XP host and Ubuntu gue

Post by mschwartz »

bhanugangavarapu wrote:Hi,

I tried with "HOST-Only Adapter".

HOST (Local connection IP): 9.126.192.226 / 255.255.255.0 / 9.126.192.1
it has DNS server ip also.

HOST (Virtual Box Host-only adapter IP): 192.168.0.50 / 255.255.255.0 / 9.126.192.1

Guest details: UBUNTU latest version
In the configuration file i changed to:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.50 # Arbitrary static IP
netmask 255.255.255.0
gateway 192.168.0.1

and restarted the service.

but still i am not able to connect the IP from HOST to GUEST and vice versa ...
can you please let me know where i am doing wrong.
See the link in my signature.
techonokios
Posts: 1
Joined: 9. Nov 2011, 19:41
Primary OS: MS Windows 7
VBox Version: OSE Debian
Guest OSses: Ubuntu 11.04 server

Re: Successful network bridge between XP host and Ubuntu gue

Post by techonokios »

Guys.. just don't set the gateway on the host-only adapter.

This will retain the default gateway obtained via DHCP on the first interface.

You don't need a Default Gateway for the host-only adapter since you'll only be accessing it directly from your host, which is on the same network. Default Gateway is only used for networks not directly connected to the device.

Example

Code: Select all

tcraig@llamasrus:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface <-- NAT interface for vbox (interface 1)
auto eth0
iface eth0 inet dhcp

auto eth1    <--- (host-only adaptor, interface 2)
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0
#gateway 192.168.56.1
See the routing table below:

Code: Select all


tcraig@llamasrus:~/projects$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.56.0    *               255.255.255.0   U     0      0        0 eth1
10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
Post Reply