How to connect a raspberry pi to PC through an Ethernet cable

How to connect a raspberry pi to PC through an Ethernet cable
DALL·E 3

This guide will show you how to connect a raspberry pi directly to your computer through Ethernet. This is useful for when you have no means to connect a display or keyboard to the raspberry pi.

Step 1) Install Raspberry Pi OS

When installing the Raspberry Pi OS, make sure that on the advanced options you:

  • Enable SSH
  • Write down the host name for your raspberry pi (default is raspberrypi.local)
  • (Optional) Set a username, preferably what you use on your desktop.
Raspberry Pi OS Imager Advanced Settings

Step 2) Configure your Ethernet adapter

This step can vary a lot depending on your OS.

In Ubuntu, go to your network settings, select the Ethernet adapter, and set the ipv4 to Shared to other computers.

In Windows, follow this guide: https://youtu.be/oM2zVD9rL8I

Ubuntu 23.10 Settings

Step 3) Confirm Ethernet connection

Before attempting to ssh into your raspberry pi, it is recommended to ping the host name of the raspberry pi.

If you get a ping reply, you are set to go.

If you do not get a reply, you may need to do some troubleshooting.

  • If you use a USB to Ethernet adapter on the raspberry pi, disconnect and reconnect the adapter, wait 30 seconds, and check that the status light are enables.
  • If you use the onboard Ethernet adapter, reconnect the cable and wait 30 seconds.

If the connection still fails, make sure your Ethernet cable or adapter works.

Step 4) SSH into your Pi

If you reached this step, you are set to go!

Just type ssh username@hostname into your console, where the username (pi by default), and the hostname (raspberrypi.local by default) is what you wrote down in step one.

Hope this guide helped you! If you have any suggestions on how to improve this guide, feel free to email me!