Skip to content
Override resolv.conf through environment variables
Branch: master
Clone or download
Latest commit 7b292ef Mar 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
COPYING Autotoolize Jul 14, 2013 Port to meson Mar 19, 2019
resolvconf-override.c Add copyright header Mar 19, 2019

resolvconf_override provides a shared library to be used as an LD_PRELOAD to override the nameservers listed in /etc/resolv.conf on glibc-based systems (eg. most Linux distributions).


$ mkdir build
$ cd build
$ meson ..
$ ninja


To use the Google DNS in place of the ones mentioned in /etc/resolv.conf you would run:

LD_PRELOAD=/usr/lib64/ NAMESERVER1= NAMESERVER2= myapplication

Invalid nameserver names passed as arguments are ignored.

If you want to force the use of TCP for DNS requests, set the FORCE_DNS_OVER_TCP environment variable.

Technical details

The shared library overrides the gethostbyname(), getaddrinfo() and res_init() system calls. It does not support IPv6, and might be lacking particular system calls overrides for all applications to work as expected.


This code is under the same license as the glibc itself (GNU Lesser General Public License v 2.1)

See the glibc license for details:


Copyright Bastien Nocera <> 2013,2017

You can’t perform that action at this time.