Define a Static IP Address for a Device or Machine in a Linux Environment

R1CH4RD5
1 min readJan 29, 2022

In this small article we will briefly show how to define a static IP address for a device or machine environment like a Raspberry Pi device or computer.

Having the device or machine fully configured and ready to go, open a terminal and execute the following to open the configuration document for DHCP the options:

sudo nano /etc/dhcpcd.conf

Before proceeding, we need to consider some valid points like:

  • ip_address the chosen static IP and type / subnet mask.
  • routers the default router/access point IP in the same type.
  • domain_name_servers the domain IP’s.

At the final of the document add the following block of data to define the static IP for the respective device or machine to the wlan0 interface:

# Static IP for WIFI
interface wlan0
static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8

After everything completed, reboot safely and check the respective IP for the wlan0 interface by executing the ip addr command on a terminal.

Hope you liked this small article, best regards, Ricardo Costa (Richards).

--

--