New WAN lease overwrites DNS

I use my LEDE router as openvpn client. I configured my openvpn according to this tutorial: https://gist.github.com/braian87b/64440dec125d2b2f0ddc600c490988db

It works great at first and the updns script sets my DNS servers to the DNS servers pushed from the VPN server. The problem is when my ISP renews my lease. The following lines show up in syslog.

Tue Mar 17 14:18:57 2020 daemon.notice netifd: wan (1083): udhcpc: sending renew
Tue Mar 17 14:18:58 2020 daemon.notice netifd: wan (1083): udhcpc: lease of xxx.xxx.xxx.xxx obtained, lease time 5400
Tue Mar 17 14:18:58 2020 daemon.info dnsmasq[10314]: reading /tmp/resolv.conf.auto
Tue Mar 17 14:18:58 2020 daemon.info dnsmasq[10314]: using local addresses only for domain lan
Tue Mar 17 14:18:58 2020 daemon.info dnsmasq[10314]: using nameserver yyy.yyy.yyy.yyy#53
Tue Mar 17 14:18:58 2020 daemon.info dnsmasq[10314]: using nameserver zzz.zzz.zzz.zzz#53

After that, the vpn dns servers are gone from the /tmp/resolv.conf.auto.
How can I keep my DNS servers form the VPN?
So, I want to either ignore or append the WAN DNS servers to /tmp/resolv.conf.auto

Thanks in advance

You can try to ignore the nameservers advertised by your ISP and hardcode the ones you want instead. I hope that the dhcp renewal will not then trigger the rewritting of resolv.conf.auto.

1 Like