Thursday, December 11, 2008

Using dialup with 11.1 if NetworkManager does not handle your device

In openSUSE 11.1, NetworkManager is supposed to handle all dialup stuff. But, as far as I know, it can not handle e.g. plain old phone modems or dialup via bluetooth (rfcomm).
Unfortunately, if you now try to use the old methods of kinternet, wvdial or Umtsmon, you will find out that dialup will work with these, but you won't get a working resolv.conv and thus no name resolution. The reason is that the netconfig tools, which do rewrite resolv.conf apparently refuse to do that if NETWORKMANAGER=yes is configured in /etc/sysconfig/network/config.
One solution would be to switch to the old ifup method (NETWORKMANAGER=no), but then wireless LAN will basically be unusable.
Another, dirty and hackish solution is this:

Create a /etc/ppp/ip-up.local, containing
        #!/bin/sh
echo "nameserver $DNS1
nameserver $DNS2" >> /etc/resolv.conf

and a /etc/ppp/ip-down.local, containing
        #!/bin/sh
mv /etc/resolv.conf.netconfig /etc/resolv.conf

Make both of them executable. Dial up.

How does it work? The ip-up script gets the DNS servers in its environment. Just before it exits, it calls the ip-up.local script which then appends them to resolv.conf. During ip-down, the netconfig tools notice that the resolv.conf was changed externally and they refuse to touch it. They instead create resolv.conf.netconfig. ip-down.local now just replaces resolv.conv with resolv.conf.netconfig and everybody should be fine again.

To make this hack a bit more robust, you should probably check if the $DNS[12] variables are non-empty before adding them and you should check if resolv.conf.netconfig is newer than resolv.conf before restoring, but I leave that up to the reader.

Oh - and don't forget to file a bug against NetworkManager if it cannot handle your device!

26 comments:

  1. that sucks. we need to find a better solution than that.

    ReplyDelete
  2. I heartily agree. But the bug (https://bugzilla.novell.com/show_bug.cgi?id=429772) got WONTFIXed, so I posted this workaround for people that want to use e.g. Bluetooth for dialup.

    ReplyDelete
  3. Great, and by refusing to properly support this openSUSE loses almost everyone with a netbook. Heck, anyone who needs dialup on a desktop.

    No wonder people turn the back on openSUSE and use other distributions instead. Those may not be technically better, but their attitude about users apparently is...

    ReplyDelete
  4. By the way, this brain-dead blog software handles umlaut domains in a terribly broken way. It silently removes the "offensive" character(s) and thus publishes a broken URL.

    ReplyDelete
  5. UMTSmon has served me well for HSDPA with XU 870 (Tried to get Novatel to fix their antiquaric howto, but support at Novatel is a disaster) No response whatsoever.... Where is the 7.2 mBit firmware Novatel advertises with by the way?

    Used Ubuntu for a while - converted UMTSmon to .deb with alien and it was great. Due to Networkmanager behaviour i replaced it with Wicd for WIFI.

    Had a look at Networkmanager bugreports - and there's a huge number of bugs that hardly receive any attention..

    http://bugzilla.gnome.org/buglist.cgi?product=NetworkManager&bug_status=NEW&bug_status=REOPENED&bug_status=ASSIGNED&bug_status=UNCONFIRMED

    Is NetworkManager the buggiest app of Gnu/Linux?

    I'll have another go at Wicd with OpenSuse 11.1.

    Your work - Mr. Seife - is indeed appreciated - I've converted quite a few to linux because of UMTSmon

    Have a superb christmas season ;)

    ReplyDelete
  6. This scripts are awesome and I think this is indeed a very simple and elegant solution. Thank you very much...

    ReplyDelete
  7. Ok just upgraded to Opensuse 11.1 because my option gt max should be supported in
    kernel 2.6.27
    I thought what the hell is going on? all my cards are detectec eaven my usbstick huawei e169 and connecting fine without errors , but no dns!!!
    With knetworkmanager none of the cards work.

    I thought i was nuts, the i read this blog.
    and what is the deal not able to change hostname?

    I had the card working before the upgrade, buth with alot of workarounds and installing python.

    The knetworkmanager was fine just the way it was, opdensuseteam don't force the users to only be stuck with it, umtsmon solves alot of settings issues the first time its started up.

    And it still works but you can't using because of a resolv.conf issue.

    Was this the best the opsensuse team could come up with?

    ReplyDelete
  8. kinternet and NetworkManager work together when
    the value of NETCONFIG_DNS_POLICY in /etc/sysconfig/network/config
    ist changed to
    NETCONFIG_DNS_POLICY="modem* NetworkManager"
    The nameservers will be used in that order in resolv.conf.

    Andreas

    ReplyDelete
  9. While NETWORKMANAGER=yes, the following custom netconfig policy should work:

    NETCONFIG_DNS_POLICY="STATIC_FALLBACK ppp* NetworkManager"
    or (* == settings from any interface)
    NETCONFIG_DNS_POLICY="STATIC_FALLBACK * NetworkManager"

    Set NetworkManager always as last one in the list. It aborts the evaluation (NM
    wants to be an exclusive club ;).

    Note also, that netconfig makes NETWORKMANAGER=yes check only to resolve
    the "auto" policy to "STATIC_FALLBACK NetworkManager" and inside of the
    NetworkManager policy itself.

    ReplyDelete
  10. As Andreas already wrote, while NETWORKMANAGER=yes, the following
    custom netconfig policy should work fine:

    NETCONFIG_DNS_POLICY="STATIC_FALLBACK ppp* NetworkManager"
    or (* == settings from any interface)
    NETCONFIG_DNS_POLICY="STATIC_FALLBACK * NetworkManager"

    Set NetworkManager always as last one in the list. It aborts the evaluation (NM
    wants to be an exclusive club ;).

    Note also, that netconfig makes NETWORKMANAGER=yes check only to resolve
    the "auto" policy to "STATIC_FALLBACK NetworkManager" and inside of the
    NetworkManager policy itself.

    ReplyDelete
  11. Sorry, Marius, but all I get from your workaround in /etc/sysconfig/network/config is an error:
    ./config: line 223: modem0: command not found
    This does not work for me (modem0 is the correct device). So for the time being Stefan's trick is all one can do.

    Many thanks to Stefan. But then it is most annoying that one has to dig deep into bugzilla and the blogs instead of finding a proper description of this bug in the release notes. It was a known one at least two month prior to the release date.

    Guenther

    ReplyDelete
  12. Guenther: No, it works for me. I think you forgot the quotes around the values for the variable, at least that's what I guess from the error you got.

    ReplyDelete
  13. NETCONFIG_DNS_POLICY=”STATIC_FALLBACK modem0 NetworkManager”

    However, I did not use YAST to change the setting as proposed by Marius in bug 429772. I use vi or by preference cfengine to change configuration files and restarted the network after this edit. There might be some SuSE secret behind this, some script which has to be executed in order to make these settings effective. But then I'm not interested in such things. Either it works in the usual way or it is broken. This one is broken, at least for me.
    Thanks again for publishing the little script that gives a nice workaround.

    Guenther

    ReplyDelete
  14. If this throws an error, you should file a bug report, since it means that something is broken somewhere else. This definitely works for me (with "ppp*" instead of "modem0"). And I also just edited the config file with vi...

    ReplyDelete
  15. I will most probably not file a bug report and invest even more time in a case where a bug or at least a major restriction in the network setup has been declared a feature by the maintainers. Also not including this in the release notes means wasting the time of basically everybody who tries to set up ppp on a laptop and then trying to make it work in futile attempts. This is a situation with two obvious choices: live with it or run away.

    I'm actually very disappointed as SuSE, after a long series of very nice releases from 10.2 to 11.0 with major improvements e.g. for zypper as well as minimal work for set up and configuration, managed again to publish a RC with an impressive list of unfixed bugs as the final version. I will try to convince PHB to delay the purchase of new desktop systems (we have to buy Intel Q45 now which is not well supported by 11.0 or SLED) until this list has shortened to an acceptable length.

    Sorry for abusing this blog for my rants.

    Guenther

    ReplyDelete
  16. Thanks for this thread.

    ReplyDelete
  17. Perhaps summary yet:

    OpenSUSE 11.1 and UMTSmon and Vodafone GlobeTrotter 3G+ card didn't work out of package for me.

    Solution:

    Replace
    NETCONFIG_DNS_POLICY="auto"
    with
    NETCONFIG_DNS_POLICY="ppp* NetworkManager"
    in /etc/sysconfig/network/config.

    ReplyDelete
  18. Perhaps summary yet:

    OpenSUSE 11.1 and UMTSmon and Huawei 770 3G card didn’t work out of package. I tried Jari's solution :

    by replacing
    NETCONFIG_DNS_POLICY=”auto”
    with
    NETCONFIG_DNS_POLICY=”ppp* NetworkManager”
    in /etc/sysconfig/network/config.

    and everything is fine, got DNS and routing correctly set.

    ReplyDelete
  19. Thank you! Thank you! Thank you! Thank you! Thank you!

    I installed Linux for the first time 23 hours ago after getting rid of awful vista. I was full of hope for OpenSUSE and i knew that getting on the internet was my first priority since i'm in the last year of my degree and it's all online. I was on a major downer until i found this page and the fix (i'm using a sony ericsson w890 as a modem and was starting to actually believe the guy at T-mobile who said that it wouldn't work with Linux!) since it took me a while to find the whole wvdial thing. I've basically never ever used Linux before so today (when i got back from work) was a very steep learning curve for me even though i know windows systems inside out. I'm in the armed forces so mobile internet is very important for study and staying in touch. This page just turned me from the brink of reinstalling windows - something i really didn't want to have to do.

    I can see there is so much to learn with Linux but the fact i got the internet working with a mobile in a "mere" 6 hours gives me hope!

    Right i'm off to chill out and try some of these games that came with OpenSUSE... :)

    Thanks again and have a good weekend!

    ReplyDelete
  20. Since my last most ill-tempered post one of the updates fixed the problem for me. The dial-up script now checks for DNS
    --> primary DNS address 193.189.244.205
    --> pppd: ط[06][08]��[06][08][08]�[06][08]
    --> secondary DNS address 193.189.244.197
    --> pppd: ط[06][08]��[06][08][08]�[06][08]
    --> Script /etc/ppp/ip-up run successful
    --> Default route Ok.
    --> Nameserver (DNS) Ok.
    --> Connected... Press Ctrl-C to disconnect
    and writes /etc/resolv.conf without any changes by me to the netconfig setup.

    ReplyDelete
  21. Mohamed's summary work just fine with umtsmon installed and a huawei E180 usb modem.

    ReplyDelete
  22. You could of course use bind a generic modem to the DUN address. ie for bluetooth

    bind rfcomm x xxxxxxxxx xx


    mine would be

    bind rfcomm 0 xx:xx:xx:xx: 2 where 0 is the rfcomm channel usually 0 and 2 is the the dialup networking channel of your phone etc found using sdptool. Then create a generic network manager modem connection pointed to that address ie /dev/rfcomm0

    Means you might need a script to initial it on startup, but hey linux is for just that!

    Thanks

    --

    ReplyDelete
  23. Whups SUB NM for system-config-network. ;) simpler than running scripts tho )

    ReplyDelete
  24. [...] neat workaround is described here. VirtualBox [...]

    ReplyDelete
  25. Seting up the parameter in sysconfig is working great, even in Opensuse 11.2

    Thank You!

    ReplyDelete
  26. hmm, first thing I did was to go NETWORKMANAGER=no. I use OpenDNS and specify DNS servers in Yast modem setup. /etc/resolv.conf is *not* updated on my system. Perhaps someone will find this useful.

    ReplyDelete