Subject: Re: usepeerdns
To: Georges Heinesch <geohei-ml@geohei.lu>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 05/18/2001 07:31:54
In message <2923.538T5T5211869geohei9@attglobal.net>, "Georges Heinesch" writes
:
>
>But still, even if pppd is doing what it says on the man pages, the
>/etc/resolv.conf DNS servers are used despite the fact that pppd
>queries the remote for its DNS servers and that this one spits them
>out (and pppd stores them in /etc/ppp/resolv.conf). Still, the
>/etc/resolv.conf DNS servers are used, not the /etc/ppp/resolv.conf
>servers.
>
>How can I _easily_ change that?
The easiest way, if you always want the PPP resolvers used, is to lin
/etc/resolv.conf and /etc/ppp/resolv.conf together. What I did was to
perform surgery on ip-up and ip-down from xisp. Here they are, if you
want. (I'm probably going to change this, since I want to have the
dhcp-added entries removed when I"m dialed up.)
---- ip-up
#!/bin/sh
# First setup all variables passed on from pppd
#-----------------------------------------------
interface=$1
device=$2
speed=$3
localIP=$4
remoteIP=$5
ipparam=$6
# Add lines in /etc/resolv.conf for the DNS entries passed from xisp
#--------------------------------------------------------------------
if [ "$DNS1"x != x ]; then
echo "nameserver $DNS1 # xisp primary DNS line" >> /etc/resolv.conf
echo "Primary DNS: $DNS1"
fi
if [ "$DNS2"x != x ]; then
echo "nameserver $DNS2 # xisp secondary DNS line" >> /etc/resolv.conf
echo "Secondary DNS: $DNS2"
fi
---- ip-down
#!/bin/sh
# First setup all variables passed on from pppd
#-----------------------------------------------
interface=$1
device=$2
speed=$3
localIP=$4
remoteIP=$5
ipparam=$6
# Remove the lines in /etc/resolv.conf for the DNS entries passed from xisp
#---------------------------------------------------------------------------
umask 022
if [ "$DNS1"x != x ]; then
grep -v "xisp primary DNS line" /etc/resolv.conf > /etc/resolv.conf.new
mv -f /etc/resolv.conf.new /etc/resolv.conf
echo "DNS $DNS1 removed"
fi
if [ "$DNS2"x != x ]; then
grep -v "xisp secondary DNS line" /etc/resolv.conf > /etc/resolv.conf.ne
w
mv -f /etc/resolv.conf.new /etc/resolv.conf
echo "DNS $DNS2 removed"
fi
--Steve Bellovin, http://www.research.att.com/~smb