Overwriting domains to an OpenVPN connection that was added via NetworkManager
- After adding your OpenVPN connection using NetworkManager, a config file will be created in the folder
/etc/NetworkManager/system-connections/<connection-name>
. - Edit the file above and make sure you have blocks
ipv4
andipv6
with the optionsdns-search
set with all domains you want to overwrite (separated by semicolons). For example, for the domainsmydomain.lan
andmydomain.zone
, it should look like:
[ipv4]
dns-search=mydomain.lan;mydomain.zone
method=auto
never-default=true
[ipv6]
addr-gen-mode=stable-privacy
dns-search=mydomain.lan;mydomain.zone
method=auto
never-default=true
- Finally, restart the NetworkManager service and reconnected to your VPN.
systemctl restart NetworkManager
Extra note:
You can also check how the sytemd-resolved looks like by running:
systemd-resolve --status
The output for your connection should be similar to:
Link 43 (tun1)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 192.168.1.1
192.168.1.2
DNS Domain: mydomain.lan
mydomain.zone