Table of Contents

Setting a Static IP Address on Raspberry Pi

This guide will help you set a static IP address in the 192.168.1.0/24 range on your Raspberry Pi.

Prerequisites

Procedure

1. Identify Network Interface

First, identify your network interface:

ip a

Look for the interface you're using (usually eth0 for Ethernet or wlan0 for Wi-Fi).

2. Edit dhcpcd.conf File

Open the dhcpcd configuration file:

sudo nano /etc/dhcpcd.conf

3. Add Static IP Configuration

Add the following lines at the end of the file, adjusting as needed:

interface eth0  # or wlan0 for Wi-Fi
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8

4. Save and Exit

Press Ctrl+X, then Y, then Enter to save and exit.

5. Restart Networking Service

Restart the networking service to apply changes:

sudo service dhcpcd restart

6. Verify New IP Address

Check if the new IP address has been applied:

ip a

Look for your interface and confirm the new IP address.

Troubleshooting

If you encounter issues:

Additional Notes