I wrote this one for Novell's Cool Solutions:
[http://www.novell.com/communities/node/6781/configure-netconfig-modem-use
][]
In SLE11 we have a new (better) way to set up automatic network
configuration.
Its called netconfig (man 8 netconfig). Its a "modular tool to modify
network configuration".
Well in my SLED11 RC1 Box it pretty much worked out of the box. Except:
- When using Modem devices (eg UMTS/G3 via a Phone) DNS Servers where
not added to /etc/resolv.conf - Static search entries did not work / where overwritten by
NetworkManager
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 *' fielif [ "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=0for 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 ;; esacdone...
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.
[http://www.novell.com/communities/node/6781/configure-netconfig-modem-use
]: http://www.novell.com/communities/node/6781/configure-netconfig-modem-use