Setup a Raspberry Pi Static IP Address

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

Recommended

  • 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 8.8.8.8 for Google, or 1.1.1.1 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).

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

• ROUTER_IP –
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


Comments

  1. This post is really awesome. Genuinely i like this blog. It gives me more useful information. I hope you share lots of things with us .lp mailers

    ReplyDelete

Post a Comment

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6