Am I running NetworkManager or networkd?

35,907

Solution 1

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 

Solution 2

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

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

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 network-manager. (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).

Share:
35,907

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    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?

    • chili555
      chili555 about 6 years
      What does this suggest? sudo service network-manager status
    • Admin
      Admin about 6 years
      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?
    • chili555
      chili555 about 6 years
      No; see my answer in a few minutes.
    • curiouser
      curiouser over 3 years
      although network-manager.service could not be found was what I got, NetworkManager.service was to be found and apparently they are the same: askubuntu.com/questions/1031439/…
  • Admin
    Admin about 6 years
    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?
  • chili555
    chili555 about 6 years
    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.
  • kubanczyk
    kubanczyk over 4 years
    "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.
  • chili555
    chili555 over 4 years
    @kubanczyk nmcli is certainly possible here; however, why does one need it? Set your details in netplan and be done.
  • Lockszmith
    Lockszmith over 3 years
    This is a much better answer, thanks for all the detail.
  • Thomas
    Thomas almost 3 years
    Typo: systemd-netword should be systemd-networkd. Ask Ubuntu won't let me submit an edit of less than 6 characters.
  • Elliptical view
    Elliptical view almost 3 years
    @Thomas, fixed. thanks.