SUSE Conversations


Configure Netconfig for Modem Use



By: cprause

March 24, 2009 11:30 am

Reads:368

Comments:1

Rating:0

In SLE 11 we have a new (better) way to set up automatic network configuration.

It’s called netconfig (man 8 netconfig). Its a “modular tool to modify network configuration”.

Well on my SLED 11 RC1 Box it pretty much worked out of the box. Except:

Netconfig uses a bunch of scripts in /etc/netconfig.d to do the actual work. Its configuration resides in /etc/sysconfig/network/config

The following tries to fully explains what is happening. If you’re just interested in the Solution skip down to Summary.

The modem device Problem

I use a Nokia E51 for UMTS/3G Internet connection when on the road. The setup is fairly easy using a USB Cable. Just plug in the Phone and configure it as if it was a USB Modem. (for Bluetooth setup see Accessing the Internet via Bluetooth and Mobile Phone )

Unfortunately when I do that I never got DNS servers put into /etc/resolv.conf.

What is happening

netconfig uses a bunch of script (modules) to decide what to do in certain situations. The Modules are configured using the NETCONFIG* Variables in /etc/sysconfig/network/config.

The variable NETCONFIG_DNS_POLICY is used to control how netconfig should set up Name Servers in /etc/resolv.conf

Excerpt from /etc/sysconfig/network/config (default):

...
## Type:        string
## Default:     "auto"
#
# Defines the DNS merge policy as documented in netconfig(8) manual page.
# Set to "" to disable DNS configuration.
#
NETCONFIG_DNS_POLICY="auto"
...

Unfortunately man 8 netconfig only has this to say about NETCONFIG_DNS_POLICY:

NETCONFIG_DNS_POLICY -Defines the DNS merge policy.

Nothing about what the actual Values could be.

The /etc/netconfig.d/dns-resolver script is responsible for setting resolv.conf so we find our possible values here:

Excerpt from /etc/netconfig.d/dns-resolver (SLED 11 Rc1 Version):

...
# just for the case we need the original value...
_NETCONFIG_DNS_POLICY="$NETCONFIG_DNS_POLICY"
if [ "$_NETCONFIG_DNS_POLICY" = "auto" ]; then
    if [ "x$NETWORKMANAGER" = "xyes" ] ; then
        #
        # Use NetworkManager policy merged data
        #
        _NETCONFIG_DNS_POLICY='STATIC_FALLBACK NetworkManager'
    else
        #
        # We use static settings and extend them
        # with interface specific if available
        #
        _NETCONFIG_DNS_POLICY='STATIC *'
    fi
elif [ "x$_NETCONFIG_DNS_POLICY" = "x" ]; then
    #
    # empty policy means do not touch anything.
    # successful exit.
    #
    exit 0;
fi
#
# A * or ? is evaluated in the "for loop", so we need to replace it
#
_NETCONFIG_DNS_POLICY=`echo "$_NETCONFIG_DNS_POLICY" | \
        sed 's/\*/__ALL__/g' | sed 's/\?/__ONE__/g'`

sf=0
for POL in $_NETCONFIG_DNS_POLICY; do
    case "$POL" in
    (NetworkManager)
        if [ "x$NETWORKMANAGER" = "xyes" ] ; then
            debug "Use NetworkManager policy merged settings"
            CFG="$STATEDIR/NetworkManager.netconfig"
            if [ -r "$CFG" ] ; then
                get_dns_settings "$CFG"
            fi
            break
        fi
    ;;
    (STATIC)
        debug "Keep Static"
        DNS_SEARCHLIST="$DNS_SEARCHLIST $NETCONFIG_DNS_STATIC_SEARCHLIST"
        DNS_SERVERS="$DNS_SERVERS $NETCONFIG_DNS_STATIC_SERVERS"
    ;;
    (STATIC_FALLBACK)
        debug "Static Fallback"
        sf=1
    ;;
    (*)
        #
        # revert the replacement; now we want the evaluation
        #
        POL=`echo "$POL" | sed 's/__ALL__/*/g' | sed 's/__ONE__/?/g'`
        debug "Other: $POL"
        for IFDIR in $STATEDIR/$POL; do
            test -d "$IFDIR" -a \
                 -d "/sys/class/net/${IFDIR##*/}" || continue
            # proceed every interface we find with this match
            manage_interfaceconfig  "$IFDIR"
        done
    ;;
    esac
done
...

This tells us that we can use the values auto, STATIC, STATIC_FALLBACK, NetworkManager and /sys/class/net/ Interfaces ( with * and ? wildcards ).

The Cause

What it also tells us is that the default auto only is translated to STATIC_FALLBACK NetworkManager and no devices.

This is why any ppp or modem device connections will not be used for Name Server setup in the default configuration.

There is a good reason for that. /etc/resolv.conf only supports up to 3 nameserver Entries.

This means if you have for instance 2 DNS Servers in ppp and 2 more coming from NetworkManager one is going to fall off the grid.

So for the sake of a stable NetworkManager setup the default was chosen to not include ppp* or modem* devices. See bnc#429772)

The Solution

Configure NETCONFIG_DNS_POLICY to include all Network Devices we need. In my case I need modem0. Of cource preserve STATIC and NetworkManager as well. Put NetworkManager last. Its a bit of a Bully and wants to be the last one to do things.

Excerpt from /etc/sysconfig/network/config

NETCONFIG_DNS_POLICY="STATIC_FALLBACK modem* NetworkManager"

Et voila! Working DNS resolving when dialing in via Modem.

Summary

To be able to have DNS resolution when dialed in via modem configure netconfig to look for your (ppp or modem) devices:

Excerpt from /etc/sysconfig/network/config

NETCONFIG_DNS_POLICY="STATIC_FALLBACK modem* NetworkManager"

Please be aware that all sources might provide Name Servers. This could mean that there will be more that the max of 3 for /etc/ressolv.conf.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: ,
Categories: SUSE Linux Enterprise Desktop, Technical Solutions

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

1 Comment

  1. By:tsurmacz

    More convenient is to use UMTSMon application which handles the GSM modem connections.

    For SLED 11 you can try the build:
    http://download.opensuse.org/repositories/openSUSE:/11.1/standard/i586/umtsmon-0.9.51.20081117-1.10.i586.rpm

Comment

RSS