Just A Little Easier, Please – Networks

The Linux desktop has progressed quite a bit in recent years. Ubuntu, out of the box, mainly just worked. I was able to quickly set up a nice desktop for my girlfriend using it. It was really nice to see the little things all fit together. For example, when we took a pic with her new camera and plugged it into the USB port, a dialog popped up asking us if we want to import the pictures. Now obviously, I expected that, and it’s not like that was invented in Linux, but it’s one of those nice touches that just makes life a little bit easier. Still, there is so much room for improvement.

I’ve been trying to think about what specifically I find annoying in day to day usage of Linux. I think my biggest gripe right now is how much of a pain it is just to move my laptop from network to network. I have five networks I tend to use. The first is my home network through my wireless router. The second is also the home network, but wired, through another router. The third is the network at work. The fourth is the wireless network back at my parents’ house, and the fifth is the wireless network at my grandparents’ house, which is next to my parents’ house.

Now, I don’t visit my parents that often, and I don’t connect to the wired portion of my network often either. However, I do switch twice a day between the wireless network at home and the wired network at work. And every time I do, I have to switch network interfaces, re-enable/disable the proxy servers, and change my Gaim account configurations (port numbers for going through the proxies, accounts I wish to auto-login, proxy settings, etc.). It’s just enough of a chore where I think to myself, “Ugh, must do this again.”

When I plug in a Windows computer into a wired network, a little bubble pops up saying that the Ethernet is connected, and it (usually) tries to configure my network settings. It doesn’t always work right, but hey, it’s an effort. It would be nice if we had such a thing in Linux. Maybe we do and I just don’t know about it, but if that’s the case, then we need an easier way for users to discover it and to configure it. Basically, when I plug in a network cable, I want my wifi connection to go down, my wired connection to go up, and a DHCP server to be scanned for. Now the wired-only portion of my network at home doesn’t use DHCP (yet), so it’d be nice for some kind of auto-discovery magic to happen, but really I should be using DHCP here anyway.

The little network selector in my panel is a nice start, really. It’s been buggy here, but it mostly works. However, it’d be much nicer if I could also configure proxy servers for each interface and network. Not tied to that applet, mind you. It would have to be a layer below it somewhere. When I change networks on the command line, the same magic should happen.

The Gaim auto-reconfiguration could happen via a Gaim plugin, which I’m very tempted to write. I don’t know what the easiest way would be to determine when a network changes on an interface, and when interfaces change. Perhaps some kind of D-BUS layer somewhere could intelligently broadcast this information in an easy-to-use form.

I don’t imagine a lot of this would be difficult to develop, and it’s largely a matter of putting the small pieces together (once written). It would certainly make this one aspect of my daily usage a lot easier. I’m sure I’m not the only one frustrated by this. I don’t know if there is work going on in this area or not, but hopefully someone will get the motivation to hack on a piece or two.

21 thoughts on “Just A Little Easier, Please – Networks

  1. Sounds a lot like NetworkManager to me too – especially the DBUS part. It’s gonna be a very usefull project for laptops and desktops too.
    Anyone knows how to get it to work with gentoo though?

  2. I’m not sure if you’ve looked at how OS X handles this problem, but briefly: You can define various `locations’, which are basically just named network profiles. You can configure settings for each device for each location — whether to use DHCP, if not, what IP address to use, etc. So, in your case, you might want wired ethernet disabled altogether in your home wireless configuration. On top of that, the profile includes settings for proxies and DNS services, amongst other things. It’s all integrated nicely and transparently with the UNIX backend. As soon as you change profiles, /etc/resolv.conf automatically updates.

    It seems like a close-to optimal solution.

  3. Hi,

    this weekend I’ve put into the effort of installing ubuntu in a friend’s laptop, and I faced that very same problem. That is, at home I have a router and an ethernet connection but my friend at his home has nothing more than a simple modem. So I had problems because the ubuntu installation found my ethernet network and the installed desktop seemed at all dependent of this.

    If the ethernet cable was unplugged the boot hanged first in the dhcpd phase and then in the login to X, why?. I remembered having this very same problem in the past with a suse box and being related to resolv.conf.

    But I found the solution. Ubuntu provides a deb that eases this task: laptop-network. This init service manages the ethernet connection and hot plugging of the cable. Now I can unplug and plug it and the service will reconfigure the laptop for using ethernet or not. No more hangs.

    I think you can configure easily to select between different networks.

    Hope it helps.

  4. I’m using my laptop in three different networks, mostly wireless and sometimes wired and I don’t have to do anything to switch network configurations. That’s the result of interaction between ifupdown, ifplugd (cable plug/unplug detection), wpa_supplicant (or waproamd) and guessnet (choosing the right network with the help of essid and/or known MAC addresses).

    Configuration must be created manually in /etc/network/interfaces and /etc/wpa_supplicant.conf but only once and never again. I can post sample configuration if anyone needs one.

    My distribution paldo ( http://www.paldo.org ) provides all these tools by default but most of them come from and are available in Debian and probably in Ubuntu, too.

  5. It might interest you to know that there are
    ubuntu packages for NetworkManager available


    Ubuntu don’t seem to be actually going with NetworkManager for their next release, they are using a thing called netapplet which is less ambitious (I think the network switching part of if is just a graphical wrapper around debian scripts). There seems to be some consensus that NetworkManager is the right architecture for the future, however.

  6. Thanks for the response, everyone. I have heard of NetworkManager, though I haven’t used it until now. It is definitely better than netapplet, though I had some trouble getting it working at first until I rebooted. I was getting some fun RPC errors in dmesg. Ah well.

    I have not yet looked at the D-BUS parts of it, but it seems to me that a freedesktop.org spec for the D-BUS notification and maybe network switching should be provided. Either way, though, this seems like a start.

    The only problem (aside from the aformentioned RPC issue, which caused my whole GNOME desktop to fail 🙂 is that it has, like netapplet, told me that my preferred network is out of range, and has automatically switched me to the first non-secured wireless network it can find. I can’t tell you how annoying that was with netapplet, and I hope NetworkManager doesn’t do this again. In my apartment, I am within range of seven wireless networks, and four of those are unsecured. It makes it a bit hard to stay on my secured network when the network switchers attempt to be intelligent in that regard, ignoring my preference.

  7. The NetworkManager packages for Ubuntu that were listed above have proven completely unusable. I don’t know if this is specific to the Ubuntu packages or not, though I imagine they aren’t. My routing table completely disappears every so often. My networks keep switching. I’m in a building with no wireless networks and it keeps moving me to a wireless network. I’m glad it works for everybody else, but this isn’t making life any easier for me. I’d say we still have a long way to go if there is even a possibility of these bugs happening to users.

  8. Under Hoary System->Administration->Networking you can set location at the top of the dialog, which should theoretically address moving between the multiple networks you describe.
    I agree though it would be nice if Linux behaved more like Windows in terms being able to give it a priority of networks that it could try in succession.

  9. Suse based distros have a “Profile Manager” available through Yast. What it does is it allows you to run multiple configurations of different services. For example – I use it on my laptop extensively, not just for network addresses, but also for my hosts file, my cups configuration, etc. I even got it to reconfigure my Name Service Switch config to allow me to authenticate with Kerberos and an LDAP server at one location.

    Switching profiles is easy, when you boot, grub adds a menu that allows you to select which “profile” to use at bootup – when you forget to select the correct one, just type ‘scpm switch profilename’ at the prompt and it will reload whatever services needs to be resarted.

    Granted it is Suse/Novell specific, but it is such an awesome tool that I haven’t ran anything but Suse on my laptop in over a year.

  10. Christian,

    Do you have any idea what version the .debs were? NetworkManager has stabilized quite a bit in the last month or so, I’m not sure how quickly Thom keeps up with CVS however. Current Fedora RPMs of NM seem to work quite well for most people.


  11. Christian,

    NM will only connect to wireless networks that you’ve connected to before. It will also attempt to connect to the _last_ wireless network you chose from the menu automatically. It would be helpful if you could join networkmanager-list (@gnome.org) so we could figure it out.

    So anyway, if you last chose your own network from the menu, that’s what NM will try to automatically connect to. However, that’s dependent on whether or not the card can actually _see_ your network right away. Unfortunately, no WiFi card I’ve used (and I’ve used quite a few) will ever report all access points in range on any given scan, you basically get a subset. So you have to do a couple scans before you can get an accurate picture of the network topology. That means there’s a tradeoff here: do we connect as quickly as possible maybe with the wrong access point, or do we wait and annoy the user while we do 3 scans (which might take 30 seconds) to see if we find the right one? Besides, there’s no guarantee that we are actually _at_ your house and that we’ll find your access point anyway.

    The problem with profiles is that you must have user interaction. You shouldn’t have to pick anything to specify that you’re at work, or at home, or at the beach. You have to create new profiles wherever you go frequently, whether that’s the public library or Panera, and then you have to manually pick them at some point. That’s unnecessary user interaction that even Windows users don’t have to do.

    In the future, NM will provide “trusted” and “prefered” access points, and will always prefer the trusted ones over the merely prefered ones. That might include auto-switching to a trusted AP even when already connected to a merely preferred AP.


  12. One more quick note: very early on we tried to do priority setting of networks. That would work fairly well technically, but the UI turned out to be harder to do that we thought. You have to then have a dialog in which you can re-order the wireless networks easily. How do you know what priority to assign to a new wireless access point you’ve just decided to connect to? Is that a two-step process, connect and then open the Priority dialog and change the priority? Or does a dialog pop up each time you connect to a new one, asking you to set the priority? Does this second option list all previous wireless networks too, or just the current one? I don’t think either of those situations passes the “Just Work” test. I’d be quite interested in other ideas though, since priority is the real solution to the technical problem of wireless cards just being dumb.

  13. Hi Christian,
    would it be possible for Gaim to be a bit more network-change friendly too ? Everytime I disconnect the cable Gaim pops up loads of windows, attempting to reconnect.
    Also gaim should not attempt to connect if it cannot find a connection.

  14. The thing with network applications which require continous application is that they’re usually mapped via IP addresses and ports. A connection is usually defined by an IP address-port pair between two communicating computers. Changing network interfaces usually mean a change in source IP addresses (unless you’re peering with the Internet using BGP to announce routes).

    Gaim has no recourse but to “disconnect” once the network interface goes down and simply try to reconnect when a network interface with the proper routes go up (not necessarilly a default route). Gaim just needs to subscribe to the dbus service (specifically network-related events) and disconnect and re-connect when appropriate. The disconnection popup window should probably be configurable so one can set it not to popup (and so be less annoying).

  15. Dan Williams:

    They are version 0.31cvs20041101. I’ll attempt to roll my own when I get the time (this weekend perhaps). I didn’t realize how old those were 🙂 NetworkManager looks really nice, and if those bugs go away, which I imagine they will, it should be a good solution.

    I see the problem with the UI. That’s tricky… I don’t have a solution off-hand, but I’ll certainly put some thought toward it once I get NetworkManager up and running.


    I’d think it would be possible to make Gaim more network-friendly, but I haven’t worked on Gaim all that much lately. If you have any good ideas in this department, I’d recommend e-mailing the gaim-devel listserv.

    I do want to write a plugin to listen in through dbus to find out when networks are switched. When that happens, I want to change network settings and reconnect accounts in Gaim. Of course, there’s so much complex configuration I’d want to be able to set up that it’d end up being a configuration mess, so I don’t know how I’d really do this… Proxy settings, auto-connect, ports, and protocol-specific settings on a per-account basis. Ah well, I’ll put more thought into it.

  16. oh the headache I went through to uninstall NetworkManager on my ubuntu (hoary)!! I didn’t realize apt didn’t have uninstall capability, so I grepped through /etc and finally found the files to remove to restore network to original working order. in any case, the properties (default wifi setup prog in hoary ubuntu) dialog let you setup your location and can switch for you, silly me I didn’t noticed it before, that worked just fine I guess..


  17. oh the headache I went through to uninstall NetworkManager on my ubuntu (hoary)!! I didn’t realize apt didn’t have uninstall capability, so I grepped through /etc and finally found the files to remove to restore network to original working order. in any case, the properties (default wifi setup prog in hoary ubuntu) dialog let you setup your location and can switch for you, silly me I didn’t noticed it before, that worked just fine I guess..


  18. Unfortunately, networkmanager is almost great, but not quite. After using it for some time I began to realise it has some bugs which put me off using it.. The problem I had was it was caching my dns and getting confused sometimes. Second problem was the performance was a little poor, although this may just have been my dodgy connection. Hopefully they’ll fix this in the future, I mean, do we really need bind installed to use the internet? If you’re going to cache dns, you’d be better off using djbdns at least.

    My other small gripe about networkmanger was lack of support for pka shared keys, but that was only a small gripe. At the moment I just the network profiles thing, although that’s starting to bug the hell out of me as it only switches sort-of properly from home wireless to work ethernet 😦 I think I might just write my own script and use wpa_supplicant or whatever. What a pain! I agree that this is one of the biggest problems with linux distro’s today. I think network manager is definitely the way forward though, shame it’s not very well supported by most distros, but that’s what you get if you’re using all these cool dbus/hal tech etc.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s