How to Configure Your Linux Network Settings

Linux network settings are managed differently depending on the distribution. On Ubuntu desktop and most modern systems, NetworkManager handles network configuration — use the graphical network settings, nmcli in the terminal, or nmtui for a terminal UI. For servers and static IP configuration on Ubuntu 18.04+, Netplan YAML files in /etc/netplan/ define network settings. The ip command shows current network state (ip addr for addresses, ip route for routing), while nmcli both shows and modifies NetworkManager-controlled connections.

Networks Are How Linux Connects to Everything

A Linux system without network configuration is an island. Whether you are configuring a desktop to connect to Wi-Fi, setting a static IP address on a server so other machines can reliably reach it, troubleshooting why a newly installed system cannot reach the internet, or setting up a complex multi-interface server configuration — understanding how Linux handles network settings is an essential skill.

Network configuration in Linux has layers of complexity that can initially seem confusing. The same Ubuntu system might use NetworkManager for desktop wireless connections but Netplan for server static IP configuration. The ip command gives you the current state but does not persist changes across reboots. Different distributions use different tools with similar capabilities. And the ecosystem has been in active transition, with older tools (ifconfig, /etc/network/interfaces) giving way to newer ones (ip, Netplan, NetworkManager CLI) over the past decade.

This article cuts through that complexity by organizing network configuration into clear layers: the tools for checking current network state, the tools for making temporary changes, the tools for making permanent changes, and the differences between desktop (NetworkManager) and server (Netplan/systemd-networkd) approaches. By the end, you will be able to check your current network configuration, understand what you see, make changes that survive reboots, and troubleshoot common network configuration problems.

Understanding Linux Network Interfaces

Before configuring anything, understanding how Linux names and tracks network interfaces is essential.

What Is a Network Interface?

A network interface is the software representation of a network connection point — either a physical hardware adapter (Ethernet port, Wi-Fi card) or a virtual connection (VPN tunnel, bridge, loopback). Each interface has:

  • A name — used to reference it in configuration
  • An IP address (or multiple) — the network address assigned to it
  • A MAC address — the hardware address (for physical interfaces)
  • A state — up (active) or down (inactive)
  • Statistics — bytes sent and received, errors, dropped packets

Interface Naming Conventions

Modern Linux uses predictable network interface names that encode the hardware location rather than simple sequential names. This ensures an Ethernet port always has the same name regardless of what other hardware is installed:

  • enp3s0 — Ethernet (en), PCI bus 3 (p3), slot 0 (s0)
  • eno1 — Ethernet (en), onboard (o), index 1
  • wlp4s0 — Wireless LAN (wl), PCI bus 4 (p4), slot 0 (s0)
  • wlan0 — older-style wireless interface name
  • eth0 — older-style Ethernet name (still used in VMs and containers)
  • lo — loopback interface (always lo, always 127.0.0.1)

The old names (eth0, wlan0) were sequential and could change if you added or removed hardware. The new predictable names are stable regardless of hardware changes.

Checking Current Network Configuration

Before making changes, understand the current state.

ip addr: IP Addresses and Interface Status

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether a4:c3:f0:12:34:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic noprefixroute enp3s0
       valid_lft 86394sec preferred_lft 86394sec
    inet6 fe80::a6c3:f0ff:fe12:3456/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether bc:d0:74:78:9a:bc brd ff:ff:ff:ff:ff:ff

Reading ip addr output:

  • state UP / state DOWN — whether the interface is active
  • inet 192.168.1.105/24 — IPv4 address with prefix length (24 = subnet mask 255.255.255.0)
  • dynamic — address was assigned by DHCP (not static)
  • link/ether a4:c3:f0:12:34:56 — MAC address
  • inet6 fe80::... — IPv6 link-local address

Short summary view:

$ ip -br addr
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp3s0           UP             192.168.1.105/24 fe80::a6c3:f0ff:fe12:3456/64
wlp4s0           DOWN

ip route: Routing Table

$ ip route
default via 192.168.1.1 dev enp3s0 proto dhcp src 192.168.1.105 metric 100
192.168.1.0/24 dev enp3s0 proto kernel scope link src 192.168.1.105

$ ip route show default
default via 192.168.1.1 dev enp3s0 proto dhcp src 192.168.1.105

The routing table determines how traffic is directed. The default route (0.0.0.0/0) is your gateway — the router that handles traffic for all addresses not explicitly listed. Here, 192.168.1.1 is the gateway.

ip link: Interface Hardware Status

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ...
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
3: wlp4s0: <BROADCAST,MULTICAST> mtu 1500 ...

$ ip link show enp3s0     # Specific interface

Connectivity Testing

$ ping -c 4 8.8.8.8          # Test connectivity to Google DNS
$ ping -c 4 google.com       # Test DNS resolution + connectivity
$ traceroute google.com      # Trace network path (install: sudo apt install traceroute)
$ curl -I https://example.com  # Test HTTPS connectivity

DNS Configuration

$ cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad

$ resolvectl status           # systemd-resolved DNS details
Global
  Current DNS Server: 192.168.1.1
         DNS Servers: 192.168.1.1 8.8.8.8

$ resolvectl query google.com  # Test DNS resolution
google.com: 142.250.80.46

NetworkManager: Desktop Network Management

What NetworkManager Is

NetworkManager is the standard network management service on desktop Linux distributions — Ubuntu, Fedora, Debian desktop, openSUSE, and most others. It handles:

  • Connecting to and managing Wi-Fi networks
  • Wired Ethernet connections (DHCP or static)
  • VPN connections
  • Mobile broadband connections
  • Automatic connection management (reconnecting when a cable is plugged in)

NetworkManager stores connection profiles as files in /etc/NetworkManager/system-connections/. Each profile contains the settings for one network connection.

NetworkManager Graphical Interface

On desktop systems, network configuration through the GUI is the most straightforward approach:

  • GNOME: Click the top-right corner → click the network/Wi-Fi section → Settings opens the full network configuration
  • KDE Plasma: System Tray → Networks applet → Network Settings
  • XFCE/others: Network Manager applet in the panel

The graphical interface handles the most common tasks: connecting to Wi-Fi, managing saved connections, and configuring static IP addresses.

nmcli: NetworkManager Command-Line Interface

nmcli is the full-featured command-line tool for NetworkManager. It can do everything the graphical interface can do and more.

Show device status:

$ nmcli device status
DEVICE      TYPE      STATE      CONNECTION
enp3s0      ethernet  connected  Wired connection 1
wlp4s0      wifi      connected  HomeNetwork
lo          loopback  unmanaged  --

Show all connection profiles:

$ nmcli connection show
NAME                UUID                                  TYPE      DEVICE
Wired connection 1  a1b2c3d4-e5f6-7890-abcd-ef1234567890  ethernet  enp3s0
HomeNetwork         b2c3d4e5-f6a7-8901-bcde-f01234567891  wifi      wlp4s0
WorkVPN             c3d4e5f6-a7b8-9012-cdef-012345678912  vpn       --

Show details of a connection:

$ nmcli connection show "Wired connection 1"
connection.id:                          Wired connection 1
connection.type:                        802-3-ethernet
ipv4.method:                            auto
ipv4.addresses:                         --
IP4.ADDRESS[1]:                         192.168.1.105/24
IP4.GATEWAY:                            192.168.1.1
IP4.DNS[1]:                             192.168.1.1

Connect to a Wi-Fi network:

$ nmcli device wifi list                        # Scan for networks
$ nmcli device wifi connect "NetworkName" password "yourpassword"

Bring an interface up or down:

$ nmcli device connect enp3s0
$ nmcli device disconnect wlp4s0

Restart a connection:

$ nmcli connection down "Wired connection 1"
$ nmcli connection up "Wired connection 1"

Setting a Static IP Address with nmcli

To configure a static IP address through NetworkManager:

$ nmcli connection modify "Wired connection 1" \
    ipv4.method manual \
    ipv4.addresses "192.168.1.200/24" \
    ipv4.gateway "192.168.1.1" \
    ipv4.dns "8.8.8.8,8.8.4.4"

$ nmcli connection down "Wired connection 1"
$ nmcli connection up "Wired connection 1"

Key parameters:

  • ipv4.method manual — use a static IP (vs auto for DHCP)
  • ipv4.addresses "192.168.1.200/24" — the IP address and subnet mask
  • ipv4.gateway "192.168.1.1" — the default gateway (your router)
  • ipv4.dns "8.8.8.8,8.8.4.4" — DNS servers

Revert to DHCP:

$ nmcli connection modify "Wired connection 1" ipv4.method auto ipv4.addresses "" ipv4.gateway "" ipv4.dns ""
$ nmcli connection up "Wired connection 1"

nmtui: Terminal User Interface for NetworkManager

nmtui provides an interactive text-based menu system for NetworkManager — easier than nmcli syntax for occasional use, works without a graphical desktop:

$ nmtui

A menu appears in the terminal with options:

  • Edit a connection
  • Activate a connection
  • Set system hostname

Navigate with arrow keys, select with Enter. nmtui is the recommended tool for server environments where you want a friendly interface without the full graphical desktop.

Netplan: Ubuntu Server Network Configuration

What Netplan Is

Netplan was introduced in Ubuntu 17.10 as a unified network configuration system for Ubuntu servers and cloud instances. Rather than writing configuration for a specific network management backend, you write YAML files in /etc/netplan/ and Netplan translates them to the appropriate backend configuration (typically systemd-networkd on servers, NetworkManager on desktops).

Netplan is the right tool for:

  • Ubuntu server static IP configuration
  • Cloud instance networking
  • Complex multi-interface server configurations

Netplan Configuration Files

Netplan configuration files live in /etc/netplan/ and use YAML format:

$ ls /etc/netplan/
00-installer-config.yaml

$ cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp3s0:
      dhcp4: true
  version: 2

This simple configuration enables DHCP on enp3s0.

Configuring a Static IP with Netplan

To set a static IP address on an Ubuntu server:

$ sudo nano /etc/netplan/00-installer-config.yaml

Replace the content with:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 192.168.1.200/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
      dhcp4: false

Apply the configuration:

$ sudo netplan apply

Or test it first (reverts automatically after 120 seconds if you do not confirm):

$ sudo netplan try

netplan try is safety-critical: if your configuration breaks network connectivity, it automatically rolls back after 2 minutes, preventing you from locking yourself out of a remote server.

Configuring Multiple Interfaces with Netplan

A server with two Ethernet interfaces — one for management, one for data:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 192.168.1.200/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      dhcp4: false
    enp4s0:
      addresses:
        - 10.0.0.5/24
      dhcp4: false

Netplan YAML Indentation Warning

YAML is whitespace-sensitive — incorrect indentation causes configuration failures. Use spaces (not tabs) and be consistent. Validate your configuration:

$ sudo netplan generate    # Generate backend config without applying

If there are YAML syntax errors, netplan generate reports them before anything changes.

Temporary Network Changes with the ip Command

The ip command makes changes to the current network state. These changes are immediate but not persistent — they are lost on reboot. Use ip for:

  • Testing configurations before making them permanent
  • Temporary fixes while troubleshooting
  • Scripts that manage network state dynamically

Adding and Removing IP Addresses

$ sudo ip addr add 192.168.1.210/24 dev enp3s0    # Add IP address
$ sudo ip addr del 192.168.1.210/24 dev enp3s0    # Remove IP address

Bringing Interfaces Up and Down

$ sudo ip link set enp3s0 up      # Bring interface up
$ sudo ip link set enp3s0 down    # Bring interface down

Managing Routes

$ sudo ip route add default via 192.168.1.1 dev enp3s0    # Add default gateway
$ sudo ip route del default                                  # Remove default gateway
$ sudo ip route add 10.0.0.0/8 via 192.168.1.254            # Add static route
$ sudo ip route del 10.0.0.0/8                               # Remove static route

Flushing IP Addresses

$ sudo ip addr flush dev enp3s0    # Remove all IPs from interface

systemd-networkd: Lightweight Server Networking

On minimal Ubuntu and Debian server installations (or when Netplan uses renderer: networkd), systemd-networkd directly manages network interfaces. Configuration files live in /etc/systemd/network/:

$ sudo nano /etc/systemd/network/10-enp3s0.network
[Match]
Name=enp3s0

[Network]
Address=192.168.1.200/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4

Apply changes:

$ sudo systemctl restart systemd-networkd
$ sudo systemctl enable systemd-networkd    # Ensure it starts at boot

On Ubuntu server with Netplan, you typically configure via Netplan YAML rather than directly writing .network files — Netplan generates the correct .network files from your YAML configuration.

Wi-Fi Configuration

Connecting to Wi-Fi via nmcli

$ nmcli device wifi list                           # Scan for available networks
IN-USE  BSSID              SSID             MODE   CHAN  RATE        SIGNAL
*       AA:BB:CC:DD:EE:FF  HomeNetwork      Infra  6     540 Mbit/s  75
        11:22:33:44:55:66  NeighborWifi     Infra  11    270 Mbit/s  45

$ nmcli device wifi connect "HomeNetwork" password "mypassword"
Device 'wlp4s0' successfully activated with 'uuid'.

Connecting to Hidden Wi-Fi Networks

$ nmcli device wifi connect "HiddenNetworkName" password "mypassword" hidden yes

Listing Saved Wi-Fi Connections

$ nmcli connection show --active
$ nmcli connection show | grep wifi

Forgetting a Wi-Fi Network

$ nmcli connection delete "NetworkName"

Network Troubleshooting Essentials

Systematic Connectivity Diagnosis

When network connectivity fails, work through the layers:

Layer 1: Is the interface up?

$ ip link show enp3s0
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
# UP and LOWER_UP = cable connected and interface active
# If no UP: sudo ip link set enp3s0 up

Layer 2: Does the interface have an IP address?

$ ip addr show enp3s0
# If no inet line: DHCP may have failed
# Force DHCP renewal: sudo dhclient enp3s0

Layer 3: Is the gateway reachable?

$ ip route show default
default via 192.168.1.1 dev enp3s0

$ ping -c 3 192.168.1.1    # Can you reach your router?

Layer 4: Is DNS working?

$ ping -c 3 8.8.8.8        # Can you reach internet IP? (bypasses DNS)
$ ping -c 3 google.com     # Can you resolve names? (uses DNS)

If IP ping works but name ping fails, DNS is the problem.

Layer 5: Check for firewall blocks:

$ sudo ufw status          # Ubuntu Uncomplicated Firewall status
$ sudo iptables -L -n      # Detailed iptables rules

Useful Diagnostic Commands

$ ss -tlnp                 # Show listening TCP ports and their processes
$ ss -ulnp                 # Show listening UDP ports
$ netstat -rn              # Routing table (older tool, still widely available)
$ nmap -sP 192.168.1.0/24  # Scan local network for active hosts (install: sudo apt install nmap)
$ mtr google.com           # Combined ping + traceroute (install: sudo apt install mtr)

Quick Reference: Linux Network Commands

Checking Network State

Task Command
Show IP addresses ip addr or ip -br addr
Show routing table ip route
Show interfaces ip link show
Show gateway ip route show default
Show DNS config resolvectl status
Test connectivity ping -c 4 8.8.8.8
Test DNS ping -c 4 google.com
Show listening ports ss -tlnp

NetworkManager (Desktop/nmcli)

Task Command
Show devices nmcli device status
Show connections nmcli connection show
Connect to Wi-Fi nmcli device wifi connect "SSID" password "pass"
Set static IP nmcli connection modify "name" ipv4.method manual ipv4.addresses "IP/mask" ipv4.gateway "GW"
Revert to DHCP nmcli connection modify "name" ipv4.method auto
Restart connection nmcli connection down "name" && nmcli connection up "name"
Terminal UI nmtui

Netplan (Ubuntu Server)

Task Command
Apply configuration sudo netplan apply
Test configuration sudo netplan try
Validate YAML sudo netplan generate
Edit config sudo nano /etc/netplan/00-*.yaml

Temporary Changes (ip)

Task Command
Add IP address sudo ip addr add 192.168.1.200/24 dev enp3s0
Remove IP address sudo ip addr del 192.168.1.200/24 dev enp3s0
Add default gateway sudo ip route add default via 192.168.1.1
Enable interface sudo ip link set enp3s0 up
Disable interface sudo ip link set enp3s0 down

Conclusion: Layers of Linux Networking

Linux network configuration has more tools and approaches than Windows or macOS, but this reflects genuine flexibility rather than poor design. Desktop users get the seamless experience of NetworkManager with graphical or nmcli control. Server administrators get the precise, declarative YAML of Netplan or the direct control of systemd-networkd. Anyone needing temporary changes or diagnostics uses the ip command suite.

The key mental model: the ip command shows and modifies current runtime state (lost on reboot); NetworkManager, Netplan, and systemd-networkd manage persistent configuration (survives reboots). For any network configuration task, the question is: which layer am I working at, and which tool owns that layer on this system?

Once you have answered that question, the specific commands follow naturally. And when something goes wrong, the systematic troubleshooting approach — check interface, check IP, check gateway, check DNS, check firewall — gives you a reliable path to diagnosing any connectivity problem regardless of which tools configured it.

Hot this week

What Are Snap, Flatpak, and AppImage Packages?

Learn what Snap, Flatpak, and AppImage are, how universal Linux packages work, their differences, pros and cons, and when to use each format for installing software.

How to Change Your Desktop Environment in Linux

Learn how to install and switch desktop environments in Linux — from GNOME to KDE Plasma, XFCE, MATE, Cinnamon, and more. Includes installation steps and how to choose the right DE.

Understanding Linux System Directories: What Goes Where?

Learn the Linux filesystem hierarchy — what each directory like /etc, /var, /usr, /home, /tmp, /proc, and /dev contains and why the system is organized this way.

What Is a Symbolic Link in Linux?

Learn what symbolic links (symlinks) are in Linux, the difference between soft and hard links, how to create them with ln, and practical uses for symlinks in system administration.

How to Mount and Unmount Drives in Linux

Learn how to mount and unmount drives, USB drives, and partitions in Linux using the mount command, /etc/fstab for persistent mounts, and how to safely eject external drives.

Topics

What Are Snap, Flatpak, and AppImage Packages?

Learn what Snap, Flatpak, and AppImage are, how universal Linux packages work, their differences, pros and cons, and when to use each format for installing software.

How to Change Your Desktop Environment in Linux

Learn how to install and switch desktop environments in Linux — from GNOME to KDE Plasma, XFCE, MATE, Cinnamon, and more. Includes installation steps and how to choose the right DE.

Understanding Linux System Directories: What Goes Where?

Learn the Linux filesystem hierarchy — what each directory like /etc, /var, /usr, /home, /tmp, /proc, and /dev contains and why the system is organized this way.

What Is a Symbolic Link in Linux?

Learn what symbolic links (symlinks) are in Linux, the difference between soft and hard links, how to create them with ln, and practical uses for symlinks in system administration.

How to Mount and Unmount Drives in Linux

Learn how to mount and unmount drives, USB drives, and partitions in Linux using the mount command, /etc/fstab for persistent mounts, and how to safely eject external drives.

Understanding the Linux Man Pages: Your Built-in Documentation

Learn how to use Linux man pages to look up any command, understand its options, and navigate the built-in documentation system. Includes man, info, apropos, and whatis.

How to View Running Processes in Linux

Learn how to view and manage running processes in Linux using ps, top, htop, pgrep, and pstree. Understand process states, PIDs, CPU/memory usage, and how to find and kill processes.

What Is BASH? Understanding the Linux Shell

Learn what Bash is, how the Linux shell works, the difference between the terminal and the shell, Bash features every user should know, and how to customize your shell environment.

Related Articles

Popular Categories