Another networking question - Host-only network

This is for discussing general topics about how to use VirtualBox.
Post Reply
ohaya@yahoo.com
Posts: 34
Joined: 17. Jun 2015, 05:21

Another networking question - Host-only network

Post by ohaya@yahoo.com »

Hi,

In the File->Preferences-Network there is the Host-only Networks tab, and under that you can create Host-only *ADAPTER*.

When you do this, does this mean you are creating a specific adapter (with a specific IP address)?

Assuming that is the case, and you later assign that adapter to a guest, how does the IP address that you assign within the OS (e.g., via /etc/sysconfig/network-scripts/ifcfg-ethX) relate to the IP address that was set in the VBox File=>Preference=>Network?

I was looking at this page:

http://www.snapdba.com/2013/04/internet ... -adapters/

And in the example there, it says "For the second adapter you’ll need to assign it a fixed IP address and netmask based on the earlier Host-only configuration.".

It's not clear to me what they mean when they say "based on the earlier Host-only configuration"?

Does that mean that in the OS you have to set the IP address that is the same that you set in the File=>Preferences=>Network configuration?

Or, do they mean something else?

Also, what if the File=>Preferences has DHCP server configured, which means that you wouldn't necessarily know what the IP address of the machine is when you assign the adapter to the guest. In this case, in the OS, what do you set the IP address of the adapter to inside the OS?

Thanks,
Jim
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Another networking question - Host-only network

Post by Perryg »

Start here http://www.virtualbox.org/manual/ch06.h ... k_hostonly
and read the other links that are included which should answer all of your questions. After that if you are hung up on a particular issue then ask for that.

Basically this sets up a channel so the host and guest can communicate and not allow the guest to access the LAN/WAN
ohaya@yahoo.com
Posts: 34
Joined: 17. Jun 2015, 05:21

Re: Another networking question - Host-only network

Post by ohaya@yahoo.com »

Perryg wrote:Start here http://www.virtualbox.org/manual/ch06.h ... k_hostonly
and read the other links that are included which should answer all of your questions. After that if you are hung up on a particular issue then ask for that.

Basically this sets up a channel so the host and guest can communicate and not allow the guest to access the LAN/WAN

Hi,

Both myself and a couple of other colleagues have read through that page and the links. I guess that what we (maybe I) are unclear about is what is the purpose/role/meaning of the IP address that you put into the Files=>Preferences=>Network=>Host-only adapter. Reading the description on the manual page you linked carefully, and parsing word-by-word, the best analogue I've been able to come up with is that that IP address is kind of alias IP address that needs to be created almost as a side-effect of the way that Host-only networking has been implemented in VBox.

One theory that we have, which might make thing clearer is that, say:

- My physical PC's physical IP address was 192.168.0.20 and then
- I have VBox running on my PC, and
- we created a host-only network adapter and say we configured the IP address of that host-only network adapter to 192.168.56.50, and,
- suppose I have a web server like maybe Apache running on my PC, listening to all adapters on my PC, then
- we theorize that you could hit that Apache either by pointing a browser running ON MY PC to either http://192.168.0.20 or to http://192.168.56.50.

Is that correct?

Thanks,
Jim
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Another networking question - Host-only network

Post by Perryg »

Ok so the host-only network is for host<>guest communication only. Kind of what the name implies. ( no LAN communications )
This is done rather like a local loop back so the address would not be the same as you local LAN.
By default the original setup is done automatically and will have the address scheme of 192.168.56.* With the host having .1
The dhcp server then sets up a pool of addresses usually around .101 > ( server gets .100 )
You can use static addressing if you like as long as you do not use .1 and don't make the mistake of trying to use a gateway because it is not meant to be used.
ohaya@yahoo.com
Posts: 34
Joined: 17. Jun 2015, 05:21

Re: Another networking question - Host-only network

Post by ohaya@yahoo.com »

Hi,

I just found this older thread. It's apparently based on Mac networking, but I think it provides the answers to the questions that I probably didn't do a very good job asking (mainly because I've been so confused about this):

viewtopic.php?f=8&t=34396

Things like what is the relationship of the IP in the preferences vs. the OS (there apparently isn't much relationship, other than the two IP addresses shouldn't conflict), e.g.:
The vboxnet0 that is selected in the Adapter 2 settings is somewhat misleading, because it refers to the IP address that the Mac OS will be using to communicate with your Guest OS and it is NOT the address that your Guest OS interface will have.
Hopefully this'll help clarify things...

Thanks,
Jim
BillG
Volunteer
Posts: 5105
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Another networking question - Host-only network

Post by BillG »

The command that you are talking about is the command which configures the virtual NAT network. The subnet you are defining is the one this virtual network will use and the gateway IP you specify is the address which will be allocated to the virtual NIC which is the gateway of this virtual network on the host machine. This interface does not exist until you run this command.

If you plan to use static IPs, you do no need to enable the DHCP server.
Bill
ohaya@yahoo.com
Posts: 34
Joined: 17. Jun 2015, 05:21

Re: Another networking question - Host-only network

Post by ohaya@yahoo.com »

Hi,

FYI, I decided that for my purposes, it'd be better and also sufficient for me to use NAT Networking for my tests, mainly because, as mentioned in this thread, even though the ".1" IP appears to exist and appears to behave as the gateway IP, it's not meant to be used as such, and, in my use case, I need to be able connect outward from the guest to the Internet.

By going to NAT Networking, I will have to forward some ports (e.g., 22 for SSH incoming) for incoming connections, but I think that'll be ok.

So I won't be using the Host-only network for now...

Thanks, for the help!

Jim
Post Reply