Raspberry Pi
  •  A static IP address is the opposite of a dynamic IP address and it’s doesn’t change.
  • To access raspberry pi with other devices over a long period of time and it’s needing a static IP address.
  • using the below command to check whether DHCPCD is already activated or not.

Command: sudo service dhcpcd status

  • Here DHCPCD was activated. but if DHCPCD is not activated and follows the below commands.

Command: sudo service dhcpcd start

Command: sudo systemctl enable dhcpcd

  • Confirm the original status of the configuration of the file /etc/network/interfaces. the ‘iface’ configuration needs to be set at ‘manual’ for the interfaces.
  • after a dhcpcd activation, run the below command to edit the dhcpcd.conf configuration file to set up a static IP address for your Raspberry Pi.

Command: sudo nano /etc/dhcpcd.conf

  • The type of network connection is:

wlan0 – Raspberry Pi is connected to the router wirelessly.

eth0 – Raspberry Pi connected using an Ethernet cable.

  • Scroll down to the bottom of the file and add below file.

 interface wlan0 // for wifi connection. 

 static ip_address=192.168.0.XXX/24 // To change “X” value only. 

 static routers= 

 static domain_name_servers= 

  • To exit the editor, press “ctrl+x” and press the letter “Y” then hit enter.
  • Now reboot a raspberry pi, and everything should be set.

Command: sudo reboot

  • The new static IP address is assigned to the Raspberry Pi from the dhcpcd.conf file.
  • Use the below command to check that it is working correctly.

Command: ifconfig

ip address

  • now the new static IP address is assigned to the raspberry pi.
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *