My Favorites

Close

Please to see your favorites.


How To Add "options" To A Dynamically Created /etc/resolv.conf

This document (7011591) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 9
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 11
Novell Open Enterprise Server 2 (OES 2) Linux
Novell Open Enterprise Server 11 (OES 11) Linux
SUSE Linux Enterprise Desktop (SLED)

Situation

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.

Resolution

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.

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/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.

  • Document ID:7011591
  • Creation Date:08-JAN-13
  • Modified Date:08-JAN-13
    • SUSESUSE Linux Enterprise Server

Did this document solve your problem? Provide Feedback