When the Raspberry Pi is not connected to a network, you can use the ethernet port to directly connect it to a laptop and ssh into it. This is more elegant than bringing a screen and a keyboard. Or, God forbid, only a keyboard, and issuing commands blindly... (We've all been there, haven't we?)
The ssh server on the Pi may be disabled by default. It can be enabled using raspi-config
.
An easy way to establish a direct ethernet connection is to set a fixed IP address for the eth0
interface. The boot partition, which is mounted at /boot
in the Pi, contains a file called cmdline.txt
that lists several boot options. Add the option ip=192.168.178.42
(or whatever IP you like) to the end of the line, separated by a space. Then reboot the Pi. This will assign the specified IP to the eth0
interface.
The boot partition uses FAT32. You can also mount it on another computer and edit the file there.
On your laptop, configure a network connection with a netmask of 255.255.255.0
and an IP in the same subnet as the Pi, e.g. 192.168.178.43
. Set the gateway to 0.0.0.0
. This will make the laptop talk directly to the Pi. On a Linux laptop you can simply issue the following command:
ifconfig eth0 192.168.178.43 netmask 255.255.255.0
If you don't have Linux on your laptop, or don't want to mess with your system, I've found the Knoppix live system to be very useful for things like this.
Connect the two with a regular ethernet cable. You should now be able to ssh into the Pi from the laptop:
ssh pi@192.168.178.42