0

I have created a VM on my personal machine and the VM is running CentOS and I can ssh to that machine from my local Windows 10 machine via PuTty. However, I am not sure of how to ssh to the VM from a different computer that is not on my home network, i.e. I took my other laptop to the coffee shop and left the VM up and running on my machine at home.

How would I set this up? I tried to look up the IP address of the VM and connect to it, but I must be doing something wrong.

Thank you!

0

Exposing that VM from your home internet may or may not be possible, depending on your hardware and internet provider. Only one way to find out...

Bare in mind your router will have its own public IP, and all the IPs used by your devices on your LAN will use a separate private IP range (generally starting 192.168.x.x, 172.16.x.x or 10.x.x.x). These private IPs are kept hidden from the public internet by Network Address Translation (NAT). If you do a Google for whats my ip address - it will give you your routers public IP - this is the address you need to connect from the outside world.

First, make sure your VM has its own private IP address on your home LAN (a bridged network) - you should be able to connect to that IP from any machine within your home network.

Next, on your router, enable port forwarding and map port 22 (or possibly some other port, 22 might not be allowed) and instruct your router to send traffic to port 22 on your VMs private IP address. Now any requests on port 22 of your routers public IP will be forwarded to your VM

The main problem with this approach is you need to know your Routers external IP to be able to connect and depending on your provider your external IP will change from time to time. The solution is to get a dynamic DNS (DynDNS) provider that will allow your server to update a DNS entry so you have a hostname instead of an IP to remember.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.