65

Ubuntu seems to provide at least two network "toolsets" (for lack of a better term). I'm running into conflicts between these two.

I am often running into conflicts between these different sets of tools. For example, I'm running Ubuntu Desktop at home and I'm using software like KVM/libvirt which recommends that I disable Network Manager, but disabling Network Manager causes other things to break.

What is the difference between Network Manager and the traditional network tools? Can these two suites run side-by-side or must I stick with one or the other? Is there a document which summarizes the difference between these different tools? I have been unable to find one.

(Forgive the vagueness of this question. I've searched and searched for an answer, but I have only found many vague answers which don't seem relevant to Ubuntu 10.04/Lucid, and I may not fully understand the purpose of NetworkManager. However, this seems to be a frequently asked question. If you have advice for clarifying this question, please post a comment.)

5 Answers5

64

NetworkManager and ifconfig are not (by default) compatible (NetworkManager won't configure interfaces listed in /etc/network/interfaces). NetworkManager is a sort of settings daemon that makes sure that multiple users can edit network connections, this is very smart in a desktop environment (especially on laptops that might move around between different wireless networks). Basically NetworkManager is a frontend to iproute, dhclient, wpa_supplicant and ppp.

ifconfig is a general tool for configuring network interfaces, you can for example do like this:

ifconfig eth1 10.0.0.1 netmask 255.0.0.0 hw ether 10:10:10:10:10:10
ifconfig eth1 down

to set your IP, netmask and MAC address of eth1, and then down (disable/turn off) your interface. ifconfig doesn't read any config files and does only exactly what it is told.

ifup and ifdown are helper programs that use ifconfig to configure a network interface in accordance to /etc/network/interfaces this will make sure that if there are any up, down, pre-up, pre-down, post-up, post-down scripts that need to be run they will be.

Ok, then there is wpa_supplicant and dhclient. dhclient is a DHCP client - ifup will use this if a network interface is configured for DHCP, as will NetworkManager. wpa_supplicant is a tool for configuring encryption on wireless networks.

Most of these tools have man pages, for instance the interfaces-file have it's own manpage that describe the format of that config file.

man interfaces
man ifconfig
man ifup

So that being said i would recommend that you remove (or disable) NetworkManager, I don't think that any thing will break from removing NetworkManager except the gui tools for setting up network. If you want to configure wireless without NetworkManager you might want to look at this.

  • ps: For any interface (eth0, wl0,...), you can select one of ifconfig and NetworkManager freely. Which interface was managed could detaile by nmcli device. – vrqq Mar 19 '23 at 07:42
16

On most distros, there are two major command-line utilities used to configure network interfaces:

Package/Utility Description
net-tools/ifconfig Deprecated, yet ubiquitous.
iproute2/ip Newer utility intended to replace the above.

However, those configure the kernel directly, i.e. you will need to reconfigure your interfaces again after each reboot.

Three major packages (and daemons) exist for that:

Package Description Config file Service unit file
ifupdown Old but reliable, found on older distros where sysvinit is present; calls ifup on startup and relies on ifconfig to do its dirty work. /etc/network/interfaces networking.service
NetworkManager Common on desktop distros; many graphical front-ends (e.g. GNOME) available. /etc/NetworkManager NetworkManager.service
systemd-networkd Part of the systemd suite, used on distros where systemd is present. /etc/systemd/network systemd-networkd.service

YMMV, but you should choose one and stick to it, e.g. even if ifupdown works well with NetworkManager, it can still create unexpected issues.

Another utility worth mentioning is dhclient (although not a daemon); required if you need to obtain a IPv4 from a DHCP server. However, as IPv6 (which uses SLAAC) is slowly being adopted, this might change in a near or distant future.

emandret
  • 643
6

These toolsets are complementary, not mutually exclussive.

FWIW, ifconfig is just a tool among other *config tools which are used to configure network interfaces.

The ifup(8) and ifdown(8) tools are one layer above the *config tools. You can think of them as helper tools.

Likewise, NetworkManager is a level above the ifup(8) and ifdown(8) tools. For lack of a better term, NetworkManager is able to orchestrate the tools(ets) from the levels below in order to acomplish higher level tasks like Internet Connection Sharing with additional ease compared to just using the tools from the levels below.

Li Lo
  • 16,417
  • If you would like additional details leave a comment and I will oblige. – Li Lo Aug 09 '10 at 19:07
  • 4
    @Li Lo: Yes please provide additional details. I thought that ifup/ifdown would modify hosts in /etc/network/interfaces , and Network Manager would ignore any interfaces in /etc/network/interfaces. (See question "d. Why won't Network Manager manage my Networks? " under FAQ/Common issues/Pitfalls – Stefan Lasiewski Aug 12 '10 at 17:18
  • 2
    Ehm, ifup/ifdown use /etc/network/interfaces, and are separate from NetworkManager. NetworkManager does not mess with /etc/network/interfaces at all, except for by default reading a list of interfaces to ignore. – user1338062 Apr 24 '14 at 07:22
  • 2
    Downvoted this answer since it's been called out as plainly wrong and there's no response from the poster. So I assume the accusation is true. – Penghe Geng Mar 30 '18 at 19:32
1

Network Manager is a GUI program used when dealing with Ubuntu as a workstation OS installed on your desktop/laptop.

The ifconfig-type utilities are command-line based and are used when dealing with Ubuntu as a server OS, when you don't have a graphical interface available to you (for example, when you boot up an Amazon EC2 instance based on Ubuntu). They are typically used over an ssh connection.

  • 7
    Yes, I once used the ifdown command over an ssh connection. It didn't work out too well for me. – Igor Zinov'yev Aug 12 '10 at 06:32
  • 5
    Network Manager is not just a GUI. There is also a network-manager daemon, which is a different package then the network-manager-gnome GUI applet. What is the difference between network-manager and the traditional networking tools? – Stefan Lasiewski Aug 12 '10 at 17:32
  • 1
    NetworkManager runs on top of wpa-supplicant which is /another/ tool for configuring networking. /etc/network/interfaces can make calls to wpa-supplicant as well – maco Aug 14 '10 at 03:39
  • 1
    IN fact NetworkManager is not a gui-only-tool. you can use it with the commandline, too. – LittleByBlue Dec 20 '14 at 12:57
  • This Answer is just wrong. ifconfig is just a old tool for networking. – LittleByBlue May 01 '16 at 08:59
0

If you remove network manager I assume you need to configure /etc/network/interface to make interfaces work.