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:


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:


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


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


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

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,


Published by

Gene A.

Gene is a "Unix Guy", network technologist, system trouble-shooter and IT generalist with over 20 years experience in the SOHO and SMB markets. He is familiar with and conversant in eComStation (a.k.a. OS/2), DOS (PC, MS and Free), Unix, Linux and those GUI based systems from Microsoft. Gene is also a follower of Jesus (forgiven, not perfect), and this does inform his world view.

2 thoughts on “Managing Mandriva’s /etc/resolv.conf from the CLI”

  1. Update: I have discovered the content of the base file is only added to /etc/resolv.conf if it has nameserver lines in it. It will still be parsed but all comments in the base file are ignored.

Comments are closed.