fixed dns and search domains
eoli3n opened this issue · 5 comments
I want to set my custom dns server and domains search, is that possible ?
nameserver X.X.X.X
nameserver X.X.X.X
search abc.domain.com def.domain.com domain.com
I did my own script:
#!/usr/bin/env bash
INTERFACE="$1"
up () {
/usr/bin/systemd-resolve \
--interface="$INTERFACE" \
--set-dns=1.1.1.1 \
--set-dns=9.9.9.9 \
--set-domain=some.domain.com \
--set-domain=sub.some.domain.com \
--set-domain=~domain.com
}
down () {
resolvectl flush-caches
}
case $script_type in
up)
up
;;
down)
down
;;
esac
exit 0
Then i can resolve server1
which fqdn is server1.sub.some.domain.com
But then it can't resolv external fqdn as github.com
There are different kinds of domain options you can pass into systemd-resolved
which governs how it will handle domains. There's DOMAIN
(appended to bare names first, and routed through to the DNS servers on this link only), DOMAIN-SEARCH
(appended to bare names if DOMAIN
didn't work, and routed through to the DNS servers on this link only), and DOMAIN-ROUTE
(just route requests for these domains through to the DNS servers on this link only).
It looks like you want a combination of DOMAIN
(for the primary domain) and DOMAIN-SEARCH
passed by the OpenVPN server into systemd-resolved
.
What do you mean by "passing" ?
I want to edit this in client.conf
, i don't manage the openvpn server.
As said in #48 (comment), I tried the following in client.conf
config /etc/openvpn/scripts/update-systemd-resolved.conf
pull-filter ignore dhcp option dns
pull-filter ignore dhcp option domain
dhcp-option dns "1.1.1.1", "9.9.9.9"
dhcp-option domain "domain.fr", "sub.domain.fr", "sub.sub.domain.fr";
It works for dns
option but domain
is not parsed as said in the comment.
Using domain-seach
does not set anything when starting openvpn.
My bad, this worked
config /etc/openvpn/scripts/update-systemd-resolved.conf
pull-filter ignore dhcp option dns
pull-filter ignore dhcp option domain
pull-filter ignore dhcp option domain-search
dhcp-option dns "1.1.1.1", "9.9.9.9"
dhcp-option domain "domain.fr"
dhcp-option domain-search "sub.domain.fr"
dhcp-option domain-search "sub.sub.domain.fr"
No problem. I'm glad it's working!