How to make communication with VMs, using Host-Only networks

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

How to make communication with VMs, using Host-Only networks

Post by eric-wu »

Hello.

I'm currently using VBox API 5.0.14 in C++ via Com.
My host OS is Win 10 and my guest is a 32bit other Linux.
I'm using the Host-Only network, but i'm net sure about how to solve my problems as follows,
1)I would like to telnet my VMs to make communications, so what interface is used to make communication or how to set the port using Com API to make telnet communication.
2)How could VM communicate with VM, and what interface or function is used to make communication.
I have already read the 5th part of the API,but have no idea.

Thank you for your help.

PS : Sorry if I make some english mistake.
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: How to make communication with VMs, using Host-Only networks

Post by noteirak »

This has nothing to do with the API directly, at least from what I'm understanding.
If you need a software in the guest OSes to do comms, that's just a regular network software, just like you would do it on regular computers.

Are you trying to get the IP of a running VM perhaps?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to make communication with VMs, using Host-Only networks

Post by eric-wu »

so how can i telnet my VM's OS?
i have no idea how to find the port to telnet the VM
directly using telnet protocol(telnet 192.168.56.1(the ip is static setting by the Host-Only network))means telnet the host OS. So we need to telnet 192.168.56.1 xxxx to login the VM's OS.
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: How to make communication with VMs, using Host-Only networks

Post by noteirak »

I'm not sure I follow...
What information are you missing? The guest IP or the port on which the telnet server is running in the guest?
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: How to make communication with VMs, using Host-Only networks

Post by Perryg »

First you need to understand that host-only means just that. It allows communication between the host and guest only. Next there is no need for port forwarding since the guest receives a specific IP address in the range 192.168.56.* and if using DHCP it should be 192.168.56.101 by default unless you changed it. If you want to access the guest from anywhere else other than the host you need to use a different protocol than host-only.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to make communication with VMs, using Host-Only networks

Post by eric-wu »

noteirak wrote:I'm not sure I follow...
What information are you missing? The guest IP or the port on which the telnet server is running in the guest?
the port
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: How to make communication with VMs, using Host-Only networks

Post by noteirak »

The only thing VirtualBox can help you with here is to run a process inside the guest OS (a CLI command per example) to retrieve that info, but that's it.
VirtualBox is at the hardware level and doesn't deal with network transport protocol.

There is an API example of running a process in VirtualBox here - You'll find similar classes and methods in the C++ API so this is just for the approach.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to make communication with VMs, using Host-Only networks

Post by eric-wu »

thanks a lot.
Post Reply