Page 1 of 1
Connecting VM to host using host-only (sovled)
Posted: 9. Jan 2013, 06:57
by waldorfm
Hi,
I have the following system:
Host System: Mac OS X 10.6.8 (Mac Pro 4,1)
Guest System: Oracle Linux 6.3 x64
Virtualbox 4.2.4
I setup the VM using Host-only connected to the default vboxnet0 virtual adapter and configured TCP/IP in the guest OS as following:
IP4: 192.168.56.25
NW: 255.255.255.0
GW: -
I can ping from 10.0.0.1 (host) to 192.168.56.25 (guest) no problem.
Using netstat -rn on the host system shows the 192.168.56 network is bridged:
192.168.56 link#7 UC 0 0 vboxnet
I cannot ping from the guest OS to the host:
PING 10.0.0.1
connect: Network is unreachable
According to the VirtualBox manual, regarding the Host-only adpater:
...as with bridged networking, the virtual machines can talk to each other and the host as if they were connected through a physical ethernet switch.
From what I understand, the failure to ping the host from the guest is to be expected, since the host and guest OS are on different networks. The bridged interface is only on the host side.
So I thought that using a virtual network adapter within the same subnet of the host system would enable communication. I added the following to VirtualBox:
Name: vboxnet1
IP4: 10.0.10.1
NM: 255.0.0.0
DCHP: disabled
I setup the VM using Host-only connected to the new vboxnet1 adapter and configured TCP/IP in the guest OS as following:
IP4: 10.0.2.25
NW: 255.0.0.0
GW: -
I cannot ping between the guest and host OS.
PING 10.0.2.25 (10.0.2.25): 56 data bytes
Request timeout for icmp_seq 0
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
From 10.0.2.25 icmp_seq2 Destination Host Unreachable.
I can also not ping the virtual network adapter 10.0.10.1 from the host or guest OS.
The host (Mac OS X) has the following TCP/IP configuration:
IP4: 10.0.0.1
NW: 255.0.0.0
GW: 10.0.0.138
How to enable communication from the guest to the host system using the host-only adapter according to the manual? As far as I can tell there is no functional difference now between the internal and and host-only adapter.
Any ideas?
I already searched the forum and Google, but did not find a solution yet.
Kind regards.
Re: Connecting VM to host using host-only
Posted: 9. Jan 2013, 11:07
by noteirak
Your host gets an IP address in the range of the host only interface : 192.168.56.1
So from your guest, if you want to access your host, you would need to use 192.168.56.1 and not 10.0.0.1
As for your second try, you would need to use the Virtualbox tools to change the subnet range values. If you try to use regular OS tools, it will not work.
Also, you cannot configure the same subnet on the host-only than on your regular host nic. You will only make it so it is impossible for the routing process to know which NIC to use.
My first recommendation would be to reduce the scope of your subnet, 255.0.0.0 is big, do you really need that? I would keep it to 255.255.255.0.
Re: Connecting VM to host using host-only
Posted: 9. Jan 2013, 11:59
by waldorfm
Thank you for replying! Sorry I don't understand your first response.
My host IP is 10.0.0.1 and the VirtualBox virtual network adatper is 192.168.56.1. The VM guest OS is using 192.168.56.25.
host (10.0.0.1) -> guest (192.168.56.25) ok.
guest (192.168.56.25) -> host (10.0.0.1) failure.
I'd say this can be explained because the VM guest OS has no route or link to the 10 network on the other side of the VM virtual adapter.
Do you mean I should configure my guest OS to use the VM network adapter (192.168.56.1) as a gateway to access the 10.0 network of the host system? Or are you suggesting to change the host IP to the range of the 192.168.56.0 network?
As for the class A network, I admit it sounds wired, but have about 60 virtual machines installed over time, for fun and to reproduce specific issues related to specific Linux distributions and versions. I use the machine's IP address as part of the VM name and use the various segments of the 10 network to group the OS distributions together. I used the 10 network just for convenience. Now since VirtualBox has an option for grouping virtual machines together I probably don't need a class A network anymore, but it will be a lot of work to change it.
Are you saying that the host-only adapter only accepts connections from the host to the VM if the virtual adapter is a separate subnet of the host network? If that's the case how can communication from the VM to the host ever work?
I could continue to use the bridged adapter in my configuration, like I do with all the oder VM's. But now I need to test if the Host-only adapter works as advertised and allows communication from the VM to the host. So far I had no luck.
Re: Connecting VM to host using host-only
Posted: 9. Jan 2013, 15:26
by noteirak
waldorfm wrote:Thank you for replying! Sorry I don't understand your first response.
I'm gonna try to make it easier now then
waldorfm wrote:My host IP is 10.0.0.1 and the VirtualBox virtual network adatper is 192.168.56.1. The VM guest OS is using 192.168.56.25.
host (10.0.0.1) -> guest (192.168.56.25) ok.
guest (192.168.56.25) -> host (10.0.0.1) failure.
I'd say this can be explained because the VM guest OS has no route or link to the 10 network on the other side of the VM virtual adapter.
Yes that's normal, and you understand right.
What I am saying is you should NOT use the 10.0.0.1 ip to contact your host in your guest. What you have to use is 192.168.56.1, which is the IP address of the HOST for the Host-only NIC.
In case you are not aware, both the host and the guest get an IP on the Host-Only NIc.
waldorfm wrote:Do you mean I should configure my guest OS to use the VM network adapter (192.168.56.1) as a gateway to access the 10.0 network of the host system? Or are you suggesting to change the host IP to the range of the 192.168.56.0 network?
None of them. Simply use 192.168.56.1, it is already configured on the host
waldorfm wrote:As for the class A network, I admit it sounds wired, but have about 60 virtual machines installed over time, for fun and to reproduce specific issues related to specific Linux distributions and versions. I use the machine's IP address as part of the VM name and use the various segments of the 10 network to group the OS distributions together. I used the 10 network just for convenience. Now since VirtualBox has an option for grouping virtual machines together I probably don't need a class A network anymore, but it will be a lot of work to change it.
I understand that. My only advice on this matter - as this is a general advice - is to always look for a middle. Full Class A range is *a lot* of IPs. You talk about 60 addresses in total, which mean you would be fine with 255.255.255.0 networks, even several of them.
waldorfm wrote:Are you saying that the host-only adapter only accepts connections from the host to the VM if the virtual adapter is a separate subnet of the host network? If that's the case how can communication from the VM to the host ever work?
You shouldn't see the host-only network as anything else than just a virtual switch. Same the same rules apply than for a bunch of PCs (the VMs) connected together, with just a single PC among them having another NIC connected to another network. You would still need routing, etc.
waldorfm wrote:I could continue to use the bridged adapter in my configuration, like I do with all the oder VM's. But now I need to test if the Host-only adapter works as advertised and allows communication from the VM to the host. So far I had no luck.
It does, I am using it in some of my infrastructures dedicated servers, so it does the job - and very well at that. It is (almost as always) a matter of configuration and understanding of how it works.
Host-only can be seen as a switched network with a DHCP (your host) on it.
Re: Connecting VM to host using host-only
Posted: 9. Jan 2013, 16:47
by waldorfm
Ok, now the rubber meets the street. My misunderstanding was I used the TCP/IP address of the host system, instead of the VirtualBox virtual adapter. So the 192.168.56.1 address works in place of the host TCP/IP address from within the virtual machine.
I tested it and it does indeed work. I can ssh to the host system (10.0.0.1) from within the VM (192.168.56.25) by using the 192.168.56.1 VM adapter instead of connecting to 10.0.0.1.
Great, problem is solved.
Thank you very much!
Re: Connecting VM to host using host-only (sovled)
Posted: 18. Apr 2013, 15:32
by brianjb
I am not that great with networking. I have a similar situation as the OP. Maybe it's the lack of sleep, but I just can't seem to follow it. I am hoping that someone can help me get going.
Here is m current setup:
Mac OSX 10.7.5
Ethernet (this isn't plugged in by the way...I am strictly wifi):
IP 10.0.2.23
Mask 255.255.255.0
GW blank
Virtual host (red hat)
IP 10.0.2.22
Mask 255.255.255.0
GW blank
In the settings for the virtual machine, I have this for the adaptor (note that at one time I had an internal network and a NAT one enabled as well...those are disable right now) :
Attached to: Bridge Adaptor
Name (I have tried both p2p0 and also en0 Ethernet)
In the advanced section, I chose 'allow all' under promiscuous mode
For a little background on why I am trying to do what I am doing. There is a certain application on the virtual machine that I need to access. One way I have found around this is to fire up another virtual (an windows 7 machine) and then I can connect to it. I connect to it, because both of those virtuals had an internal network adaptor defined. The problem with this is that I had to keep both virtuals running and it slows my hosts computer. So if I can connect to the virtual with my host computer, it would save a lot of headache.
Any feedback appreciated!!!
Re: Connecting VM to host using host-only (sovled)
Posted: 18. Apr 2013, 17:04
by noteirak
Please don't hijack other's people thread, this is against forum's rule.
Create your own topic and please give a full and proper explanation of what your issue is, as I just don't understand right now since you mix it with the OP.
I will now lock this thread as it is solved.