resolvloser prioritizes IPv6 in your /etc/resolv.conf
resolvloser is a tool with only one goal: reordering the nameservers in
/etc/resolv.conf so IPv6 nameservers are listed first. It does not touch any
other configuration. The lines with the nameserver options are reused, so the
structure of the original file is preserved. A header is added so you know
something might have changed, and at which date/time.
If you don't want to build yourself, there is a (x64) binary available on the releases page. It might not be complete up to date with HEAD.
It's rust, so get your toolchain up and running with either rustup or the package manager on your OS.
Then, git clone and build from the root of the repo:
cargo build --release
Copy the binary to a place of your liking, for example
# cp ./target/release/resolvloser /usr/sbin/
resolvloser takes a filename to use as input, or defaults to
otherwise. The reordered file will be output to stdout, or, if
-i is passed,
the file is modified in-place.
Automate using systemd
Check out the examples directory for example systemd path and service
files. Put them in
The path unit monitors for changes in
/etc/resolv.conf, and runs the
service unit on file changes. In the service file, make sure the
ExecStart points to the
# systemctl enable resolvloser.path
On my system, I need the
StartLimit configuration in the service file,
because some actions (toggling the WiFi radio) cause many triggers (like 6 or
so). Without these specific options, systemd rate limits the service. YMMV.
Any other place where you can create some kind of hook, you should be able to
resolvloser. Other example configurations are welcome. If you want to
/etc/resolv.conf in place, remember that you need root permissions. To
simply see what
resolvloser does with your
resolv.conf, run without
$ resolvloser -h resolvloser v0.1.0 Unrecognized option: 'h' Usage: resolvloser RESOLVCONF_FILE [options] Options: -i modify in-place (otherwise output on stdout)
I fought resolv but could not get it to do what I wanted: I was a resolvloser.
I simply wanted to have IPv6 addresses listed first, but could not find an
option anywhere. Given that there are many different pieces of software that
/etc/resolv.conf, a simple tool to reorder afterwards seems more
pragmatic than patching all the other moving parts. And it was another excuse to
write some Rust.