network setup questions

Discussions related to using VirtualBox on Windows hosts.
Post Reply
gravyking
Posts: 5
Joined: 15. Jan 2018, 19:46

network setup questions

Post by gravyking »

My configuration is a Windows Host that I use via a VPN client to connect to my corporate network.

I have 2 newly created Oracle Linux VM's (created via an ISO) and now I want to connect to them remotely say via ssh from a server on our network or even remotely via a browser.
However I am not 100% sure which setup I should use for my Network (ie NAT or bridged) but am so far using NAT.

As a test I was able to use ssh to connect from the VM's to other Linux hosts on my corporate network (via a VPN client).
So I can connect from my VM's to another Linux server but I can't connect the other way around.
So two questions:
1. Both VM's have the same inet address if I run ifconfig so is that right? I would think they should be different but maybe that's how NAT works. The netmask value is different than my corporate servers netmask also.
2. If I change it to Bridged Adapter would I select the VPN interface? Maybe that's all that's needed?

I have tried to read and understand the network related notes just not sure how the VPN client changes things.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: network setup questions

Post by scottgus1 »

VPNs do change things, yes. But this may still be possible. See Virtualbox Networks: In Pictures.

With Bridged, the VMs connect as equal Peers on the host's LAN. I think the VMs might bypass the VPN and need their own VPN clients, or the VPN might break off due to the extra connections. But you could try it.

NAT uses your host's internet connection and is filtered by your host's firewall, probably going through the VPN. You have to open ports in the host's firewall to send the traffic to the host, then open ports through NAT to send the traffic to the VM. NAT does give each VM the same IP address on the VM's private side, so to differentiate the two VMs you need different ports for each VM.

Example, SSH into either of two VMs from outside the host, both VMs attached via NAT:

Each VM has its own private LAN, so the IP addresses can be the same, typically 10.0.2.15. These IP addresses will not be used.
VM 1's NAT port-forwards host port 8022 to guest port 22.
VM 2's NAT port-forwards host port 8023 to guest port 22.
Host firewall allows ports 8022 and 8023 through.

SSH client from your job to host.ip.add.ress:8022 goes into VM 1 port 22.
SSH client from your job to host.ip.add.ress:8023 goes into VM 2 port 22.
host.ip.add.ress probably is the IP address given by the VPN.
Post Reply