Jump to content

How to SSH into Ubuntu VM from MacOS


Recommended Posts

Hey everyone :)

 

I would like to make use of VS Code's remote SSH functionality. I currently work on a Macbook Pro but would like to develop in a native Linux environment for several reasons. It would also be nice to make use of my server GPU when working remotely.

 

I have set up an Elementary OS VM on my server but am having trouble with how to SSH from my Macbook into my VM on Unraid. My thinking is there should be a way to forward some port to the VM by using my servers IP? I have installed OpenSSH-server on the VM. Where do I go from here?

 

Thanks for any help!

 

P.S. I'm a network/VM noob, so baby steps are appreciated! :)

Link to comment

One way (the way I'm using) is to create a bridge connection (unraid <--> vm); with a bridge you can assign ips to both vm and unraid, let's say unraid is 192.168.2.1 and vm 192.168.2.2. Now if you attach a lan cable to the physical ethernet port you setup the bridge and to your macbook and you assign to your macbook for example the ip 192.168.2.3 you can reach your vm from your macbook.

I hope I was clear enough.

 

Or you can passthrough a physical ethernet to your vm and attach directly to the macbook, so without any bridge, because the ethernet is "native" in the vm.

 

Or, similar to above, you can attach (passthrough) a usb wifi dongle to the vm and connect from the macbook via wifi.

 

The important thing is that both the vm and the macbook must be on the same network.

Edited by ghost82
Link to comment
On 5/19/2021 at 2:15 PM, ghost82 said:

One way (the way I'm using) is to create a bridge connection (unraid <--> vm); with a bridge you can assign ips to both vm and unraid, let's say unraid is 192.168.2.1 and vm 192.168.2.2. Now if you attach a lan cable to the physical ethernet port you setup the bridge and to your macbook and you assign to your macbook for example the ip 192.168.2.3 you can reach your vm from your macbook.

I hope I was clear enough.

 

Or you can passthrough a physical ethernet to your vm and attach directly to the macbook, so without any bridge, because the ethernet is "native" in the vm.

 

Or, similar to above, you can attach (passthrough) a usb wifi dongle to the vm and connect from the macbook via wifi.

 

The important thing is that both the vm and the macbook must be on the same network.

That is clear, thanks. Ideally I would like to be able to access this all remotely (via the internet) though. I wonder if there is some way to map my OpenSSH port on the VM to a server port somehow? That way I could use my internet IP/domain with that port to access the VM SSH port. Not sure if that sounds reasonable.

Link to comment

ok, the above are still valid solutions: with all solutions your vm should able to access the internet if it is set in the same network as your modem/router.

Now in your router settings just set a port forward, to forward requests from outside on <public ip>:choosenPort to port 22 on <internal-ip-of-vm>.

Check security when you open ports to the outside!

Edited by ghost82
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...