#!/bin/sh #---------------------------------------------------------------------------- # /etc/ppp/ip-up200.dns - called whenever a (i)ppp connection # over default circuit has been come up and dns is installed # # Creation: 2007-11-293 lanspezi # Last Update: $Id$ #---------------------------------------------------------------------------- # back up etc/resolv.dnsmasq to etc/resolv.dnsmasq.bak # if provider supports sending ip(s) of dns server(s) #---------------------------------------------------------------------------- # is a default-route-interface going up? if [ "$is_default_route" = "yes" ] then # $interface.usepeerdns existing? if [ -f /var/run/$interface.usepeerdns ] then read usepeerdns < /var/run/$interface.usepeerdns else usepeerdns='no' fi if [ "$usepeerdns" = "yes" ] then # pppd sets DNS1 and DNS2 if [ "$DNS1" -o "$DNS2" ] then resolv_file=/etc/resolv.dnsmasq mv $resolv_file $resolv_file.bak echo "# x_USEPEERDNS is set">$resolv_file for dns in $DNS1 $DNS2 do echo "nameserver $dns">>$resolv_file done chown dns:dns $resolv_file killall -HUP dnsmasq else echo "Your provider didn't send nameserver addresses, forwarders not changed" fi fi fi