Updated June 2026: Added permanent configuration methods via Netplan and NetworkManager, modern interface naming, and removed references to the deprecated ifconfig command.

The quick way — ip addr add

To temporarily assign an IP address to a network interface:

ip addr add 192.168.1.100/24 dev enp3s0
ip link set enp3s0 up

Replace 192.168.1.100/24 with your IP and prefix length, and enp3s0 with your interface name.

Important: this change is temporary — it is lost on reboot. See below for how to make it permanent.

Find your interface name

Modern Linux uses predictable interface names instead of the old eth0/eth1 style. List your interfaces with:

ip link show

Common patterns: enp3s0, ens3, eth0 (some VMs still use this), wlp2s0 (Wi-Fi).

View current addresses

ip addr show

Or for a specific interface:

ip addr show dev enp3s0

Short form: ip a

Remove an address

ip addr del 192.168.1.100/24 dev enp3s0

About ifconfig

ifconfig was the classic tool for this, but it has been removed from most modern Linux distributions. The ip command from the iproute2 package is the current standard. If ifconfig is not found on your system, that is expected.


Make it permanent — Netplan (Ubuntu 18.04+, Debian)

Ubuntu and many Debian-based systems use Netplan for network configuration. Files live in /etc/netplan/.

Edit or create a config file (the exact filename varies — check what exists in /etc/netplan/):

sudo nano /etc/netplan/01-netcfg.yaml

Static IP example:

network:
  version: 2
  ethernets:
    enp3s0:
      addresses:
        - 192.168.1.100/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

Apply the configuration:

sudo netplan apply

Make it permanent — NetworkManager (nmcli)

On systems using NetworkManager (most desktop distros, RHEL, Fedora, Rocky Linux):

nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8 1.1.1.1"
nmcli con mod "Wired connection 1" ipv4.method manual
nmcli con up "Wired connection 1"

Replace "Wired connection 1" with the actual connection name from nmcli con show.

To check what connections exist:

nmcli con show