Set a Static IP Address on Raspberry Pi
This guide explains how to configure a static IP address on your Raspberry Pi.
This guide assumes you have sudo access on your Raspberry Pi and are comfortable using the terminal.
PhoenixNAP Guide
We created this guide based on the one here! Click here if you want more detailed info.
Open a Terminal Window on the Raspberry Pi
If you’re connected directly to your Raspberry Pi with a monitor and keyboard, you can open the terminal by clicking on the terminal icon or pressing Ctrl
+ Alt
+ T
.
If you’re connected via SSH, you are already in a terminal session.
SSH Instructions
SSH Guide for your Raspberry Pi.
Determine Network Interface and Current IP
List Network Interfaces
In the terminal, run the following command to list your network interfaces:
Identify Your Interface
Look for the interface you are using (e.g., eth0
for wired connection or wlan0
for wireless). Note down the interface name.
Find Current IP Address
Under the interface, look for the inet
line to find your current IP address. Note down the IP address, subnet mask, router (gateway), and DNS server.
Edit the dhcpcd
Configuration File
Open the Configuration File
Use a text editor like nano
to edit the dhcpcd.conf
file:
Add Static IP Configuration
Scroll to the end of the file and add the following lines, replacing the placeholders with your actual network details:
BlueOS Example:
Save and Exit
Press Ctrl
+ X
to exit, then Y
to save changes, and Enter
to confirm the file name.
Restart the Raspberry Pi
Restart your Raspberry Pi to apply the changes:
Verify the Static IP Configuration
After rebooting, open the terminal on the Raspberry Pi and run:
Confirm that your interface now has the static IP address you configured.
If you are unable to connect to your Raspberry Pi after setting a static IP, ensure that the IP address is within your network’s range and does not conflict with other devices.