Sunday, February 04, 2007

Debian HOW-TO : Managing networks with NetworkManager

To manage both wired and wireless networks, nothing matches NetworkManager easiness and versatility.

The following tutorial will help you install it on Debian (Etch or Sid) and Ubuntu (Dapper or Edgy).


Keep in mind that I use sudo to get root privileges.



  • Prerequisites


First, make sure your network devices are properly configured, as NetworkManager won't help you with that part. So once you have the necessary drivers for your network devices installed (chances are these drivers are included in the Linux kernel already), you can go on with the tutorial.


  • Installation


The installation part is quite simple.

GNOME and XFCE users need to install network-manager-gnome :

sudo apt-get install network-manager-gnome


KDE fans will need network-manager-kde (which is called knetworkmanager in Ubuntu/Kubuntu) :

sudo apt-get install network-manager-kde



  • Configuration


Once you have it installed, a few steps are needed to render it fully functional. First, both Debian and Ubuntu users will need to modify the file /etc/network/interfaces and comment everything except the loopback interface. So only those lines should be included :

auto lo
iface lo inet loopback


While the previously mentioned step is not mandatory, it does speed up the network interfaces detection process at startup, as NetworkManager has its own method for automatically bringing up interfaces (and simply doesn't use /etc/network/interfaces).

Debian users have an additional step to perform. For NetworkManager to work, permissions have to be set rightly, so make your user part of the group netdev :

sudo adduser your_username netdev


Of course you need to replace your_username with your actual username.

Once all those steps are performed, simply reboot your machine to set things right.


  • Notes


XFCE users might want to enable GNOME services at startup, so that NetworkManager will correctly remember connection passwords and preferences.

19 comments:

carcass said...

like ever a really really good tutorial.

after two week to set up my wireless connection, and interfaces , now come this howto, after my difficults.

if this out before, my life should be more easy :)

anyway a good work

Anonymous said...

Don't reboot and run /etc/init.d/networking restart instead!

Hugues said...

Hello,

Thanks for your appreciation, carcass.

To anonymous : of course rebooting is almost never required with Linux, and in this case it is not mandatory. As you said, you can do : sudo /etc/init.d/networking restart, but you will also need to log out and log back in, so that your user will effectively be part of the group "netdev", as needed by NetworkManager.

As always, I greatly appreciate anyone's comments and suggestions,

Hugues

Anonymous said...

I have Ubuntu 6.06 and i had 6.10 .
Where is network manager , because i don´t see in CD....

Hugues said...

Hello,

The network-manager-gnome package is not on the Ubuntu 6.06 CD (nor on the Ubuntu 6.10 one). Starting with the upcoming Ubuntu 7.04 (feisty), it will be.

For now, you have to install it using Synaptic or apt-get (or download it directly from the Ubuntu repositories).

If you need more assistance, be sure to visit LinuxForums.org

Thanks for reading,

Hugues

Anonymous said...

Thanks Hugues....
iwconfig and got:
Acces Point : Not associated"??
WHY????

Hugues said...

Hello,

That is perfectly normal. As long as it doesn't say no wireless extensions, then it is good.

It simply means at the present time your wireless interface is not associated with any networks.

You can go on with the tutorial. Once completed, you will have the possibility to connect ("associate") with any networks within range.

Thanks for your comment,

Hugues

Anonymous said...

Hello,
Can you guide me the steps , Hugues??...I don´t know what to do...
Thanks for all...

Anonymous said...

Well golly gee willikers, it works! I've been struggling with NetworkManager for months, and all along the problem has been that every other guide I've looked at didn't mention the netdev group. Now that I'm in that group, NetworkManager works just fine.
Thanks for another spot-on HOWTO Antidrugue!

Anonymous said...

I've hit a brick wall :(

kdenetworkmanager list as no active device.

iwconfig returns:
iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

rausb0 RT73 WLAN
Link Quality:0 Signal level:0 Noise level:113
Rx invalid nwid:0 invalid crypt:0 invalid misc:0

sit0 no wireless extensions.


However, a "dhclient rausb0" in konsole will get me connected.

Any advise?

Hugues said...

Hi,

Your device might not be supported by NetworkManager. Check out the supported hardware list to make sure:
http://live.gnome.org/NetworkManagerHardware

However, all is not lost, as there are alternatives to NetworkManager. Wicd for instance:
http://wicd.sourceforge.net/

Good luck!

simchuck said...

I appreciate your clearly written post on configuring NetworkManager for Debian. I am a new user of xubuntu (7.04) with Xfce and recently installed a wireless router that I can't seem to find.

I have installed NetworkManager and performed the configurations as per your instructions, but I cannot see any icon for the application. How can I get this working?

simchuck said...

I have found the answer to my question, and providing it here for the benefit of others seeking the same result.

The problem appeared to be that the applet wasn't being started into my panel, so I just needed to add this manually.

Go to Settings>Autostarted Applications:
- click "+ Add"
- type in these values:
- name = "network applet"
- command = "nm-applet --sm-disable &"

I did not have to edit the interfaces file as suggested in some places. So now all is working as intended.

Anonymous said...

Thanks for that final step for Debian. It had me stumped. Good write up.

Richard said...

Thank you for a good tutorial; at last I have wireless!

I used extrapolation of the concept of the "netdev" group to make my kpowersave "Suspend to Disk" work, too. All I had to do was add my user to the "powerdev" group.

Another useful group is "plugdev" for flash disks.

Don said...

Thanks for this post. I had been struggling with this. I can't believe all I had to do was add a group to my Debian user.

Anonymous said...

I'm a bit confused!

we got debian runnig on a server. Since a few days everytime we restart the resolv.conf is overwritten by the network manager. My main problem is that the domain entry gets erased. And I do not know where to set the domain in Network Manager so that it gets written into the resolv.conf on every boot up.

Usually we don't event log on onto the server, we just boot it and leave it with the login screen. Always worked fine, and now I don't get any connection to the server from the clients.

Anonymous said...

Hi, I followed the instructions in your tutorial, unfortunately it didn't work. I got the following:
nano:/home/fernando# /etc/init.d/networking restart
Reconfiguring network interfaces...Ignoring unknown interface eth0=eth0.
Ignoring unknown interface eth1=eth1.
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

SIOCSIFADDR: No such device
wlan0: ERROR while getting interface flags: No such device
wlan0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up wlan0.
done.
nano:/home/fernando#

obviously something is wrong, please if you can help me with this problem.
Thanks in advance for your help.

Fernando

Simone Del Brocco said...

Grazie tante per il tuo aiuto.
Thanks for your tutorial
Simone (IT)