VirtualBox VM Network Access to Host

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Post Reply
findjammer
Posts: 6
Joined: 2. Jul 2015, 13:14

VirtualBox VM Network Access to Host

Post by findjammer »

Hi,

I've just installed VB for the first time as it's required in order to run Xamarin Virtual Android Emulators and I'm having trouble figuring out how to configure it to talk to my host machine.

The Host machine is running Windows 8.1 Pro and I believe behind the Android Emulator is a flavour of Linux. I'm no network guy by any means so I'm not sure what needs doing to get my scenario working. The Android application I'm building needs to talk to an API on my host machine but it cannot see this machine. I can connect to the internet from the Android Emulator without any problems so most of the network setup is good.

On my host machine I can browse to the API at localhost:51258

When looking at the network settings for for the VB guest I can see two network adapters one is Host-Only and the other is NAT both are Paravirtualized Network (virtio-net) type adapters.

If I run ipconfig on my Windows 8 machine it shows me this:

Ethernet adapter Network Bridge:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::b119:4cdc:a70e:8b50%9
IPv4 Address. . . . . . . . . . . : 192.168.0.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

Ethernet adapter Ethernet 2:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter Ethernet:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter VirtualBox Host-Only Network:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::7513:6b13:38fe:37be%12
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :

Ethernet adapter VirtualBox Host-Only Network #2:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::9555:89c1:b096:9336%17
IPv4 Address. . . . . . . . . . . : 10.71.34.1
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . :

When I view the Network and Sharing Center in Windows I can see two adapters listed:

The adapter for the Host:

Access Type: Internet
HomeGroup: Joined
Connections: Network Bridge

And the VirtualBox connection:

Access Type: No network access
Connections: VirtualBox-Host-Only Network

What do I need to configure in order to be able to access my development API on the host from the Android Emulator in VirtualBox? I know so precious little about networks in real terms that I'm more concerned about bricking my network completely otherwise I'd be off flicking switches in order to see what works.

Thanks for reading and I appreciate any pointers.

J
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox VM Network Access to Host

Post by noteirak »

In the guest, configure the Host-Only interface with static IP of 192.168.56.2 and a mask of 255.255.255.0 - Don't configure any gateway or dns for that connection.
Make sure you disable your host firewall on the host-only interface, then:
- you can reach the guest from the host using 192.168.56.2
- you can reach the host from the guest using 192.168.56.1

Before doing anything else, make sure they can ping each other.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
findjammer
Posts: 6
Joined: 2. Jul 2015, 13:14

Re: VirtualBox VM Network Access to Host

Post by findjammer »

Hi Noteirak,

I've had a look around and I cannot translate the "In the guest ..." instructions into any of the available places for configuration - fell at the first hurdle.

I've had a look at all the places where I can change settings and none of them offer the ability to set IPs or masks. If I boot the VM from the VB interface I just have the same settings dialog as in VB, with no options for setting IP addresses or Subnet Masks.

If I try to configure the adapter via Windows Network and Sharing Center there isn't any opportunity to set IPs or masks there either.

I can't the ping command from the emulator in VB as it doesn't have any form of termial. When I do launch the VM from VB it stops at a message saying "Trying to mount /dev/block/sdc". After a short period of time I can then type in the window and just to try it I typed "ping 192.168.0.3 (the host IP address) and it errored with "You must have internet permissions to use ping."

I really don't think the VM is supposed to be/designed to be launched this way, I think it's a hugely cut down/limited kernal thing designed just to run an Android emulator.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox VM Network Access to Host

Post by noteirak »

findjammer wrote:I've had a look around and I cannot translate the "In the guest ..." instructions into any of the available places for configuration - fell at the first hurdle.
Well normally, the guest is just like your regular Windows but inside the VirtualBox window. You can configure things in there, including network settings. But that depends on the guest OS!
findjammer wrote:If I try to configure the adapter via Windows Network and Sharing Center there isn't any opportunity to set IPs or masks there either.
You wouldn't change anything on your Windows host. This is purely inside the VirtualBox window, and literraly inside, not the menus or anything - the screen of your virtual computer basically
findjammer wrote:I can't the ping command from the emulator in VB as it doesn't have any form of termial. When I do launch the VM from VB it stops at a message saying "Trying to mount /dev/block/sdc". After a short period of time I can then type in the window and just to try it I typed "ping 192.168.0.3 (the host IP address) and it errored with "You must have internet permissions to use ping."
I really don't think the VM is supposed to be/designed to be launched this way, I think it's a hugely cut down/limited kernal thing designed just to run an Android emulator.
It certainly looks that way. Android itself is not supported by VirtualBox, so we don't spend time helping people in there, and that's even more true for custom version.
I still wanted to guide you in the right direction in term of virtualization and terms associated with it.
All I can advise is to seek further advise with Xamarin directly. If they provided the VM, they also have to tell you how to use it.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
findjammer
Posts: 6
Joined: 2. Jul 2015, 13:14

Re: VirtualBox VM Network Access to Host

Post by findjammer »

Indeed, I'm more than a little lost on this as I think the setup is proprietary to say the least. I've been pouring over various things I've found on the net for the last 9 hours and have gotten exactly nowhere.

It seems to be a very customized setup in general. I've sent Xamarin an email asking for some support on this but heard nothing back as yet. Really appreciate your time though, thanks for posting.
findjammer
Posts: 6
Joined: 2. Jul 2015, 13:14

Re: VirtualBox VM Network Access to Host

Post by findjammer »

OH!!!!

I just found something on the Xamarin forum. The subnet mask settings can be changes in the File -> Preferences within VB Looking at the settings in there my subnet mask WAS 255.0.0.0 so I've just set that to 255.255.255.0. Wish me luck! :)
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox VM Network Access to Host

Post by noteirak »

Mmmm, maybe we're not talking about the same thing. The only thing you can configure in VB is the Host-Only interface for the HOST, which is not what you want to do.
Or maybe this is not in VirtualBox at all but in the 3rd party program
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: VirtualBox VM Network Access to Host

Post by Perryg »

You may want to move this topic to other guests Max since it really has nothing to do with the host.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox VM Network Access to Host

Post by noteirak »

Done! Thank you for pointing it out.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
NVII
Posts: 4
Joined: 2. Aug 2015, 07:53

Re: VirtualBox VM Network Access to Host

Post by NVII »

hey im really new to virtual box adn i cant even figure out how to make my own post. but my question is that my eth0 inet addr is 10.0.02.15 but every youtube video i see their inet addr starts with 192 i was wondering how i would go about changing my address to look more like every1 elses
findjammer
Posts: 6
Joined: 2. Jul 2015, 13:14

Re: VirtualBox VM Network Access to Host

Post by findjammer »

I think you need to start a new thread and explain what you are trying to do.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VirtualBox VM Network Access to Host

Post by mpack »

A 10.x.x.x IP address simply means you are using NAT mode, i.e. your VM is using the host like an internet modem. Start a new topic if that isn't enough of an answer.
Post Reply