Living With GNOME's NetworkManager
Pain-free networking is the promise that the NetworkManager project makes. NetworkManager ships with most major Linux distributions now and is, by default, enabled at boot time. For mobile laptop users NetworkManager is great, but its usefulness is questionable for desktops and server deployments. This week we will introduce NetworkManager and its features (and drawbacks), followed by a Cisco VPN Client how-to next week.
The Premise of the Promise
The NetworkManager project believes that pain-free networking should be possible for laptop users. Everything should just work, as it typically does in OS X and Windows. If you unplug your CAT-5 cable and there is wireless available, you should be automatically connected to the Wi-Fi network so you may continue working. Likewise, when you return to your desk, NetworkManager should automatically connect to the faster wired network. This is how it works in every other operating system, so generally speaking this is a move in the right direction for Linux.
NetworkManager also seeks to be the authoritative source of network state information. Given that NetworkManager should know what type of network you are connected to, it is well positioned to provide information to applications. Using dbus and hal, NetworkManager provides interfaces for applications to query for network state and network speed, which allows them to adjust their behavior accordingly. The example given on the project's Web page is that your computer should not try to update itself when there is no networking, nor when connected to a pay-per-KB GSM network.
NetworkManager supports the standard wired and wireless network types. That is, it automatically detects available devices and attempts to use them. If eth0 (the first wired network card) has a link, it will automatically try to connect to the network using DHCP. If a previously used wireless network is available, the same thing happens. You can either select an available network via the GNOME desktop applet, or you can open the NetworkManager GUI to configure most aspects of these connections manually. DSL is also supported in the interface, but it a tad trickier to configure due to the wide variety of devices and link-layer protocols used by service providers.
Mobile broadband support is also available in NetworkManager. Mobile broadband is the data your cellular phone uses. If your phone supports it, and the appropriate driver is installed, you can tether your phone via USB cable and it can be used as a modem. More common these days however, are the mobile broadband USB cards. NetworkManager detects these just like Wi-Fi cards now, and allows you to configure the network connection via the GUI. One major difference with a mobile broadband type of connection is that it does not ever automatically connect. The logic is that most mobile broadband connections are pay-per-use, so NetworkManager does not want to automatically start using the connection without the user's knowledge. If you have unlimited data, this setting can be changed: edit the connection and select "connect automatically" on the first page.
NetworkManager also provides a neat way to configure VPN connections. OpenVPN, Cisco VPNs, and even Microsoft's PPTP VPN are all supported, once the appropriate plugin is installed. Some of these are more painful to configure than others, but surprisingly PPTP is quite easy in Ubuntu. After installing the network-manager-pptp package, NetworkManager will allow you to create a new PPTP connection via the GUI. A VPN connection in NetworkManager can be configured to connect automatically or manually, as desired by the user. Next week, we will get into the details of making the Cisco VPN client work.
None of what we're about to mention is NetworkManager's fault. It is the distro's choice to use NetworkManager regardless of the installation options selected. So let's pick on Ubuntu.
Remember that NetworkManager is designed with mobile desktop users in mind. If you're using a laptop that is not connected to a network upon boot, it makes sense that the boot process should continue normally regardless. Historically, daemons start up in a particular order to ensure that certain dependencies are met. For example the Apache Web server needs an active network interface before it is started so it can start listening on port 80. This concept of service order goes out the window with mobile users, as they frequently disconnect and connect to new networks.
The biggest pain point with NetworkManager in Ubuntu is that it is installed no matter what type of installation you run. Ubuntu Desktop, which is what would be installed on laptops too, automatically installs NetworkManager. This makes sense, but Ubuntu Server also installs NetworkManager. On large networks, where home directories are usually mounted via NFS and other network services are required for proper functioning of a newly booted machine, NetworkManager is painful. If the DHCP response isn't lightning fast, the boot process will continue on without a network interface, because NetworkManager does not wait. With today's fast computers and Ubuntu's upstart service model, services are started so quickly that most will be running before networking is up (since NetworkManager didn't wait). This is most painful with stationary multi-user workstations and servers, and we recommend simply uninstalling NetworkManager.
NetworkManager is wonderful for mobile users. Not only does it make network changes seamless, it also allows the casual user to easily configure wireless, mobile broadband, and VPN connections. This is a huge step forward for Linux, since many people in the past who have taken Linux for a spin got quickly frustrated when wireless didn't "just work." Without wireless, it's impossible to go much further and give Linux a chance. Therefore, we suggest NetworkManager is one of the most important Linux projects, in terms of getting a wider audience.
Be sure to come back next week for our tutorial on configuring the Cisco VPN client.
Charlie Schluting is the author of Network Ninja, a must-read for every network engineer.