Setup a Raspberry Pi Static IP Address

 In this tutorial, I use Raspbian operating system. How to setup a Raspberry Pi Static IP Address.


  • Raspberry Pi
  • Micro SD Card
  • Power Supply
  • Ethernet Cord or WiFi dongle (The Pi 3 and 4 has WiFi inbuilt)

Step 1: we will first need to retrieve some information about your network

ip r | grep default
Step 2: Retrieve the current DNS server and opening up the “resolv.conf” configuration file
sudo nano /etc/resolv.conf
Setting nameserver alternative DNS – such as for Google, or for Cloudflare.

Step 3: modify the way the Raspberry Pi handles the network.
sudo nano /etc/dhcpcd.conf
Add lines as below:
interface <NETWORK>
static ip_address=<STATICIP>/24
static routers=<ROUTERIP>
static domain_name_servers=<DNSIP>

• NETWORK – your network connection type: eth0 (Ethernet) or wlan0 (wireless).

the static IP address you want to set for the Raspberry Pi.

the gateway IP address for your router on the local network.

• DNS_IP –
the DNS IP address (typically the same as your router’s gateway address).

Now save the file by pressing CTRL + X then Y followed by ENTER.

Step 4: Restarting the Raspberry Pi
sudo reboot

Test new static IP address.

hostname -I


Popular posts from this blog

zimbra some services are not running [Solve problem]

How to install php7 on centos 6

Bash script list all IP addresses connected to Server