Implementing Static IP address for Raspberry Pi?

Implementing Static IP address for Raspberry Pi

For a raspberry pi device that was configured for DHCP service in the network. What if the router has become unavailable and the device IP assignment is not done in the network. In such cases, the device will not be accessible in the network as there is no IP address available to it.

But with the help of ssh, a raspberry pi device can be accessed remotely from a remote system. This will require the IP address of a raspberry pi device to be known beforehand on. For raspberry pi running Raspbian OS from an SD card, there is a follow-up to configure the IP address is static.

1) Remove SD card and load it into an SD card reader. Now just plug a card reader into a laptop or card reader slot attached to the system. After that two partitions will be mounted on the system “/boot” and “/rootfs”. To enable ssh simply generate an empty file named ssh in the “/boot partition”

$ cd /boot

$ touch ssh

2) Locate to “etc” folder in rootfs partition. In an ubuntu terminal enter:

$ cd /rootfs/etc

3) Now edit the file dhcpcd.conf with root privileges.

$ Sudo nano dhcpcd.conf

4) Add static IP details in the file.

Check Out Our Network Security Training  

A network having an IP range of 192.168.0.x/24 is used as an example. Implementing static IP address on interface eth0 with 192.168.0.113/24 and connecting through a switch 192.168.0.60, the edited file is displayed below:

static IP

5) Save the file with these shortcut keys (CTRL+x, Press y).

6) Now just unmount both “/boot” and “/rootfs” partitions from that system
7) Plug in the SD card back to a raspberry pi board. Connect it to the network with the help of an ethernet cable. Now the device with the username “pi” is accessible through ssh from the system.

$ sudo ssh pi@192.168.0.113

Hence A Prompt will pop-up asking for a password.

About

Codec Networks provides IT Trainings from EC Council CEH ECSA, LPT, CHFI, Network Security, Penetration Testing, ISACA, ISC2, PECB ISO 27001LA LI, Cisco Networking CCNA CCNP, Linux Administration RHCE, Prog Languages JAVA, Advanced Java, android development. We also offer B2B Industry Solutions and Services in IT | Information|Cyber Security in Delhi NCR India.

View all posts by

Leave a Reply

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