Fixing wg-quick's DNS= directive with a hatchet

Jason A. Donenfeld Jason at zx2c4.com
Thu Oct 26 05:21:38 CEST 2017


On Thu, Oct 26, 2017 at 4:54 AM, Eric Light <eric at ericlight.com> wrote:
> It looks ... really elegant to me.  That said, it could end up being
> super confusing.  I definitely second Kalin's comments about adding a
> comment header to /etc/resolv.conf.wg-quick.wg0

I thought it was a good suggestion too, so I implemented it. Here's
what it looks like:

zx2c4 at thinkpad ~ $ wg-quick up martino
[#] ip link add martino type wireguard
[#] wg setconf martino /dev/fd/63
[#] ip address add 10.10.11.100/32 dev martino
[#] ip link set mtu 1420 dev martino
[#] ip link set martino up
[#] mount -Br /etc/resolv.conf.wg-quick.martino /etc/resolv.conf
[#] wg set martino fwmark 51820
[#] ip -4 route add 0.0.0.0/0 dev martino table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
[#] ip -4 rule add table main suppress_prefixlength 0

zx2c4 at thinkpad ~ $ cat /etc/resolv.conf
# This file was generated by wg-quick(8) for use with
# the WireGuard interface martino. It cannot be
# removed or altered directly. You may remove this file
# by running `wg-quick down martino`, or if that
# poses problems, run `umount /etc/resolv.conf`.
nameserver 10.10.11.1

zx2c4 at thinkpad ~ $ wg-quick down martino
[#] ip -4 rule delete table 51820
[#] ip -4 rule delete table main suppress_prefixlength 0
[#] ip link delete dev martino
[#] umount /etc/resolv.conf

> All that's left is for me to hat-tip your Paulsen reference.  I still
> have that book at home, probably been 20 years since I've read it.
> Linux certainly has an abundance of porcupines buried in the terrain.

:) Must have read it at least ten times as a kid...


More information about the WireGuard mailing list