Tux + Linux Items

Help promote Linux and FOSS at the
Sample T-Shirt from the ERACC Cafe Press Store
ERACC Cafe Press Store

Managing Mandriva’s /etc/resolv.conf from the CLI

There appears to be confusion in the Mandriva community about how to manage a PC using a static IP address (no DHCP client) with static nameserver entries in /etc/resolv.conf from the Linux command line interface (CLI). With newer versions of Mandriva the /etc/resolv.conf file is managed by the /sbin/resolvconf executable. There is a comment in /etc/resolv.conf to not edit the file directly as it will be overwritten.

The proper files to edit under Mandriva for /etc/resolv.conf at this point are in /var/run/resolvconf/interface/ and/or /etc/resolvconf/resolv.conf.d/. If one wants the individual interfaces, say on a laptop, to use different nameservers then edit the files in /var/run/resolvconf/interface/. Most folks use a laptop with DHCP only and thus the nameserver entries are managed automatically. There are situations where that may not be practical so this information is provided for those situations. However, for a desktop or tower PC with a static IP address one will most likely be using a single interface. Therefore one will edit the /etc/resolvconf/resolv.conf.d/base file to include up to three nameserver entries. Note that the base file is only parsed if it has only lines starting with nameserver in it. Here is an example /etc/resolvconf/resolv.conf.d/base file:

nameserver 10.0.0.1
nameserver 10.0.1.2
nameserver 10.1.2.3

The /etc/resolvconf/resolv.conf.d/base, /etc/resolvconf/resolv.conf.d/head and /etc/resolvconf/resolv.conf.d/tail files are explained in the resolvconf man page:

/etc/resolvconf/resolv.conf.d/base

     File  containing  basic resolver information.
     The lines in this file are included in the
     resolver configuration file  even  when no
     interfaces are configured.

/etc/resolvconf/resolv.conf.d/head

     File  to be prepended to the dynamically
     generated resolver configuration file.
     Normally this is just a comment line.

/etc/resolvconf/resolv.conf.d/tail

     File to be appended to the dynamically
     generated  resolver  configuration file.
     To append nothing, make this an empty
     file.

If one discovers that resolvconf is being used based on the comment in the /etc/resolv.conf file then reading the man page for resolvconf can be enlightening,

Share

2 comments to Managing Mandriva’s /etc/resolv.conf from the CLI