Table of Contents
This tip is about the how To Setup a Static IP Address on Raspberry Pi. So read this free guide, How To Setup a Static IP Address on Raspberry Pi step by step. If you have query related to same article you may contact us.
How To Setup a Static IP Address on Raspberry Pi – Guide
In this Raspberry Pi Static IP tutorial we will show you how to configure your Raspberry Pi’s network so that it uses a static IP address. We’ll force the Pi to use a static IP by making modifications to the Raspberry Pi’s DHCP client daemon. This software controls how the operating system handles IP addresses. By modifying the DHCPCD configuration file, we can tell the software the local IP address it should use when connecting to the network. In addition to setting the static IP address on your Raspberry Pi, we recommend that you set it up on your router too.
What is an IP address?
An IP (Internet Protocol) address is used to uniquely identify each device on a computer network, or the Internet network itself, more on that later. The IP address is usually written in ‘dot-decimal’ notation: four decimal numbers, each ranging from 0 to 255, separated by dots. An example is 192.168.1.107.
By default on the Raspberry Pi OS, which is a Linux-based operating system, the Raspberry Pi’s IP address is automatically reset every time you reboot it, so it may change. Of course, this is not ideal when you need a trusted address to connect to the Raspberry Pi from another device, such as when using it as a server.
Private IP vs. public
A public IP address is used to identify your local network on the wider Internet. This usually changes every time your router connects to the internet, although you can make it static depending on your internet service provider. You can find the public IP address on a Linux system such as Raspberry Pi OS by typing a special Terminal command or simply doing a web search for ‘What is my IP?’. It’s only necessary if you intend to connect to a device outside your network, which we won’t cover here.
Instead, we are looking at the private IP addresses used to identify each device on its own local network. While it is possible to reserve a certain address for your Raspberry Pi in your wireless router settings for the same purpose, here we will show you. how to set a static IP of the Raspberry Pi itself.
DHCP configuration
hostname -I
ip r | default grep
sudo nano /etc/resolv.conf
Add static IP settings
sudo nano /etc/dhcpcd.conf
interface NETWORKstatic ip_address=STATIC_IP/24static routers=ROUTER_IPstatic domain_name_servers=DNS_IPS Replace the bolded names as follows:
Here is an example configuration to set the static IP to 192.168.1.120 with a wireless connection to a router at 192.168.1.254:
interface wlan0static ip_address=192.168.1.120/24static routers=192.168.1.254static domain_name_servers=192.168.1.254
After entering the settings, press Ctrl + X and then Y and ENTER to close and save the modified configuration file.
Restart the Raspberry Pi
sudo reboot
hostname -I
Final note
I hope you like the guide How To Setup a Static IP Address on Raspberry Pi. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.