0

I have an Ubuntu 13.10 instance running on a remote VirtualBox that I need to maintain for someone. I'm trying to figure out how I can SSH into this instance.

Ubuntu has OpenSSH installed, but so far I am only able to SSH from the Host (Windows 8) to the Guest. I need to be able to login via SSH, from a remote location.

Has anyone attempted this before?

The Host machine is sitting behind a standard WiFi router, and the Guest has a Bridged Adapter configured, meaning that on the router, the VirtualBox has an IP address.

However, that IP wouldn't be visible from the outside world.

I've been looking at using something like DynDNS or No-IP to try and get access to this machine. But haven't been able to find a way to effectively get it working.

Is there any other way I could SSH to this instance?

4 Answers 4

1

So long as your VM has an IP which is visible to the router you can set this up with the below method. I have this current setup on 3 VMs.

If you have setup SSH already you can skip the setup part here

Firstly we'll ensure you have everything working on SSH side. Starting with the install:

sudo apt-get install openssh-server

Navigate to your sshd_config file

sudo nano /etc/ssh/sshd_config

Specify your desired port. Save and exit your document once finished an grab the IP of your machine using:

ifconfig

enter image description here

From your host visit your router admin page via a web browser (probably at 192.168.0.1) and set up a port forwarding SSH rule. This will point to the IP address of your VM on the port your specified in the ssh_config file.

Save and restart your router. Now using Putty or whatever you prefer from another machine connect to your newly configured SSH system using your external IP and specified port

Should you only be needing to connect from a single machine as an extra security measure you can set up a private key for server verification using Putty. A guide on this can be found here

0

Maybe you could configure NAT on your wifi router : in conjunction with a specific port (here is 22) to say : from Internet (remote location), when i try to access to "IP" with port "22", router have to forward the request to the virtual host. With that, you only need one IP, and the differents port are used to distinguish the contacted host.

INTERNET => ROUTER with NAT => VM

without nat, i would be the host machine who'd be contacted.

(sorry for my english !)

1
  • I think what is required here is just port forwarding. I don't think NAT can help here. Mar 31, 2014 at 15:16
0

Within the virtualbox settings for the guest, enable a network adapter using the 'bridged' option. This allows it to connect to the same network as the host and can be accessed via ssh in the same way.

3
  • The OP states in the question Bridged Adapter is configures with both host and guest having an IP viable via the router. Apr 4, 2014 at 11:21
  • Sorry, missed that. Why is the fact it's a VM relevant to the question then?
    – Holloway
    Apr 4, 2014 at 11:24
  • It shouldn't be relevant. Since the IP is visible to the router the process should be a simple port forward job to a configured SSH server. Apr 4, 2014 at 11:32
0

Looks like you need to set up port-forwarding on your router.

Since your VM is behind a router, it's going to get its own internal IP address (commonly 192.168.x.x). In order to access the VM from the outside world, you need to tell your router to forward all requests to the VM on the internal network.

You can choose whatever router port you want to expose as long as you forward it to the correct port on the VM. (It's common to use a non-standard port when exposing a service to the public internet for security).

This website may help you get started: http://portforward.com/english/routers/port_forwarding/.


DynDNS is not required but may be useful in your situation. DynDNS is used when there's a chance your public IP address will change (this is how most home internet connection are). It is used in combination with a public domain name.

DynDNS periodically checks your public IP, and updates your domain to the new IP address when it changes. This way you can always access your network from www.yourdomain.com because it will always point to the most recently assigned IP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .