Configure Network Settings on Ubuntu (Network Manager, Systemd and Netplan) / Linux / Debian / Configure Network Settings on Ubuntu (Network Manager, Systemd and Netplan)

Modern versions of Ubuntu offer many different ways to configure network settings, and it’s easy to get confused. In this article, we will have a look at how to configure network settings in Ubuntu using Network Manager, Systemd Networkd, Netplan, and the static configuration file /etc/network/interfaces (legacy way).

How to Use Network Manager on Ubuntu?

Ubuntu’s default network management tool is Network Manager. This is a universal way to configure a network for Ubuntu desktops. NM includes a graphical and nmcli command, allowing you to conveniently work with WLAN connections, VLAN, etc.

Check that this service is running:

$ systemctl status NetworkManager

NetworkManager on LInux

The Network Manager configuration file is /etc/NetworkManager. Connection settings are stored in the system-connections directory. To configure the network parameters, you can use the nmcl command or the pseudo-graphical interface of the Network Manager TUI.

$ sudo nmtui

Network Manager TUI (nmtui) configuration tool

List network interfaces:

$ nmcli device
Network Management won’t be able to manage the device if it is set to Unmanaged.

nmcli device

List all interface network settings:

$ nmcli

nmcli - check network configuration

Specific network interface settings:

$ nmcli device show ens33

Use nmcli to configure a static IP address for the interface:

$ sudo nmcli con mod ens33 ipv4.addresses
$ sudo nmcli con mod ens33 ipv4.gateway
$ sudo nmcli con mod ens33 ipv4.dns ""

Apply network settings:

$ nmcli con up ens33

Enable/disable interface:

$ nmcli connection down my_ethernet

Ubuntu Network Configuration with systemd-networkd

With systemd, you can use the systemd-networkd service to configure your network settings. It is lighter and faster than Network Manager and is recommended for use on Ubuntu servers.

First, disable applying network settings from the /etc/network/interfaces file. Just rename the file:

$ sudo mv /etc/network/interfaces /etc/network/

The /etc/systemd/network directory contains the systemd-networkd.service configuration files.

Here you can create one of three file types:

  • *.link – sets interface physical settings (name, MAC, MTU, etc.)
  • *.network – network settings (DHCP/static IP, MAC, MTU, routes, DNS)
  • *.netdev – configure virtual interfaces (VLAN, bridges, tunnels, VPN, etc.)

Example configuration file for the eth0 interface to get network settings from the DHCP server:

$ sudo mcedit /etc/systemd/network/

If the host has more than one network interface, you can specify eth* here.

Static IP configuration example:

Description=Local network

Enable the systemd-networkd service:

$ sudo systemctl enable systemd-networkd.service
$ sudo systemctl start systemd-networkd

Check network interface status:

$ networkctl list

List network settings:

$ networkctl status

Check the systemd-networkd log:

$ journalctl -u systemd-networkd.service

Configuring Networking on Ubuntu with Netplan

Netplan adds a new layer of abstraction on top of the Ubuntu network manager. The configuration files can be found in the /etc/netplan directory.

Ubuntu Desktop has the following default config file:

$ cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
  version: 2
  renderer: NetworkManager

The renderer: NetworkManager directive specifies that Network Manager is used to manage the network.

Netplan configuration file on Ubuntu

Ubuntu Server uses networkd to manage the networking and Ubuntu Desktop uses NetworkManager.service.

To obtain the network settings from the DHCP server for the enp0s3 interface, use the configuration:

  version: 2
  renderer: networkd
      dhcp4: yes

Set static IP address:

  version: 2
  renderer: networkd
      dhcp4: no
      addresses: []
        addresses: [,]
Netplan uses the YAML format for configuration files.

Netplan allows you to check the network settings before applying them:

$ sudo netplan try

Apply new network configuration:

$ sudo netplan apply

Using /etc/network/interfaces Configuration on Ubuntu

The classic way to configure network settings in Ubuntu is to use the /etc/network/interfaces file.

In the easiest case, if you want to get all your network settings from DHCP, you need to set this here:

iface lo inet loopback
auto eth0
iface eth0 inet dhcp
  • iface – network interface name
  • inet–IPv4 protocol
  • lo – loopback interface
  • auto eth0 – enable interface on boot

If you need to set a static IP:

iface lo inet loopback 
auto eth0
iface eth0 inet static

You must restart the service after making the changes:

$ sudo systemctl restart networking.service

Use the ifup and ifdown commands to enable/disable the network interface:

$ sudo ifdown enp7s0
$ sudo ifup enp7s0
Leave a Reply

Your email address will not be published. Required fields are marked *