Switching from Internal Network to Allowing Host OS to Conne

This is for discussing general topics about how to use VirtualBox.
Post Reply
THADC
Posts: 4
Joined: 25. Jan 2016, 17:39

Switching from Internal Network to Allowing Host OS to Conne

Post by THADC »

Hello,

I have a simple collection of Ubuntu guest VMs on Virtualbox (on Mac host) that share an internal network. Each VM has a fixed IP. I am not using a DNS server, so communication between them has involved connecting to the fixed IPs directly.

This has worked fine, but I now need a tool running on my Mac host to access one of the VMs, so therefore I have to change the virtualbox networking setup away from internal network.

I am looking for the simplest way to pull this off. Any help/suggestions are greatly appreciated. Thanks!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Switching from Internal Network to Allowing Host OS to C

Post by Perryg »

Add a second virtual adapter set to host-only for the guest that you need to be able to access from the host.
THADC
Posts: 4
Joined: 25. Jan 2016, 17:39

Re: Switching from Internal Network to Allowing Host OS to C

Post by THADC »

Thank you for the response. This was very helpful. I created the default host-only adapter to the virtualbox environment, and then added that adapter to the appropriate VM. Next, from the guest I ran:

Code: Select all

ifconfig eth1 192.168.56.102 netmask 255.255.255.0 up
I was able to successfully ping the IP address I set above. Finally, I was able to successfully execute from the host, web services running on that guest VM.

However, I am having a problem where the connection spontaneously stops — ping stops getting packets from guest VM and web service calls on that VM time out. If I then run:

Code: Select all

ifconfig eth1 192.168.56.102 netmask 255.255.255.0 down
, followed by:

Code: Select all

ifconfig eth1 192.168.56.102 netmask 255.255.255.0 up
, then the connection works again, but invariably stops after a short period of time (minutes later). Is there something I am doing incorrectly from the guest to make the host-only connection persist? By the way the guest OS is Ubuntu 64 bit. Thanks for any insights!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Switching from Internal Network to Allowing Host OS to C

Post by Perryg »

The normal suspects are the guest over aggressive power management. I always shut them off completely.
THADC
Posts: 4
Joined: 25. Jan 2016, 17:39

Re: Switching from Internal Network to Allowing Host OS to C

Post by THADC »

Thanks for the power management suggestion. However, when I go to the ubuntu power management settings, they appear to be essentially turned off anyway. May be problem lies elsewhere. If I figure it out, I will post here. If anyone else still has ideas, they would be appreciated. Thank you!
THADC
Posts: 4
Joined: 25. Jan 2016, 17:39

Re: Switching from Internal Network to Allowing Host OS to C

Post by THADC »

Ok, I have successfully completed all my goals here. The remaining issue was instability with the Host-Only connection between host and guest OS. I ran added the following entries in the /etc/network/interface file:

# The host-only network interface
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255

and restarted the vm. This seems to have stabilized the VM and connection between host and guest has been working fine now.
Post Reply