Search domains with wg-quick

Caleb Spare cespare at gmail.com
Thu Jan 24 04:37:20 CET 2019


I use Wireguard in a typical sort of "corp VPN" scenario. I use
wg-quick to bring my wg0 up and down.

What is the best way to add a search domain when my wg0 is up?

After reading the wg-quick source, I came up with this proof of
concept that *does* work on my machine:

PostUp = echo 'search mysite.com' | resolvconf -a tun.search -m 0 -x
PreDown = resolvconf -d tun.search

However, there are some problems:

- That "tun.search" string is just something I made up after seeing
the "tun.wg0" that wg-quick uses. What should I put there?
- I don't even know how the -m 0 -x flags work, or whether they're
necesary. (There was an interesting discussion between Jason and
Lennart Poettering over here, though:
https://github.com/systemd/systemd/pull/8296/files#r171215541)
- I guess I need to take some different approach in macOS; some
googling talks about "networksetup -setsearchdomains"?

Anyway, would it be reasonable to teach wg-quick about search domains,
or is doing some kind of PostUp/PreDown stuff going to be my only
option?

BTW in OpenVPN we do this with

push "dhcp-option DOMAIN mysite.com"
push "dhcp-option DNS 1.2.3.4"

Thanks!
Caleb


More information about the WireGuard mailing list