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

1

List Network Interfaces

In the terminal, run the following command to list your network interfaces:

ip addr
2

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.

3

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

1

Open the Configuration File

Use a text editor like nano to edit the dhcpcd.conf file:

sudo nano /etc/dhcpcd.conf
2

Add Static IP Configuration

Scroll to the end of the file and add the following lines, replacing the placeholders with your actual network details:

interface <your_interface_name>
static ip_address=<desired_static_ip_address>/<subnet_mask>
static routers=<your_router_ip>

BlueOS Example:

interface eth0
static ip_address=192.168.2.2/24
static routers=192.168.2.1
3

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:

sudo reboot -h now

Verify the Static IP Configuration

After rebooting, open the terminal on the Raspberry Pi and run:

ip addr

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.