DHCP, VPN and DNS settings
Hi, I have problem with not updated resolv.conf after plugin into VPN. VPN bases on openvpn and route is set properly. I see that openvpn pushes DNS settings as foreign-option, but /var/run/dhcpcd/resolve.conf.tun1 is not created. I tried do this manually, but it didn't work. Please advice how do you deal with mixtures of wireless, VPNs, DNS. My script (tun1 is tunnel devices). parse_line() { if [ $1 = "dhcp-option" ] then if [ $2 = "DNS" ] then if [[ "x$NAMESERVER" == "x" ]] then NAMESERVER="$NAMESERVER nameserver $3" else NAMESERVER="$NAMESERVER\nnameserver $3" fi elif [ $2 = "DOMAIN" ] then DOMAIN="$DOMAIN $3" fi fi } DOMAIN="domain" for option_name in ${!foreign_option_*} do option_line="${!option_name}" parse_line $option_line done date +%s:%N echo -e $NAMESERVER >> /var/run/dhcpcd/resolv.conf.tun1 [[ $DOMAIN == "domain" ]] || echo $DOMAIN >> /var/run/dhcpcd/resolv.conf.tun1 Wawrzek -- Dr Wawrzyniec Niewodniczański or Wawrzek for short PhD in Quantum Chemistry & MSc in Molecular Engineering WWW: http://wawrzek.name E-MAIL: jobs@wawrzek.name Linux User #177124
Wawrzek Niewodniczanski <main@wawrzek.name> escribió:
I have problem with not updated resolv.conf after plugin into VPN. VPN bases on openvpn and route is set properly. I see that openvpn pushes DNS settings as foreign-option, but /var/run/dhcpcd/resolve.conf.tun1 is not created. I tried do this manually, but it didn't work. Please advice how do you deal with mixtures of wireless, VPNs, DNS.
Hi Wawrzek, You might want to check the port "openresolv" in contrib. Then change your script to do this: Interface up: (print new resolv) | resolvconf -a "$dev" Interface down: resolvconf -d "$dev" I also have a Perl script that deals with this, I wrote it before I discovered openresolv. Regards, Alan Mizrahi
participants (2)
-
Alan Mizrahi
-
Wawrzek Niewodniczanski