How to give your Raspberry Pi a Static IP Address
This small guide is mostly to accompany my other guide on how to turn your Raspberry Pi into an Alexa Smart Device, however, this may come of use to you if you’re falling upon this blog post!
I’ll try and make this as easy as possible to follow, generally speaking, the configuration for this will be the same across all Raspberry Pi versions in the future, but I will update this should I need to in the future.
To start with, you’ll want to open “Terminal”, or SSH (On a remote computer). Run the following command:
sudo nano /etc/dhcpcd.conf
From here, scroll to the bottom (Hold down on the Keyboard). The last line may say “nohook lookup-hostname”.
Copy and Paste the following, changing the details of the bolded numbers to the static IP you wish to keep:
The routers= and domain_name_servers= would both equal the IP of your router if you live at home. Otherwise, the name_servers is the IP of your DNS records and the routers are the IP of your gateway.
You will need to keep the /24 at the end of the ip_address.
From here, press ctrl + x and then press Y to save changes. Simply reboot your Pi after and your Static IP will be done!
If you wish to check this, open Terminal again and type the following: