Networking Conundrum

Discussions about using Linux guests in VirtualBox.
Post Reply
BDub122
Posts: 7
Joined: 11. Oct 2014, 15:30

Networking Conundrum

Post by BDub122 »

I built a Linux guest VM with IP address 192.168.1.91. This VM is functioning as server, providing services on the network (e.g. yum, http). The guest has only one adapter, a bridged adapter. My configuration worked great while I was on my home network where my host (i.e. my laptop) was also on the 192.168.1.0/24 network.

Now I'm at a hotel. The hotel wifi assigned me an IP address in a different subnet (172.20.0.0/20) so I can no longer ssh from my host to my Linux VM, or access the resources that my Linux VM is serving up. :|

How you recommend I fix this so that the services my VM is offering up on the 192.168.0.1/24 network are accessible to me while my laptop is on a different subnet? For example, would adding a route at the guest or host level resolve my issue?

Thank you!
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Networking Conundrum

Post by scottgus1 »

You could set the VM's network to Host-Only, with the IP range set to 192.168.1.#/24, and the host only adapter at 192.168.1.1. Note the need to make or modify the /etc/vbox/networks.conf file to allow 192.168.1.# range, see https://www.virtualbox.org/manual/ch06. ... k_hostonly

You'll probably have to delete this network when you get back home so it won't interfere with your home network.
BDub122
Posts: 7
Joined: 11. Oct 2014, 15:30

Re: Networking Conundrum

Post by BDub122 »

Ohhh, that worked :D Thank you scottgus1!

As you said, I will need to remember to change the IP for the "VirtualBox Host-Only Ethernet Adapter" from 192.168.1.1 back to 192.168.56.1 (the default) when I get home.

The /etc/vbox/networks.conf file didn't exist yet on my guest, so I created it. It has one line:
* 192.168.1.0/24

Thanks again!
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Networking Conundrum

Post by scottgus1 »

Great! Glad you're up and running.
Post Reply