If you want to set the IP Address of Your Raspberry Pi So that it does not change. So in this post i am telling to you How To Setup Static IP Address on Raspberry Pi. This is simple, You need to edit the configuration file /etc/network/interfaces.
To edit this file, type the following command:
$ sudo nano /etc/network/interfaces
You may like also: How To Use Raspberry pi in a truely headless mode
How To Setup Static IP Address on Raspberry Pi
First decide on an IP address to use. You need to pick one that is both unused by any other machine on the network and within the allowed range of IP addresses for your home hub. In this case, I will use 192.168.168.115. Modify the contents of the file, changing the word dhcp to static.
With the file changed as shown here, the static IP address 192.168.1.115 has been assigned to the eth0 interface.
iface lo inet loopback
iface eth0 inet static
iface wlan0 inet manual
iface default inet dhcp
For most networks, the netmask setting should be set to 255.255.255.0 and the gateway should be the IP address of your home router irself. This will be the same as the IP Address you use to connect to the admin console of your router. After you edit and save the file, run the following commands to clear out all the existing DHCP leases, and restart your Pi so that changes will take effect.
$ sudo rm /var/lib/dhcp/*
$ sudo reboot
You may like also:
- How To Create Secure MQTT Broker
- Simple Raspberry Pi Home Security System
- Using Mq135 Sensor with InfluxDB
- Best OS for Raspberry Pi
- ROCK Pi 4 : Overview | Installation
- Remote control your Raspberry Pi from your PC with VNC!
- How To Use Raspberry pi in a truely headless mode