How do I configure a static IP address on my Raspberry Pi?

Posts: 3
Joined: Fri Feb 28, 2020 9:05 am

How do I configure a static IP address on my Raspberry Pi?

Post »

Having followed multiple tutorials on the web, none seem to work. Can anyone explain how I set up networking/WiFi/static IP address on the Raspberry Pi?

Posts: 7
Joined: Wed Sep 12, 2018 12:26 pm

Re: How do I configure a static IP address on my Raspberry Pi?

Post »

Absolutely! Luckily, Raspberry Pi networking is pretty straightforward. First, up, make sure you're connected to the internet. The easiest way is with an Ethernet cable that you just plug in. Or, you can get connected to Wi-FI. Click the WiFi config, select Scan, choose your wireless network, and in the PSK field enter your password. When finished, hit add.

Via the command line, first run

Code: Select all

sudo apt-get update sudo apt-get upgrade sudo apt-get autoremove-/code]
Then, back up your WiFi config:  [code]sudo cp /etc/wpa_supplicant/wpa_supplicant.conf
Edit the config file with Nano (or your preferred text editor):

Code: Select all

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
And where it says "YOUR_SSID" and "YOUR_PASSWORD" enter your wireless network name and password respectively. Save and close. Once connected to the internet, find your IP address using the command line with

Code: Select all

hostname -I
Next up, locate your router's gateway

Code: Select all

ip route | grep default | awk '{print $3}'

And find your DNS server

Code: Select all

cat /etc/resolv.conf
Edit

Code: Select all

/etc/dhcpcd.conf
with

Code: Select all

sudo nano /etc/dhcpcd.conf

and enter your static IP address as the current IP or another unused IP address where it says

Code: Select all

static ip_address=
For instance:

Code: Select all

static ip_address=192.168.1.23/24
Where it says

Code: Select all

static routers=

you'll use your router address, and

Code: Select all

domain_name_servers

is the DNS address you'll find in

Code: Select all

/etc/resolv.conf