Explore. Create. Innovate

Blog details

Blog
  • user By Admin
  • calendar May 15, 2025
  • bookmark Raspberry pi
  • bookmark 0 Comments

Setting a Static IP for Your Raspberry Pi

Setting a static IP ensures your Raspberry Pi always uses the same address on your local network, making remote access and port forwarding more reliable. Follow these steps to configure a static IP:

Step 1: Identify Your Current IP Address  

Open the terminal and run:

hostname -I

This will display your Raspberry Pi’s current IP address.

Step 2: Find Your Router’s IP Address  

To get your router's IP, run:

ip r | grep default

 
The first IP in the output is your router’s gateway address.

Step 3: Get IP address of your DNS

cat /etc/resolv.conf     OR   grep "nameserver" /etc/resolv.conf

Step 4: Modify the DHCP Configuration  

Edit the DHCP client configuration file using:  

sudo nano /etc/dhcpcd.conf


Scroll to the bottom and add the following lines, replacing placeholders with actual values:  

interface [INTERFACE]
static_routers=[ROUTER IP]
static domain_name_servers=[DNS IP]
static ip_address=[STATIC IP ADDRESS YOU WANT]/24

Example:

interface eth0
static_routers=192.168.1.100/24
static domain_name_servers= 8.8.8.8
static ip_address=192.168.1.100/24

If using Wi-Fi, replace `eth0` with `wlan0`.

Step 5: Save and Apply Changes  

Press `CTRL+X`, then `Y`, and `Enter` to save the file. Restart your Raspberry Pi for the changes to take effect:  

sudo reboot

Your Raspberry Pi should now consistently use the assigned static IP address, ensuring seamless connectivity for projects requiring reliable networking. 🚀  

 

Author

Admin

Digital Marketing

Sed mi leo, accumsan vel ante at, viverra placerat nulla. Donec pharetra rutrum sed allium lectus fermentum enim Nam maximus.

Comments

You need to login to comment