A Comprehensive Guide to Configuring a Static IP on Your Raspberry Pi

Learn how to set up a static IP address for your Raspberry Pi to ensure seamless connectivity between devices and avoid any potential network issues. This guide will show you step-by-step instructions …


Updated October 10, 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 up a static IP address for your Raspberry Pi to ensure seamless connectivity between devices and avoid any potential network issues. This guide will show you step-by-step instructions using the command line interface and also explain why setting a static IP is important.

Raspberry Pi is an affordable, credit-card sized computer that can run multiple operating systems, including Raspbian, Ubuntu, and Windows 10 IoT Core. It’s a popular choice for beginners who want to learn programming and electronics. However, one of the challenges new users face is configuring a static IP address on their Raspberry Pi device. This article will provide you with step-by-step instructions on how to set up a static IP address on your Raspberry Pi, using both the command line interface (CLI) and graphical user interface (GUI).

Setting Static IP via CLI

  1. Open terminal by clicking on the menu icon in the upper left corner and navigating to “Accessories” > “Terminal.”

  2. Type sudo nano /etc/dhcpcd.conf and hit Enter to edit the dhcpcd configuration file. You will be prompted for your password.

  3. Find the line that starts with #interface wlan0 and uncomment it by removing the #. It should now look like interface wlan0.

  4. Add the following lines below the uncommented line:

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

Replace 192.168.1.10 with the desired IP address for your Raspberry Pi, and adjust the subnet mask (/24) if necessary. The gateway address is set to 192.168.1.1, and the DNS servers are Google’s public DNS servers (8.8.8.8.8 and 8.8.4.4).

  1. Press CTRL + X to exit nano, then press Y to save changes and Enter to confirm the file name.

  2. Reboot your Raspberry Pi by running sudo reboot.

After restarting, your Raspberry Pi should have a static IP address assigned to it. You can verify this by running ifconfig, which will display network information including the IP address.

Setting Static IP via GUI

  1. Open the Raspberry Pi Configuration tool by clicking on the menu icon in the upper left corner and navigating to “Preferences” > “Raspberry Pi Configuration.”

  2. Navigate to the “Interfaces” tab.

  3. Under “WiFi,” select “Disabled” if your Raspberry Pi is connected via Ethernet or “Enabled” if it’s using Wi-Fi.

  4. Click on “Edit” and enter the desired static IP address, netmask (e.g., 255.255.255.0), gateway, and DNS servers.

  5. Save your changes and exit the Raspberry Pi Configuration tool.

  6. Reboot your Raspberry Pi for the changes to take effect.

Why Set a Static IP Address?

Setting up a static IP address on your Raspberry Pi is important for several reasons:

  • Consistency: A static IP ensures that your device always has the same IP address, making it easier to connect and communicate with other devices on your network.
  • Control: You have full control over the IP address, which allows you to avoid conflicts with other devices on the network.
  • Easier configuration: With a static IP, you can skip the hassle of manually configuring IP addresses for each device every time you set it up or reconnect it to your network.
  • Troubleshooting: If you’re experiencing network issues, setting a static IP can help isolate the problem and make it easier to diagnose.

Remember that if you’re working in a network with multiple devices, you need to ensure that the static IP address you assign is unique and within the correct range for your subnet. Consult your network administrator or refer to your router’s documentation for more information on available IP addresses.