28

I am learning to use netplan. When writing a YAML configuration file I need to know which renderer to use, either NetworkManager or networkd.

How do I know if I am running NetworkManager or networkd?

  • 1
    What does this suggest? `sudo service network-manager status` – chili555 May 03 '18 at 20:44
  • 1
    On my Ubuntu 18.04 Desktop the output is suggesting that Network Manager is used. On my Ubuntu 18.04 Server the output is "`Unit network-manager.service could not be found`". Is this really the only way to determine which networking daemon that is beeing used? –  May 04 '18 at 05:54
  • No; see my answer in a few minutes. – chili555 May 04 '18 at 14:15
  • although `network-manager.service could not be found` was what I got, NetworkManager.service was to be found and apparently they are the same: https://askubuntu.com/questions/1031439/am-i-running-networkmanager-or-networkd?newreg=699d61928a9b46e294d2f0bdba3588fc#comment1678036_1031439 – curiouser Jan 16 '21 at 01:59

3 Answers3

29

As near as I can tell, there have been 3 approaches to networks in Linux:

1) The oldest uses the /etc/network/interfaces file and ifup/ifdown scripts to manage these interfaces.

2) After that came the network-manager daemon (often written Network-Manager) which has GUI interfaces available.

3) And most recently the systemd-networkd daemon (sometimes abbreviated just 'networkd') which is based on systemd unit files.


To see how your network is being managed, first you must know if you're system is initializing with systemd or the older init as it's first process. (Debian and Ubuntu, for example now use systemd instead of init).

You can check if your system uses systemd with this:

pidof systemd     &&  echo "systemd"  || echo "other"

So if you are NOT running systemd, then clearly you can rule out systemd-networkd.

If you ARE running systemd, then check which network service daemons are running with these two commands:

sudo service systemd-networkd status
sudo service network-manager  status   # before Ubuntu V21.10
sudo service NetworkManager   status   # after  Ubuntu V21.10!

You'll see either Active: active (running) or Active: inactive (dead) reported for each one.

Note that you can also run these newer commands, but obviously if you don't have systemd, they won't work for you:

systemctl status systemd-networkd
systemctl status network-manager   # before Ubuntu V21.10
systemctl status NetworkManager    # after  Ubuntu V21.10!

But you're not done yet...

Finally, even if one of these two daemons are running, that doesn't mean your network hardware interfaces are being managed by them, as there are exceptions.

First any interfaces defined in /etc/network/interfaces are ignored by the network-manager package. (man 5 NetworkManager)

Next, systemd-networkd will only manage network addresses and routes for any link for which it finds a .network file with an appropriate [Match] section. (man 8 systemd-networkd).


! Ref: Service name change occurred: from network-manager to NetworkManager.

Elliptical view
  • 1,522
  • 17
  • 17
18

By default, Ubuntu desktop version ships with Network Manager. In most desktop environments, it does a good job. In this case, the netplan file should hand over networking to Network Manager. Typically, the relevant file is /etc/netplan/01-network-manager-all.yaml It reads:

    # Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

In Ubuntu server edition, since no desktop environment is installed by default; i.e. Gnome, Unity, Wayland, KDE, etc., Network Manager is not possible and therefore not installed. In versions 17.10 and later, networking is handled by netplan alone. The typical relevant file is /etc/netplan/01-netcfg.yaml It usually reads:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: yes

...where enp0s3 is your relevant interface. This will allow an internet connection by DHCP until a full and further configuration can be effected by editing the yaml file and following with:

sudo netplan apply 
chili555
  • 58,968
  • 8
  • 93
  • 129
  • 1
    Thank you for you answer. Regarding "In versions 17.10 and later, networking is handled by netplan alone.", isn't it handled by netplan together with networkd and not netplan alone? –  May 04 '18 at 15:56
  • netplan instead of the earlier `/etc/network/interfaces`. Both have many supporting bits and pieces but the files I mention here are all that need be used to effect networking. – chili555 May 04 '18 at 16:53
  • 2
    "since no desktop environment is installed [ ... ] Network Manager is not possible" well CentOS is doing just fine with `nmcli` and `nmtui` on servers, so definitely possible. – kubanczyk Nov 29 '19 at 14:50
  • @kubanczyk `nmcli` is certainly possible here; however, why does one need it? Set your details in netplan and be done. – chili555 Nov 29 '19 at 15:20
1

Since Feb 2023, Netplan release 0.106, netplan status has been introduced, which pretty prints a lot of information, including the currently used renderer. The output below is taken from a bare Ubuntu 23.04 installation:

$ netplan status
     Online state: online
    DNS Addresses: 127.0.0.53 (stub)
       DNS Search: <redacted>

●  1: lo ethernet UNKNOWN/UP (unmanaged)
      MAC Address: 00:00:00:00:00:00
        Addresses: 127.0.0.1/8
                   ::1/128
           Routes: ::1 metric 256

●  2: enp0s1 ethernet UP (networkd: enp0s1)
      MAC Address: <redacted> (<redacted>)
        Addresses: 192.168.64.2/24 (dhcp)
                   fd88:4b93:b031:f03e:80f0:d4ff:fe4f:15d3/64
                   fe80::80f0:d4ff:fe4f:15d3/64 (link)
    DNS Addresses: 192.168.64.1
                   fe80::6c7e:67ff:fe8c:8364
       DNS Search: <redacted>
           Routes: default via 192.168.64.1 from 192.168.64.2 metric 100 (dhcp)
                   192.168.64.0/24 from 192.168.64.2 metric 100 (link)
                   192.168.64.1 from 192.168.64.2 metric 100 (dhcp, link)
                   fd88:4b93:b031:f03e::/64 metric 100 (ra)
                   fe80::/64 metric 256

You can see that the main NIC enp0s1 is being managed by networkd.

After installing the network-manager package and setting the default renderer to NetworkManager, this is the only line that makes a difference in netplan status:

● 2: enp0s1 ethernet UP (unmanaged)

The main NIC enp0s1 is being managed by NetworkManager now.

BMC
  • 11
  • 2