User Tools

Site Tools


static_ip

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

  • Raspberry Pi running Raspberry Pi OS (or other Debian-based OS)
  • SSH access or direct access to the Raspberry Pi terminal
  • Sudo privileges

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
  • Replace 192.168.1.100 with your desired IP address
  • Adjust routers and domain_name_servers if your network uses different addresses

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:

  • Double-check the dhcpcd.conf file for typos
  • Ensure the chosen IP is not in use by another device
  • Try rebooting the Raspberry Pi: sudo reboot

Additional Notes

  • This configuration sets a static IP within the Class C private address range 192.168.1.0/24
  • Ensure the chosen IP doesn't conflict with your router's DHCP range
  • Consider reserving this IP in your router's DHCP settings to prevent conflicts
static_ip.txt · Last modified: 2024/12/16 16:46 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki