Trouble Getting Sandbox Network?

This is for discussing general topics about how to use VirtualBox.
Locked
RichardThiago
Posts: 1
Joined: 7. May 2020, 14:51

Trouble Getting Sandbox Network?

Post by RichardThiago »

Host: OSX (10.14.6)
Guest: Ubuntu 19.10 (64-bit)
VirtualBox: 6.1.2 r135662

Trying to set up a guest server to do some development and testing. I don't want to use a bridged network because I don't want the guest (or later possibly guests) to be accessible except from each other and from the host machine. It's nice if they can still pull package updates from the internet but I also don't mind changing the network configs if it's harder to do that and keep them inaccessible from traffic outside the host. I need the host machine to be able to connect to a web server on the guest.

For some reason I can't seem to make it work. From what I've read it seems like what I want is a NAT 1st Network Adapter and a Host-Only Network 2nd Network Adapter. With both enabled I get the 10.0.2.15 addr from the NAT but no addr for the Host-Only Network. If I disable the NAT adapter and have Host-Only I get the 192.168.0.101, but I still can't ping that IP from the Mac host.

How can I resolve this? Thanks for any help!
Last edited by mpack on 15. May 2020, 17:40, edited 4 times in total.
Reason: Removed spam links inserted by RichardThiago, who is now banned.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Trouble Getting Sandbox Network?

Post by mpack »

I personally don't care for multiple NIC guests, and I find that most guest OS don't expect it.

A single NIC with NAT network gives you everything you need except the host connection. Otherwise bridged is what I would use, regardless of your concerns about it (which I frankly don't quite understand: the VM has to be accessible but also not accessible?).
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Trouble Getting Sandbox Network?

Post by scottgus1 »

See Virtualbox Networks: In Pictures.
RichardThiago wrote:I don't want the guest (or later possibly guests) to be accessible except from each other and from the host machine....I need the host machine to be able to connect to a web server on the guest.
Host-Only lets the guest(s) and host have a private back-and-forth connection, with no Internet or physical LAN.

Adding a NAT (not NAT network) to each guest allows internet into the guest. With NAT or NAT Network the guest can see all of the host and LAN network devices and services.
RichardThiago wrote:NAT 1st Network Adapter and a Host-Only Network 2nd Network Adapter. With both enabled I get the 10.0.2.15 addr from the NAT but no addr for the Host-Only Network. If I disable the NAT adapter and have Host-Only I get the 192.168.0.101, but I still can't ping that IP from the Mac host.
It is important that all the previous attempts to set up network get cleared out, or previous settings can interfere with new tests. The situation in this quote does not happen when everything is allowed to stay as defaulted by Virtualbox, and the network IP ranges do not overlap with each other. The NAT, Host-Only, and real LAN IP ranges must be different for all the connections to work. (If your real LAN is also 192.168.0.### then you will have trouble.) Virtualbox's first default Host-Only network is 192.168.56.1/24, so something got changed.

Try deleting/erasing all NAT networks and Host-Only networks, deleting the Virtualbox DHCP servers (see the link on 'NAT Network' above), resetting all guest network cards, then start again fresh. (A new fresh guest would be best if you haven't configured much in the guest). NAT on card 1 in the guest, New Host-Only network on card 2. Double-check that the Host-Only IP range is different than the host's IP range before starting the guest.

If after resetting everything the NAT/Host-Only does not perform right, please provide these items:
1. the guest's .vbox file, zipped and attached using the forum's Upload Attachment tab.
2. on the guest, the text output of 'ifconfig'
3. on the host, the text output of 'ifconfig'
4. on the host, text output of these vboxmanage commands:
vboxmanage list hostonlyifs
vboxmanage list natnetworks
Locked