Home Raspberry Pi How to: Raspberry PI static IP & Terminal network setup

How to: Raspberry PI static IP & Terminal network setup

No need for a keyboard, screen or mouse. Just the terminal access.

Since the Raspberry Pi Jessie update, my older guide on networking became outdated. This Raspberry PI static IP guide should explain the changes and allow you to set the raspberry pi again within your network. While this guide is valid on its own, I would recommend you to read the 4 step setup guide: How to connect RPI to a PC. It will take you only extra 5 min, and you won’t be confused about my IP number choices in the Ethernet setup.

Raspberry PI static IP guide

First of all, there is no need to modify the interfaces.d file anymore. The config should be OK for the majority of the cases. There are other files responsible for the Ethernet and WIFI set up. If you already played with this file and you wish to restore it to the default config please use this configuration:

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

WIFI config from a Terminal

Raspberry PI static IP

You no longer have to modify the interfaces.d file to connect to the WIFI. The config for this is included in the file:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

The setup is fairly straightforward, copy the file details below and fill in the SSID and PASSWORD with the relevant details (keep “” symbols). Save the file and reboot your RPI if the changes have not been applied automatically. Multiple SSIDs can be added in a similar fashion. The template below contains 2 entries. Each one is responsible for a different SSID.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev



Static IP

Static IP can be assigned to both interfaces eth0 (ethernet) and wlan0 (WIFI), you can benefit from having a fixed IP for each interface. This will make it easier to forward the ports and find your device on the network. Find the interface names using:


Bear in mind that interface names have changed since Raspbian Stretch and to get the old names back again you have to follow the steps from this guide. Both interfaces can be configured in the same file. Navigate to:

sudo nano /etc/dhcpcd.conf

and edit the files accordingly. If you want to assign the static IP to both interfaces just type one interface after another.

Ethernet manual DHCP

For this example, I will be using my preconfigured PC (see the guide), if you are using a router, just use the router’s respective values. Otherwise, make sure your PC’s IPv4 is also configured in a similar way.

To check what IP addresses you have linked to each interface use:

ip -4 addr show dev eth0 | grep inet
ip -4 addr show dev wlan0 | grep inet

# Custom static IP address for eth0
interface eth0 
static ip_address= 
static routers= 
static domain_name_servers=

The static ip_address should be the same one you have used in the previous guide. This is the IP of your Raspberry PI. The is the IP of the PC which acts as a router.

WIFI manual DHCP

In the similar fashion static IP is assigned to the WIFI connection.

# Custom static IP address for wlan0
interface wlan0 
static ip_address= 
static routers= 
static domain_name_servers=

The static ip_address is the IP you want your Raspberry Pi to have (pick any not used on the network). This is the IP of your Raspberry Pi. The is the IP of my router.

In both cases, it is recommended that you reserve the chosen IP on your router (or manually assign it to the PC if you are connecting to one instead) to preventing other devices highjacking the lease when the device is offline.
Log in to your router, go to the DHCP settings and reserve the IP of the RPI for the WIFI and wired connections. If you’ve followed the 4 step guide, you may now delete the IP value from the cmdline.txt on the SD card.

And you can start playing with services that require your Raspberry to have a static IP address.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency


Add an SSD to Raspberry Pi 4 and turn it into a super-cooled NAS drive.

More HATs

Argon One

Enclose Raspberry Pi 4 inside this great case with custom I/O, cooling and GPIO

More cases on

Best Raspberry Pi Projects

How to use Raspberry PI as WOL (wake on lan) server

While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

Free wireless doorbell (Amazon Dash button hack)

The most terrifying situation I can imagine* is missing a parcel

Raspberry Pi NAS: (NAS-pi) Modding like a boss #part2

Plex and RAID1 NAS drive build log

MagPi – auto-downloader

Grab each edition of Mag Pi as soon as possible!


How to boot Raspberry Pi 4 from USB

How to set up and boot Raspberry Pi 4 from USB drive - headless guide.

Raspberry Pi Zero, Raspberry Pi 3A+ WiFi without keyboard or cables

Getting Raspberry Pi boards connected in seconds

Everything you need to start using JSON

It's JSON not Jason, just saying!

How to use Join App in NodeRED

The day finally comes where Join app is almost everywhere!

Driving LCD with Arduino and Raspberry Pi

Displaying things on an LCD screen is as easy as going through a cup of jellybeans while writing this tutorial!