0

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.

Luc
  • 263
  • 2
  • 17
  • 1
    Define "connect". What is your end goal? How are you needing to interact with this remote system? Please edit your question and include answers for those. – EEAA Aug 11 '15 at 16:21
  • @EEAA Thanks for the comment, I added more details and an example way of how I would like it to work. – Luc Aug 11 '15 at 17:00
  • If it's just a handful of ports, why not use an SSH tunnel? That would be a dead simple way to allow LAN clients to access ports on the remote server. – EEAA Aug 11 '15 at 17:02
  • @EEAA It's not just about reaching a service on my local machine, it's about reaching the local LAN using tools in the VM. I'll update my example to actually do something with the local network. – Luc Aug 11 '15 at 17:10
  • VPN software like [SoftEther](https://www.softether.org) (there are others) let you create a VPN at the layer 2 level so it can be like putting the remote system on the local Ethernet segment. This is different from most VPNs which are layer 3. – Brian Aug 11 '15 at 17:31

0 Answers0