OpenWrt Forum Archive

Topic: OpenVPN client on WRT make dnsmasq use DNS servers pushed from server

The content of this topic has been archived on 26 Feb 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, im running OpenVPN as a client on my WRT, the server is pushing the dns server dhcp option to the client however it is not being set. When the OpenVPN client connects i would like the dns server to be used over the VPN rather than my local router's dns server, any direction which scripts should i add/edit?

I need dnsmasq to be running as i would like lan clients to use the WRT as the dns server. I simply want the requests to be forwarded to the server on the lan but the /tmp/resolv.conf files are not changed.

Current files are:

# cat /tmp/resolv.conf
nameserver 127.0.0.1
search lan

# cat /tmp/resolv.conf.auto
nameserver 192.168.1.1

i am running White Russian 0.9

Thanks in advance

Right i have managed to read the option in the up-script for the openvpn client and it works, i set in the up script:

dns1=`echo ${foreign_option_1} | sed -e 's/dhcp-option DNS //g'`
echo nameserver $dns1 > /tmp/resolv.conf.auto

and all is good smile

Cheers

The discussion might have continued from here.