Page 1 of 1

[SOLVED] Host-only network, Gateway-IP changes

Posted: 17. Jun 2013, 05:21
by bdutta
Problem summary:
While I am not 100% sure that this might have caused / triggered the problem, but I think on disabling/enabling the VirtualBox Host-Only Ethernet Adapter via Network and Sharing Center -> Change adapter settings, somehow changed the IPv4 address assigned to this interface, from what it was set to initially, post installation and post setting up for the 1st host-only guest configuration. As a result, a previously working configuration where I could use Putty to connect to guest over SSH, stopped working.

Host info:
VirtualBox VM 4.2.12 r84980 win.amd64 (Apr 12 2013 11:35:06) release log
00:00:07.405605 Log opened 2013-06-16T18:00:01.702095400Z
00:00:07.405620 OS Product: Windows 7
00:00:07.405624 OS Release: 6.1.7601
00:00:07.405626 OS Service Pack: 1
00:00:07.405640 Host RAM: 3887MB total, 2159MB available
00:00:07.405646 Executable: C:\Program Files\Oracle\VirtualBox\VirtualBox.exe
00:00:07.405647 Process ID: 5124
00:00:07.405648 Package type: WINDOWS_64BITS_GENERIC
00:00:07.436457 Installed Extension Packs:
00:00:07.436571 None installed!

On host, I see:

Code: Select all

C:\Users\dutta>ipconfig /all

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 08-00-27-00-58-FB
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::a173:5cdc:9d6e:ec0d%809(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.200(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, June 17, 2013 8:12:45 AM
   Lease Expires . . . . . . . . . . : Monday, June 17, 2013 9:12:44 AM
   Default Gateway . . . . . . . . . :
   DHCP Server . . . . . . . . . . . : 192.168.56.1
   DHCPv6 IAID . . . . . . . . . . . : -83361753
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-BD-2B-99-68-B5-99-F6-C0-2D
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled
Guest info:
OS = Redhat Enterprise Linux release-5.8 64-bit.

Code: Select all

# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=occp110
GATEWAY=192.168.56.200
NOZEROCONF=yes
IPV6_AUTOCONF=no
Had to change the GATEWAY configuration (from previous value) to 192.168.56.200 above in /etc/sysconfig/network file, to get the setup to work again. Based on that, my analysis so far, hints at the fact that the Virtualbox Host-interface on the host side, is assigned address by DHCP, which in some corner cases, could change (such as enable/disable of interface, done manually), thus the 'GATEWAY' configuration in guestOS, no longer holds true. Is this correct ?

Can I avoid repeating this situation, by manually assigning a static IP for the VirtualBox Host-Only Ethernet Adapter via Network and Sharing Center -> Change adapter settings via Properties -> Networking tab -> IPv4 address settings ?

Attached the zipped VBox.log file.

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 12:50
by noteirak
The Host-Only interface on the host must have a static IP assigned, or you'll run into troubles, like you just did.

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 14:00
by Perryg
By default the VirtualBox host-only network is not supposed to have a gateway.
It is not meant to be able to access the Internet or any router.

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 17:12
by bdutta
noteirak wrote:The Host-Only interface on the host must have a static IP assigned, or you'll run into troubles, like you just did.
Thanks @noteirak. Is this fact documented anywhere ? Don't remember seeing anything like that in the user doc.
Also, this is how the default configuration was (i.e. dynamic IP for that interface). Anyhow, will set static up there.

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 17:43
by bdutta
Perryg wrote:By default the VirtualBox host-only network is not supposed to have a gateway.
It is not meant to be able to access the Internet or any router.
Well, isn't the Gateway required if you wanted to talk to other VM's which might not share the same subnet, as this VM (and not just for going out to public-internet) ?

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 17:50
by Perryg
Nope. Not if they are on the same subnet. Think network switch.
Adding the gateway is a sure fire way to loose the network since it will look for one and can't find it.

Re: Host-only network, Gateway-IP changes on enable/disable

Posted: 17. Jun 2013, 20:17
by bdutta
Perryg wrote:Nope. Not if they are on the same subnet. Think network switch.
Adding the gateway is a sure fire way to loose the network since it will look for one and can't find it.
Ah... but my requirement is indeed to have communication between 2 VMs on 2 different subnets. So, I do need a gateway as I thought.

Re: [SOLVED] Host-only network, Gateway-IP changes

Posted: 17. Jun 2013, 20:36
by Perryg
No, you need to use Bridged and a router.

Re: [SOLVED] Host-only network, Gateway-IP changes

Posted: 17. Jun 2013, 20:54
by noteirak
When you give a gateway, you tell the OS to look for another device that *should* route the packets. But unless you actually have configure that other device, nothing will happen. And by default, regular computers are not configured as such.
So yes, you'll run into troubles.

As for the documentation, this is basic networking stuff. Don't forget Virtualbox is a hardware simulator. And the Host-Only is exactly that : a simulated switch device. Nothing more.