0

How do I SSH into my Rasperry Pi which is directly connected to my Linux Laptop via an Ethernet cable? As far as my research went, it does not get assigned an IP, which is the reason why I can not reach it via SSH, as I normally would. Any help appreciated.

Notes:

  • I have no access to the Pi's CLI, only to my Laptop.
  • I can not connect my Pi to a router.

Edit 1:

I now know that the Pi gets assigned some Link-local address. I noticed that when I plug the Ethernet cable in, the enp0s25 interface changes from DOWN to UP (output of ip a). However, nothing else changes.

Edit 2:

I installed and configured a dhcp server on my laptop. Here are the debug messages that show it is working:

DHCPDISCOVER from dc:a6:32:86:7f:97 via enp0s25
DHCPOFFER on 192.168.0.1 to dc:a6:32:86:7f:97 (pi) via enp0s25
DHCPREQUEST for 192.168.0.1 (192.168.0.0) from dc:a6:32:86:7f:97 (pi) via enp0s25
DHCPACK on 192.168.0.1 to dc:a6:32:86:7f:97 (pi) via enp0s25

However, I still can not reach my Pi. What do I have to do now?

Edit 3:

I now used the IP range 172.16.0.0/12 with this configuration of dhcpd:

option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.240.0.0;
option routers 172.16.0.1;
subnet 172.16.0.0 netmask 255.240.0.0 {
    range 172.16.0.2 172.16.0.10;
}

Here is the relevant part of the output of ip addr:

enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
 link/ether 3c:97:0e:22:85:da brd ff:ff:ff:ff:ff:ff
 inet 172.16.0.0/12 scope global enp0s25
    valid_lft forever preferred_lft forever

Here are the dhcp debug messages that again show it is working:

DHCPDISCOVER from dc:a6:32:86:7f:97 via enp0s25
DHCPOFFER on 172.16.0.2 to dc:a6:32:86:7f:97 (pi) via enp0s25
DHCPREQUEST for 172.16.0.2 (172.16.0.0) from dc:a6:32:86:7f:97 (pi) via enp0s25
DHCPACK on 172.16.0.2 to dc:a6:32:86:7f:97 (pi) via enp0s25

However, when I ping 172.16.0.2, I get this error:

PING 172.16.0.2 (172.16.0.2) 56(84) bytes of data.
From 172.16.0.0 icmp_seq=1 Destination Host Unreachable
From 172.16.0.0 icmp_seq=5 Destination Host Unreachable
From 172.16.0.0 icmp_seq=6 Destination Host Unreachable

Meaning I still can not SSH into my Pi. Any ideas?

weisbrja
  • 111
  • 2
  • run a dhcp "server" on the laptop. i do it from a windows machine with a portable executable... – Abel Dec 31 '21 at 02:31
  • I edited my question accordingly. – weisbrja Dec 31 '21 at 15:24
  • is it possible you gave the pi or your laptop a wonky subnet at some point? I believe DHCPACK should mean the ip assignment handshake completed... – Abel Dec 31 '21 at 17:49
  • I will try another subnet. – weisbrja Dec 31 '21 at 19:20
  • I think the assignment completed, but I somehow still can not reach the Pi. – weisbrja Dec 31 '21 at 19:57
  • You have provided virtually no information (which Pi? which OS? how you set it up) and no meaningful diagnostics. We don't even know what OS your laptop is running or what commands you are entering. The (ill-advised) advice to install DHCP at least shows it is probably a Pi4 and is getting an IP. My Answer works on every Linux machine I have tried, so there is obviously some other issue. You may get more speculative suggestions, but these will all be a guess. – Milliways Jan 01 '22 at 00:09
  • Okay. The problem must then be coming from the fact that I have Arch Linux installed on the Pi4. What OS on the Pi did your answer work out for? – weisbrja Jan 01 '22 at 02:09
  • Judging by the error message from ping: you may need to add a route on your laptop.. Check the output of route -n or ip route get 172.16.0.2 or traceroute 172.16.0.2 on your laptop. You can add the output of route -n to your question. – Kate Jan 02 '22 at 17:12
  • Alternatively you could enable the serial console over USB or UART on your RPI. Thus the network interface on your laptop is freed up and can be used for regular LAN/Internet access. – Kate Jan 02 '22 at 17:12
  • related: https://raspberrypi.stackexchange.com/questions/3867/ssh-to-rpi-without-a-network-connection – Ciro Santilli OurBigBook.com Feb 09 '24 at 10:46

2 Answers2

0

The Ethernet will have a Link-local address (169.…)

You can ssh using a Link-local address on most Linux systems (although the range of other services may be limited).

You can also use ssh pi@raspberrypi.local to ssh.

This assumes you haven't changed the hostname from raspberrypi, AND

That you have enabled ssh on the Pi.

This can be done at initial imaging, using the advanced setting OR by creating an empty file ssh in the boot partition of the SD Card.

PS It is easier and better to connect the Pi to your router.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • My Raspberry Pi has SSH enabled, however I can not find the Link-local address of it. Using the raspberrypi.local does not work in my case. How can I find out the Link-local address? – weisbrja Dec 30 '21 at 23:08
  • @weisbrja Your Linux system will have some means of displaying network interfaces. ip -s a should work – Milliways Dec 30 '21 at 23:31
  • I edited my question accordingly. – weisbrja Dec 31 '21 at 00:04
0

If you are running Arch Linux (which you should have disclosed in your question) you will have to set it up normally i.e. with a screen and keyboard.

Arch is an OS for expert users, comes with minimal code installed and CERTAINLY DOES NOT support the convenience functions Raspberry Pi OS includes. It is unlikely to have ssh active and depending on exactly how you installed it may not have a user account.

The one thing it should have is support for Zero Conf.

Milliways
  • 59,890
  • 31
  • 101
  • 209