I asked this question some time ago, and searched for an answer all over the place. But everyone seems to be dodging the question. Or at least that's how a newbie like me sees it. All I find is stuff about connecting to my guest OS, which is the Linux Ubuntu 18.04 on the VirtualBox, from my host OS, which is a Windows 10. However, the point everyone misses is that those two are both on a LAN level. I want to connect to my VM from outside the LAN. I'm learning to setup a proper server and so I want to test everything on a VM before actually buying a Raspberry Pi and starting my server.
Anyways, I have three network cards on my VM. one uses NAT
, one uses the Host-Only Network
and the other uses Bridged Network
. I've configured the port forwarding for my VM's NAT
network to use 127.0.0.1
as the Host IP, 2222
as the Host Port, 10.0.2.4
as Guest IP and 22
as Guest Port. I have also executed the sudo ufw allow 22
and sudo ufw allow 2222
commands, as well as configured /etc/netplan/50-cloud-init.yaml
file and given my enp0s8
, which is the Host-Only
interface, a static IP of 192.168.56.101
, while the other interfaces each get their IPs from DHCP4
. Now, ssh
ing through 127.0.0.1
works fine when doing it from the host OS. So does ssh
ing through the 192.168.56.101
and 192.168.0.194
addresses. I can also ssh
from my android phone with JuiceSSH (while connected to the same WLAN, of course!) using the 192.168.0.194
address (the bridged one). But any attempt at trying to connect from outside the (W)LAN ends with a connection failed or timed out error.
Oh and I don't have access to my router.
Any and I mean ANY help is MUCH appreciated. I'm near losing my mind!!
EDIT1: Sorry if I sound a bit rude or arrogant or anything. It's just that I'm kinda new to the whole networking thing and I've been trying to make this happen for the last 3 weeks. I just want to start my own OpenVPN server and then add a Samba file server to it if I have enough nerves left... But securing a ssh has a higher priority, for maintenance and other stuff
EDIT2: Is it even possible to do this? considering a virtual machine is literally virtual and only exists in it's host machince? Like, let's suppose I did all of the above on a Raspberry Pi. Would I then be able to remotely access my server from outside the (W)LAN?
reverse-ssh
, as in connecting to my host and then forwarding the connection to my guest OS? @user535733