Host only network Win 7 Host, Ubuntu 9.1 guest

Discussions about using Linux guests in VirtualBox.
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

I know there are lots of threads and tutorials around on how to configure this sort of netwrok connection between host and guest. But for some reason I can't get it to work. It would be great if someone was able to help.

I set up virtual box about 6 months ago on an old install and had it working fine with no special steps... butthis time round, on a fairly fresh win 7 home premium machine, I cant get it to work.

I have installed Virtual box on the Win 7 machine.

I have created a new virtual machine and installed a fresh Ubuntu 9.1 server

I have carried out all available updates and upgrades

I have set up two network adapters for the ubuntu guest in the virtualbox gui
1 - NAT
2 - Host Only

The NAT is clearly working as the guest can access the internet for updates, and ping remote web servers

I cant connect from the host OS to the guest OS though. The guest OS is running LAMP and OpenSSH.

My network has a router with a DHCP server - giving my Host an IP 192.168.1.101

ifconfig on the guest gives

eth0 Link encap:Ethernet HWaddr ##mac-address##
inet addr:10.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
... etc......

lo Link encap:Local Loopback
ined addr:127.0.0.1 Mask:255.0.0.0
... etc..........


As a temporary soluton I have removed the NAT and Host Only adapter and set up a Bridged connection. This works straight away, taking an IP address from the router DHCP server so I can access the Guests LAMP / SSH server straight away on 192.168.1.106 from the host. I dont want to work with this long term though as the Host machine is a laptop and will be plugged in to many different networks. So I cant rely on my normal networks DHCP to assign the Guest its IP, and I also wont want the guest to be available to to the rest of the network if I can help it. I would much rather have a Host Only network for the guest.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

(1) adapter set to host-only
(2) adapter set to NAT
Check you Windows 7 firewall if this does not work. Also make sure that the host-only adapter got installed by looking at the properties of the network on the Windows 7 host and see if it has the VirtualBox host-only adapter. If not re-install VirtualBox select repair and when you see the options make sure all network drivers are selected.
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Thanks for the reply Perryg

I swapped around the network adapters to fit what you said, but now ifconfig shows only the lo and theres no eth0 at all. So no internet access anymore for the guest, and still no network between host and guest.

I've already disabled all virus and firewall stuff - thats the first port of call when I hit issues....

So now I've reinstalled Virtualbox and selected 'repair'. It doesnt give any chance to pick 'options' though - it just does it's thing. Now that it has finished there is no 'host only adapter available to be selected in the GUI settings >> network tab. The Name: field is empty.

Odd?

I'll wait a tick and then maybe completely uninstall it and start again. Not sure what's going on.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

Be sure to reboot after repairing or installing, but it sounds like you may need to uninstall and start over. Be sure to reboot after uninstalling and after installing. Windows needs this.
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by baf »

Show the output from ifconfig -a in the guest.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Thanks guys

I've restarted after every step, and now completely uninstalled and reinstalled virtualbox.

Having done that, I can't get any network access at all for the guest, or any communication between guest and host.

/etc/network/interfaces in the guest specifies a lo and an eth0

but ifconfig only lists a lo.

Not sure how I can copy the output of the ifconfig -a from the guest? It's server addition so no mouse, and I cant use cursers to select that text. Can I dump it to a file somehow?

it lists two interfaces - eth9 and lo. Firrt two lines of each are

eth9 Link encap:Ethernet HWaddr ##mac address##
BROADCAST MULTICAST MTU:1500 Metric:1

lo Link encap:Local loopback
inet addr:127.0.0.1 Mask:255.0.0

There is no IP info in the eth9 listing at all.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

delete /etc/udev/rules.d/70-persistent-net.rules and Linux will configure it on the next boot. There is no reason you should have eth9.
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Thanks. I've removed that file and rebooted.

ifconfig still only shows lo, and ifconfig -a shows eth11 eth12 and lo. lo is the only one with any ip info 127. etc

It has incremented I guess because in between troubleshooting steps I had tried to switch back to bridged, and then to try your suggestion I switched to NAT and Host-only again. Now sure why removing the file didnt clear it out though.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

Well something is not right. If you deleted the file I indicated it forces Ubuntu to re-read the network and you should not have eth9 through 11
From the host command window type VBoxManage showvminfo <VM Name> --details --machinereadable and post here. Replace <VM Name> with the actual name of the VM. Use "" if the name has a space in it.
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Thanks a lot for your help. Here you go:

Code: Select all

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Program Files\Sun\VirtualBox>VBoxManage showvminfo bwlocal --details --machin
ereadable
Sun VirtualBox Command Line Management Interface Version 3.1.4
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

name="bwlocal"
ostype="Ubuntu_64"
UUID="0d23fd41-88df-48fc-8c34-380fd6223161"
CfgFile="C:\Users\Me\.VirtualBox\Machines\bwlocal\bwlocal.xml"
hardwareuuid="0d23fd41-88df-48fc-8c34-380fd6223161"
memory=768
vram=64
cpus=1
synthcpu="off"
bootmenu="messageandmenu"
boot1="disk"
boot2="none"
boot3="none"
boot4="none"
acpi="on"
ioapic="off"
pae="on"
biossystemtimeoffset=0
hwvirtex="on"
hwvirtexexcl="off"
nestedpaging="on"
vtxvpid="on"
VMState="running"
VMStateChangeTime="2010-03-21T21:29:01.721000000"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
storagecontrollername0="IDE Controller"
storagecontrollertype0="PIIX4"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="2"
storagecontrollerportcount0="2"
storagecontrollername1="Floppy Controller"
storagecontrollertype1="I82078"
storagecontrollerinstance1="0"
storagecontrollermaxportcount1="1"
storagecontrollerportcount1="1"
"IDE Controller-0-0"="C:\Users\Me\.VirtualBox\HardDisks\Ubuntu.vdi"
"IDE Controller-ImageUUID-0-0"="b6f5b3b9-15d1-4aa4-b904-7052ac186d06"
"IDE Controller-0-1"="none"
"IDE Controller-1-0"="C:\PROGRA~1\Sun\VIRTUA~1\VBoxGuestAdditions.iso"
"IDE Controller-ImageUUID-1-0"="96d2d0cf-e8cd-4027-95db-6ad73baa26f0"
"IDE Controller-1-1"="none"
"Floppy Controller-0-0"="emptydrive"
"Floppy Controller-0-1"="none"
hostonlyadapter1="VirtualBox Host-Only Ethernet Adapter"
macaddress1="080027C23C1D"
cableconnected1="on"
nic1="hostonly"
natnet2=""
macaddress2="08002792AA9B"
cableconnected2="on"
nic2="nat"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
uart1="off"
uart2="off"
audio="dsound"
clipboard="bidirectional"
VideoMode="720,400,0"
vrdp="off"
usb="on"
VRDPActiveConnection="off"
VRDPClients=0
GuestStatisticsUpdateInterval=0
StatGuestSample=0


C:\Program Files\Sun\VirtualBox>
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

Code: Select all

hostonlyadapter1="VirtualBox Host-Only Ethernet Adapter"
macaddress1="080027C23C1D"
cableconnected1="on"
nic1="hostonly"
natnet2=""
macaddress2="08002792AA9B"
cableconnected2="on"
nic2="nat"
OK this says that you do in fact have (2) adapters. nic1 = hostonly and nic2=nat. and both have cableconnected=on Perfect!
Now the problem must be in the guest. Make sure that you deleted the right file. Edit the /etc/udev/rules.d/70-persistent-net.rules and see if it has all of these defined ethX in it. If so back out and delete the file. Then reboot. Look at it again and see if they are gone or if you have just (2)
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Ok - Ive been through that proceedure again of removing the file and rebooting, and it now only has two entries.

ifconfig -a lists three interfaces. I presume the first one is eth0 although i cant see it as it is off the top of the command line window, and the two I can see are eth1 and lo.

So that seems to have worked.

In terms of connectivity though theres still nothing. I can't ping the web from the guest and I cant see any ip's other than the loopback in ifconfig -a. Cant see the top two lines though cause of the window size...
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by baf »

try

Code: Select all

ifconfig -a |less
use up and down arrow to navigate q to quit
and show us how this looks now.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by Perryg »

You should have one that says something like 192.168.56.X which would be the hostonly
And one that says 10.0.2.0 which would be the NAT.
From what you are saying the guest does see these adapters now but it does show that the adapter is active or you would not have any at all.
Lets try this first. Make sure that the Windows host firewall is shut off. (shut down the guest first) and then start the guest and see if it gets the address.
cr0wn3r
Posts: 24
Joined: 7. Sep 2009, 15:52
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu 9

Re: Host only network Win 7 Host, Ubuntu 9.1 guest

Post by cr0wn3r »

Thanks - ifconfig -a does list three, and the first one is eth0

eth0 now has an IP - 192.168.56.101, Bcast 192.168.56.255 Mask 255.255.255.0

eth1 still doesnt. It lists its mac and then Rx Tx stats, but no IP

lo is there as before with inet addr:127.0.0.1 Mask:255.0.0.0

What should the Main GUI settings >> network tab be set to?

In the box titled "host-only networks" it has one entry: VirtualBox Host-Only Ethernet Adapter net...

If I click to edit it, I get

Adapter tab
>> IPv4 Address: 192.168.56.101
>> IPv4 Network Mask: 255.255.0.0
DHCP Server tab
>> Enable server [tick]
>> Server address: 192.168.56.100
>> Server mask: 255.255.255.0
>> Lower 192.168.56.101
>> Upper: 192.168.56.254
Post Reply