Take the 2-minute tour ×

I have a Raspberry Pi connected to my Macbook Pro with a LAN cable. The network from my Mac is shared with the Raspberry Pi through this cable.

Is it possible to ssh from my Mac to the Raspberry Pi through the LAN connection?

share|improve this question
I put a general answer, but the specific answer will likely require detailed information of exactly what IP address, router and netmask are assigned on the Mac and the Pi. This is a simple networking problem - you can use the same setup as a Windows, Linux, whatever computer wired into the Pi since networking is OS agnostic for basic SSH/IPv4 traffic. –  bmike Nov 27 '12 at 16:51
add comment

2 Answers

up vote 3 down vote accepted

Yes, this is possible. It depends on the network addresses you assigned the mac and the Raspberry Pi. For example, if your mac has one interface (en0) on one IP range and the other interface (en1) on another, you can log in via the connection (either en0 or en1) that is on an accessible network.

In my case, I can reach my home computer via a port forward from the internet. This is done by using a router that allows me to forward specific ports to specific internal IP addresses.

-> (port 22 ssh) -> <>

So, once I'm on my internal machine <> I can then ssh to a machine connected to my machine via the en1 (wireless network) say

So, if you set up a connection from your mac to your raspberry pi on a private network, you can just ssh to your main machine and then to the private ip.

share|improve this answer
add comment

Yes - as long as the Pi is listening on ssh and your network allows both devices to be on the same network subnet - you won't need to enable any extra routing or port forwarding / NAT to ssh back and forth between both devices.

Since you are sharing the network, there should be a viable network connection between the two devices. It might be easier to get a cheap switch/hub so that the Pi can get on your home router and get an address from DHCP - but as long as you know the IP address of the Pi - your Mac could choose a compatible IP address for when you need to ssh in.

share|improve this answer
add comment

Your Answer


