Issue #3 January 2005

Introducing NetworkManager

Introduction

Network management has been a necessary but relatively ignored part of the Linux environment for years. With network connections pervading everyday life, the need for a better way to manage network connections has never been greater. Within this past year, a new application called NetworkManager has been created to fill this need. What is NetworkManager and how did it come into being? Let us go back to the beginning.

A brief history of Internet connectivity

Long ago, in the days of yore, the Internet was born. A computer could access this Internet by attaching itself to it with a cable. Once this cable was connected, the parameters were set once and forgotten. It barely mattered if the set-up was difficult; a favor from a more technically-savvy friend and you were good to go. There was no need for maintenance as the connection would continue working in the background indefinitely.

Then everyone got laptop computers. Every time someone with a laptop computer wanted to access the Internet, they would have to plug a wire into their network card. These mobile devices would have to be stationary for as long as the Internet access was needed. Access was usually limited to one's home and/or workplace, which meant set-up was only twice as complicated as a desktop computer. That technically-savvy friend might have grumbled a bit, but was still willing to show off the required expertise.

But lately, the boom of wireless networking has meant a proliferation of Internet access points everywhere, from local coffee shops to laundromats, from (if you live in the right location) city parks to public libraries, from train cars to airports. And each time a laptop computer needs to access a new wireless point, configurations would have to be done anew. Bringing your technically-savvy friend with you everywhere became infeasible. An easy and intuitive way to set up network connectivity suddenly became more important.

A new way

The desktop team at Red Hat realized the current interface in Linux networking is unacceptable. They wanted to create a new application that is simple to use. However, simplicity is a concept that is easier to understand than to define. With this in mind, they came up with some guidelines for their new application. They believe that a network tool should:

  • Auto-detect as much information as possible
  • Seamlessly switch connections when necessary
  • Be unobtrusive
  • Provide immediate feedback of network state to users and applications
  • Work without any command line interaction
  • Offer connection points as a user preference

Another important feature planned from the start of NetworkManager is its ability to function with any Linux distribution. Among the distributions which already offer NetworkManager packages are Fedora, Gentoo, Debian, and Slackware. As NetworkManager was designed with portability in mind, packaging for other distributions should be relatively painless. With such broad distribution support, application developers are able to utilize the features of NetworkManager with the knowledge that their efforts reap widespread rewards.

The price of simplicity

Although I know a few people who already run NetworkManager as a standard part of their desktop, it is not currently ready for widespread use as NetworkManager is still a work in progress. The hope is that with enough work, NetworkManager will be the network tool of choice for people with mobile computers. In the interim, those that are lucky enough to have supported hardware can use it while others have to wait until appropriate drivers are implemented.

Another drawback of NetworkManager is that it cannot implement all command line possibilities. For most hardware configurations, this lack does not matter as it does not affect its ability to connect to the Internet. However, for those configurations that require various tricks and obscure incantations to get working, NetworkManager most likely will not work.

From start to go

Now that we know where NetworkManager came from, it is time to get it running on your system.

Getting the packages

NetworkManager packages are available for some Linux distributions. For Fedora, enter the following at a command prompt:

yum install NetworkManager NetworkManager-gnome

NetworkManager is now installed on your computer.

Getting the source

If you are unable to find a prepackaged version of NetworkManager for your distribution, you could try and build it yourself. Download the source tarballs from the GNOME FTP site.

Build and install as per the method appropriate for your particular distribution.

Running NetworkManager

Once NetworkManager is installed on the system, it can be started by entering the following on a command line as root:

service NetworkManager start

If you are unsure about using NetworkManager as your primary network application, using this command is a good way to test it out. You can run this command every time you boot up your computer to start NetworkManager.

However, if you know NetworkManager works well for you and you want to have it start up every time by default, enter the following command as root:

chkconfig --add NetworkManager

Once the NetworkManager daemon is running, log in as the user and enter the following in a terminal:

NetworkManagerInfo &

The NetworkManager icon should appear in the Notification Area.

If you do not have a Notification Area in your panel, you can create one. Start by right clicking on the panel and selecting Add to Panel.... Choose the Notification Area from the dialog box.

To make the NetworkManager icon return every time you log in, enter the following in a terminal:

gnome-session-save

Using NetworkManager

NetworkManager attempts to intelligently select a network connection. The first thing it checks is whether or not an Ethernet card is connected and running. Because an Ethernet card creates a wired connection, it is assumed to be inherently faster than any wireless possibility. If such a connection exists, NetworkManager tries to get a DHCP lease on that connection.

If there is no wired connection available, NetworkManager uses the wireless card to scan for available ESSIDs (Extended Service Set Identifier, a code used to identify packets on a wireless network). If one or more of these access points have been used in the past, the one that was used most recently is automatically selected. If none of them have been used before, NetworkManager waits for user input.

Since NetworkManager considers wireless selection as a preference, it does not connect to any wireless networks unless a user is logged onto a desktop and one is selected. At a casual glance, this inactivity might seem unusual. What could be simpler than to have NetworkManager automatically pick the best connection?

There are a few reasons why this is not a good idea. First of all, NetworkManager has no way of knowing whether or not an access point is actually yours to use. It could belong to a neighbor who would not be happy if you used it. Second, there is no way for NetworkManager to gauge which connection would be best. Although it can tell signal strength, that is not a good way to compare connections. A connection to an access point with lower signal strength may be a better pick if the access point is connected to a much faster connection down the line. Lastly, some access points may be more secure than others. Because a user may one day prefer to choose a connection that offers a faster connection with lower security and on a different day choose differently, network selection has to be selected on a per-user basis.

NetworkManager is constantly scanning for changes in network hardware on the system as well as for new access points. If a new wired network becomes available, NetworkManager switches to it automatically. If the wire is disconnected, NetworkManager quietly switches back to the preferred wireless connection.

Running NetworkManager for the first time

The first time you log in to the computer with NetworkManager running, the NetworkManager icon shows up in the Notification Area. Click on this icon and the selection menu pops up as shown in Figure 1, “The network selection menu”. This menu shows the available networks and their various strengths. Selecting a network activates that connection.

The network selection menu
Figure 1. The network selection menu

If a network is password protected, the listing of that network in the menu has an icon of a lock next to it. Selecting a password protected network pops up a dialog box. Select the appropriate hash type and enter your password to activate that connection.

Connecting to a hidden access point

Some access points are intentionally hidden by the administrator as a security measure. If you know the ESSID, you can still access it. From the NetworkManager icon in the Network Area, select Other Wireless Networks.... In the dialog box (shown in Figure 2, “Entering information for a hidden network”), enter the ESSID. If necessary, enter the password type and password as well.

Entering information for a hidden network
Figure 2. Entering information for a hidden network

How NetworkManager works

Now that we have covered how to use NetworkManager, let us explore how it works.

Architectural overview

The NetworkManager application is made up of four distinct parts:

  • NetworkManager — a root daemon that handles the network connection and policy.
  • DHCPCD — a DHCP client daemon used by NetworkManager.
  • NetworkManagerInfo — program that gathers and communicates the user preferences to NetworkManager and gives notifications to the user.
  • NetworkManagerNotification — notification icon located in the panel and used by NetworkManagerInfo to display the possible wired and wireless connections.

These components interact with each other to perform tasks associated with NetworkManager. A diagram displaying their interactions is shown in Figure 3, “NetworkManager interactions”.

NetworkManager interactions
Figure 3. NetworkManager interactions

NetworkManager and D-BUS

NetworkManager uses D-BUS (a message bus that allows applications to talk to each other) to interact with other applications. Using D-BUS allows for the flexibility of a standard interface while also including built-in security.

D-BUS is used internally for communication between:

  • NetworkManager daemon and NetworkManagerInfo
  • NetworkManagerInfo and NetworkManagerNotification
  • NetworkManager daemon and HAL

Externally, NetworkManager uses D-BUS to broadcast information about various state changes. Other applications can monitor this information and theoretically be able to change network status.

NetworkManager and HAL

Included in Fedora Core 3 and in upcoming Red Hat Enterprise Linux releases, HAL, or Hardware Abstraction Layer, provides the ability for applications to learn about existing and new hardware. For more information on HAL, read David Zeuthen's article on HAL.

NetworkManager queries HAL at startup to learn what network interfaces are available. Any changes in network hardware and link information is detected by HAL, and this information is immediately relayed to NetworkManager. HAL can also provide information about the network card's driver, which allows NetworkManager to special case certain cards.

The future of NetworkManager

There are many future features planned for NetworkManager. The following are a few of the more exciting ones currently being developed:

VPN
A VPN (Virtual Private Network) is private network used mostly by companies and organizations to conduct private business over the Internet. Currently, attempting to connect to a VPN on a Linux system is more complicated than setting up a wireless network from the command line. Work has begun to integrate VPN connections into NetworkManager. When completed, accessing a VPN will be as easy as selecting a wireless network.
Notifying Desktop Applications
Have you ever lost your network connection without warning? Every network dependent application suddenly panics and pops up a warning that the connection has been lost. Mail clients, Web browsers, and Internet chat clients are just some of the everyday applications that are affected. NetworkManager aims to solve this annoyance. By having network information consolidated in one place, applications can query NetworkManager for the status of the network instead of harassing the user. Individual applications could then switch themselves to work off-line until the network connection is once again established.
Consolidating DHCP Options
DHCP (Dynamic Host Configuration Protocol) is a networking protocol that allows a DHCP client and a DHCP server to relate information necessary for the client to access the network. Other than the IP address, a DHCP server can provide information such as the location of print servers, SMTP servers, and POP servers. Having all of this information easily available in NetworkManager that can be accessed via D-BUS allows a sane and consistent way for applications to get this information.
Disabling Access
In an ideal world, having network connectivity all the time would be a wonderful benefit. However, in this world, there are times when automatic connections are a hindrance. For instance:
  • You are on an airplane and are told that all network devices have to be shut down.
  • The battery on the laptop is low (constant monitoring of available networks take a nontrivial amount of power.)
  • You want the computer to be unaccessible for security (or personal) reasons.
NetworkManager will soon make turning off networking as simple as clicking a mouse button.
Dial-up Networking Support
Neither modems nor ISDN connections are currently supported in NetworkManager. However, they are planned and when implemented will be options in the NetworkManager menu.

How to help

NetworkManager is still a work in progress. The developers welcome help from the community. Testing wireless cards, writing documentation, packaging for currently unsupported distributions, and contributing code are various ways that you can help NetworkManager achieve its full potential.

Getting the code

The latest release of the source code for NetworkManager can be downloaded as stated in the section called “Getting the source”. Although this method does not get the absolute latest improvements, there is a much better chance that the version is stable. For people helping with documentation or testing, these tarballs are more than adequate.

Building from CVS

For those people who are adventurous or want to contribute code, getting the latest version is essential. This involves getting the code fresh out of CVS.

Before building NetworkManager from CVS, you need to check the following:

  • The gtk2-devel package needs to be installed on the system. If you do not have it, enter in a terminal as root:
    yum install gtk2-devel
    
  • gnome-autogen.sh from the gnome-common module has to be in your $PATH. If you do not have it, enter into a terminal:
    cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome get gnome-common
    
    Copy gnome-common/macros2/gnome-autogen.sh into ~/bin If necessary, update your PATH by executing the command:
    export PATH=~/bin:$PATH 
    

To download the NetworkManager code from CVS, execute:

cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome get NetworkManager

Once the downloading is complete, you are ready to build a new version of NetworkManager. Enter the following commands in a terminal:

cd NetworkManager
./autogen.sh --prefix=/usr --sysconfdir=/etc
make

and as root, type:

make install

Congratulations! You have just built the newest version of NetworkManager onto your computer.

To get your computer to recognize this new build, enter the following as root:

service NetworkManager restart

This command restarts the NetworkManager daemon. To restart the front end, issue the command killall NetworkManagerInfo in a terminal.

Contacting the developers

Whether you have questions, suggestions, or offers to help, you need to be able to contact the developers. Here is a list of ways to get more information:

Mailing Lists
Like all software projects, NetworkManager has its own mailing list where developers and users discuss problems and suggest possible solutions.
  • ArchivesNetworkManager mailing list archives
  • mailing list — page to subscribe to the NetworkManager mailing list
Websites
The Official NetworkManager website

Words with the creator

NetworkManager creator and developer Dan Williams took time out of his hectically busy schedule to answer some questions.

What prompted you to start working on NetworkManager?
Havoc Pennington. The Red Hat Desktop Team was having a meeting earlier this year to discuss things that would be cool to work on for Fedora Core 3, and he brought up the topic of easy wired and wireless networking. There weren't really any good GUI tools for configuring wireless, and you had to redo the entire setup for your wireless card every time you wanted to connect to a new access point. So, the idea of NetworkManager was born, where users could move seamlessly between desk and mobile environments and not have to care about configuration.
What was the most frustrating thing about working on NetworkManager?
Definitely the state of wireless drivers on Linux. They are horrible, both individually and as a group. There isn't complete support for any card that I know of, and across all the drivers things like quality information and basic support is inconsistent. If anyone wants to be a hero, this would be a great place to help out. Children will love you for it. Don't be afraid, wireless drivers aren't really all that complicated structurally or conceptually, and they are fairly encapsulated.
What's with those StudlyCaps, anyway?
Well, coming from a Classic Mac OS background, in which everything was StudlyCaps, it is quite natural for me to use the Shift key, which many Linux programmers seem to run away from in fear. Which is quite silly, if you ask me. There's nothing to be afraid of. In any case, it also had to do with aesthetics. A daemon called network_manager just doesn't look good (using '_' instead of ' ' probably comes from the traditional Unix aversion to spaces in file names, which is also silly), and networkmanager is just pathetically hard to read, so it had to be NetworkManager. It is also quite sad that this is almost the longest answer to any of these questions.
Besides NetworkManager, what do you like to do/work on?
I also work on OpenOffice.org, particularly in the graphics and lower layers to make it integrate better with Linux. Besides that, I enjoy tinkering around with computer hardware, various outdoors things like hiking, reading books on various archaeological topics, and trying to figure out how archaeologists can use computers more in their research. If anyone could recommend good technical books on intersections of archeology and scientific disciplines (especially paleohydrology), I'd be quite interested since I'm not "forced" to read them for college anymore. They were fun. I miss reading them.

Picking a good network card

Here are some network cards that have been shown to work with NetworkManager:

  • Netgear WG511 v2 (the ones made in Taiwan)
  • Netgear WG511T
  • Belkin F5D6020 v2
  • Cisco Aironet 340/350
  • Intel ipw2100
  • Intel ipw2200

Network cards that currently do not work with NetworkManager include:

  • Linksys cards (depends on the version as their chipsets vary)
  • Broadcom
  • PrismI/PrismII

Conclusion

With NetworkManager anticipating and fulfilling the new needs of network management, Internet connectivity becomes an easy and forgettable task. Users can configure it quickly themselves. With all the time you save, you can take your technically-savvy friend out to lunch!

About the author

Rosanna Yuen is an avid computer user who often finds herself surrounded by computer programmers. She co-wrote AisleRiot and is a dabbler in the GNOME project. In her spare time, she reads, knits, and experiments in her kitchen.