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

Discussions related to using VirtualBox on Windows hosts.
Post Reply
bdutta
Posts: 22
Joined: 8. Apr 2009, 19:50
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: RHEL4.6

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

Post 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.
Attachments
VBox.zip
(11.07 KiB) Downloaded 143 times
Last edited by bdutta on 17. Jun 2013, 20:18, edited 1 time in total.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

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

Post 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.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
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, Gateway-IP changes on enable/disable

Post 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.
bdutta
Posts: 22
Joined: 8. Apr 2009, 19:50
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: RHEL4.6

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

Post 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.
bdutta
Posts: 22
Joined: 8. Apr 2009, 19:50
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: RHEL4.6

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

Post 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) ?
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, Gateway-IP changes on enable/disable

Post 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.
bdutta
Posts: 22
Joined: 8. Apr 2009, 19:50
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: RHEL4.6

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

Post 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.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

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

Post by Perryg »

No, you need to use Bridged and a router.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

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

Post 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.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply