SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9
SUSE Linux Enterprise Desktop
Some administrators wish to use DHCP for obtaining server addresses (although not recommended). When using DHCP to configure the resolv.conf some needed options may not be added (as DHCP doesn't handle the options) or they are overwritten. This document is to show one way to add resolv.conf options to a dynamically created resolv.conf. While this Technical Information Document (TID) was created for the purpose of showing how to do this on servers, this can easily be applied to SLED and other workstations.
The example below may contain options not available on all systems. See the man page for the resolv.conf to determine what options are valid on your system.
Under the /etc/sysconfig/network/ directory are a couple of sub directories called if-up.d and if-down.d. These directories contain scripts that get executed after bringing the network up/down. For this example, create a file under the if-up.d directory called resolvOptions. Place the following content into it:
#! /bin/sh
check=$(grep options /etc/resolv.conf)
if ["$check" == ""]; then
echo 'options timeout:1 attempts:2' >> /etc/resolv.conf
fi
This script will be executed after bringing and interface up, or after restarting it. It will check the resolv.conf for "options" that have already been configured. If there, it will not add them again. If they aren't there, then it will add the line being echoed at the latter end of the script.
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.