Configure Your Raspberry Pi for a Fixed IP Address with This Step-by-Step Guide

Learn how to set static IP address on your Raspberry Pi 4. The process is easy and only requires editing the configuration files. Follow this guide for a step-by-step tutorial! …


Updated September 24, 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 set static IP address on your Raspberry Pi 4. The process is easy and only requires editing the configuration files. Follow this guide for a step-by-step tutorial!

Are you tired of constantly changing your Raspberry Pi’s IP address whenever you connect it to a new network? Do you want to set a static IP address on your Raspberry Pi 4 so that you can access it easily from anywhere in your home or office? This guide will show you how to do just that.

Follow these steps to configure a static IP address for your Raspberry Pi:

  1. Open the terminal on your Raspberry Pi and type sudo nano /etc/dhcpcd.conf to open the dhcpcd configuration file in nano text editor. Press Enter to confirm the password when prompted.

  2. Add the following lines at the end of the file:

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

Make sure to replace the IP address, subnet mask, gateway, and DNS servers with appropriate values for your network. In this example, we’ve used 192.168.1.0/24 as the network, 192.168.1.1 as the gateway, and Google’s public DNS servers (8.8.8.8.8 and 8.8.4.4) for name resolution.

  1. Save the changes by pressing Ctrl + X, then Y, and finally Enter.

  2. Restart the network service to apply the changes:

sudo systemctl restart dhcpcd
  1. Verify that your static IP address has been set correctly by typing ifconfig in the terminal. You should see an output similar to this:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255

That’s it! You have successfully set a static IP address on your Raspberry Pi 4. Now you can access it from any device on the same network using the assigned IP (192.168.1.10 in this case). Just make sure that this IP is not already in use by another device on your network to avoid conflicts.

Remember, this guide assumes that your Raspberry Pi is connected to a wired Ethernet connection. If you’re using WiFi, replace eth0 with wlan0 in the configuration file.