Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

2 Answers 2

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) -> <172.16.0.5:22>

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

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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