The Ultimate Guide to Connecting Ethernet Cables to Your Raspberry Pi

Learn how to connect an Ethernet cable to your Raspberry Pi and get it up and running on your local network. From buying the right cable, to configuring IP addresses, this article has you covered. …


Updated October 12, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to connect an Ethernet cable to your Raspberry Pi and get it up and running on your local network. From buying the right cable, to configuring IP addresses, this article has you covered.

Raspberry Pi is a popular single-board computer used for various projects ranging from home automation to media centers. One of the most common tasks when working with Raspberry Pi is connecting it to a network. In this guide, we will walk through the steps to connect your Raspberry Pi to your local network using an Ethernet cable.

Step 1: Buy an Ethernet Cable

The first step in connecting your Raspberry Pi to the internet is purchasing an Ethernet cable. There are different types of cables available in the market, but you need a category 5 or better cable that supports Gigabit Ethernet speeds for best performance. Make sure you buy a cable with RJ45 connectors on both ends to ensure compatibility with your Raspberry Pi and network devices.

Step 2: Connect the Cable

Once you have an Ethernet cable, plug one end into your router or modem and the other into your Raspberry Pi’s Ethernet port (labeled as ‘Eth0’). Make sure both ends of the cable are properly seated to avoid connection issues.

Step 3: Assign an IP Address

The next step is to assign an IP address to your Raspberry Pi so it can communicate with other devices on the network. You have two options for this step:

  1. Static IP - A static IP address is a fixed IP that never changes and is assigned manually by you or your network administrator. To set up a static IP, open the terminal on your Raspberry Pi and type the following command:
sudo nano /etc/dhcpcd.conf

Add the following lines at the end of the file:

interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8.8 8.8.4.4

Replace ‘192.168.1.100’ with your desired IP address and ‘192.168.1.1’ with your router’s IP address. Save the file and exit the editor by pressing Ctrl+X, Y, and Enter. Reboot your Raspberry Pi to apply the changes:

sudo reboot
  1. Dynamic IP - A dynamic IP address is assigned automatically by the DHCP server on your network. To use a dynamic IP address, you don’t need to make any configuration changes as it’s the default setting for Raspberry Pi. Simply plug in the Ethernet cable and let your router assign an IP address to your Raspberry Pi.

Step 4: Verify Network Connection

After assigning an IP address, verify that your Raspberry Pi is connected to the network by running the following command:

ifconfig

You should see output similar to this:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:xx:xx:xx  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:360 (360.0 B)  TX bytes:468 (468.0 B)

Make sure the ‘inet addr’ field matches your assigned IP address and the ‘UP’ status is shown for the eth0 interface.

Step 5: Test Connectivity

To test connectivity, you can ping another device on your network or use a tool like ‘ping’ to check your internet connection. For example:

ping www.google.com

If everything is working correctly, you should see output similar to this:

PING google.com (172.217.168.206) 56(84) bytes of data.
64 bytes from sea15s09-in-f14.1e100.net (172.217.168.206): icmp_seq=1 ttl=56 time=13.7 ms

That’s it! You have successfully connected your Raspberry Pi to the internet using an Ethernet cable. Now you can install software, update packages, and connect to other devices on your network with ease.