The scenario is as follows: I have a virtual machine remotely, e.g. on a server somewhere in a data center, and I connect to it from my laptop on a restricted network (only tcp 80 and 443 are open). My laptop is not publicly reachable because of NAT or a firewall. Is there any way I can connect this virtual machine to the local network that my laptop is connected to?
It's like a VPN, except reversed because the VPN target is my own laptop, which is not publicly reachable because of a firewall. For example, I would imagine it could work like this:
# Find my laptop's local IP address
luc@laptop $ ip addr | grep dynamic
inet 10.0.0.100/24 brd 10.0.0.255 scope global dynamic wlan0
# Connect to the virtual machine
luc@laptop $ ssh user@241.42.1.40 -p 443
# Find the VM's IP address now that we are connected
user@virtual-machine $ ip addr | grep dynamic # The VM's IP address
inet 241.42.1.40/24 brd 241.42.1.255 scope global dynamic eth0
# Connect, on the VM, to the local network of my laptop
user@virtual-machine $ ./connect-back-to-laptop-network.sh
Connecting...
Connected tun0 to 10.0.0.0/24
# Do something on the laptop's local network from the remote virtual machine
user@virtual-machine $ snmpwalk -mALL -v1 -cpublic 10.0.0.4 system
[output]
I would like to use open source software (virtualbox; qemu) but proprietary solutions are also welcome. I'm just curious whether it exists and how easy it is to set up.