What is the networking.service?

15,390

networking.service raises or downs the network interfaces configured in /etc/network/interfaces, that is, those network interfaces which are not managed by NetworkManager. If you look into /lib/systemd/system/networking.service you will see that all it does is ifup or ifdown depending on whether it is to be started or stopped.

It is a oneshot unit, which means that it does its thing and exits, it does not remain running in the background.

By default all network interfaces are managed by NetworkManager and networking.service does nothing. On a server it is quite common to assign a static IP address to one or more interfaces by editing /etc/network/interfaces, and in this case those interfaces are no longer managed by NetworkManager and they are raised or downed by network.service.

Share:
15,390

Related videos on Youtube

Hoàng Nguyễn
Author by

Hoàng Nguyễn

Updated on September 18, 2022

Comments

  • Hoàng Nguyễn
    Hoàng Nguyễn over 1 year

    I'm learning Ubuntu 16.04 LTS and i confuse between networking.service, NetworkManager.service and systemd-networkd.service. After googling i found that NetworkManager.service and systemd-networkd.service are two way to manage the network and we only need 1 of them. No result for networking.service.

    I already tested on Ubuntu 16.04 Desktop and Server. On desktop NetworkManager.service and networking.service are active, on server only networking.service active. I don't understand what networking.service is? Could you help me please?

    • muru
      muru over 7 years
      The networking service just brings up the network devices. Network Manager actually manages them on desktops, and on servers they maybe be managed via /etc/network/interfaces or systemd-networkd.
  • Hoàng Nguyễn
    Hoàng Nguyễn over 7 years
    Thank you! I have one more question. I installed Ubuntu server 16.04 LTS and only networking.service is active, NetworkManager.service and systemd-networkd.service are not. So that mean we don't need them on Ubuntu Server right?
  • AlexP
    AlexP over 7 years
    The server installer places all network interfaces in /etc/network/interfaces, which means that their activation is performed by network.service. At least all wired interfaces -- I have never used the server variant of Ubuntu on a computer with WiFi.
  • steeldriver
    steeldriver over 7 years
    Isn't networking.service responsible for bringing up the loopback interface (even where all external interfaces are managed by NetworkManager)?
  • dtoubelis
    dtoubelis over 6 years
    @AlexP NOTE, that OP is asking about networkd.service. networking.service and networkd.service are two different things. The networking.service does what you describe - executing ifup & ifdown but networkd.service is actually replacement for ifupdown package designed around systemd.
  • AlexP
    AlexP over 6 years
    @dtoubelis: Note that this question was asked and answered in 2016.
  • pbies
    pbies almost 5 years
    If the network.service failed - can I stop it and disable it? When?
  • AlexP
    AlexP almost 5 years
    @pbies: Better find out why it failed. It shouldn't fail.
  • pbies
    pbies almost 5 years
    @AlexP /etc/network/if-up.d/sendmail: 44: .: Can't open /usr/share/sendmail/dynamic run-parts: /etc/network/if-up.d/sendmail exited with return code 2
  • pbies
    pbies almost 5 years
    @AlexP I've removed sendmail sudo apt purge sendmail sendmail-base sendmail-bin but other error appeared...
  • AlexP
    AlexP almost 5 years
    @pbies: I'm sorry, this is not suitable forum for technical support.