Direct Ethernet Connection to Laptop

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?)

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 P, contains a file called cmdline.txt that lists several boot options. Add the option ip= (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.

Note: 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 and an IP in the same subnet as the Pi, e.g. Set the gateway to This will make the laptop talk directly to the Pi.

Connect the two with a regular ethernet cable. You should now be able to ssh into the Pi from the laptop:

ssh pi@

Keep in mind that on newer Raspbian distributions the ssh server is disabled by default and needs to be enabled using raspi-config.

Leave a Reply

Your email address will not be published. Required fields are marked *