Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Avoid creating PPTP default routes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Avoid creating PPTP default routes
Authored by: ework on Feb 14, '05 05:41:22PM

Sorry I made an error again. I tried these scripts on a new network that only gives one DNS value. I have fixed the script for the these situations below.

[ /etc/ppp/ip-up ]
#!/bin/sh

DOMAIN=$6
NETMASK=`echo $IPLOCAL | awk -F. '{OFS = "."}{print $1,$2,$3}'`
REVERSE=`echo $IPLOCAL | awk -F. '{OFS = "."}{print $3,$2,$1}'`

if [ `basename $0` = "ip-up" ] ; then
/sbin/route -n add -net $NETMASK $IPREMOTE
cat /etc/resolv.conf | sed s/^domain/#domain/ > /etc/resolv.conf
echo "domain $DOMAIN" >> /etc/resolv.conf
echo "nameserver $DNS1" > /etc/resolver/$DOMAIN
if [ "$DNS2" != "" ] ; then
echo "nameserver $DNS2" >> /etc/resolver/$DOMAIN
fi
ln -s $DOMAIN /etc/resolver/$REVERSE.in-addr.arpa
else
/sbin/route -n delete -net $NETMASK $IPREMOTE
cat /etc/resolv.conf | grep -v "domain $DOMAIN" > /etc/resolv.conf
cat /etc/resolv.conf | sed s/^#domain/domain/ > /etc/resolv.conf
rm -f /etc/resolver/$DOMAIN
rm -f /etc/resolver/$REVERSE.in-addr.arpa
fi



[ Reply to This | # ]
Avoid creating PPTP default routes
Authored by: ybizeul on Feb 21, '05 10:33:58AM

That's a **really** great tip.
By the way, I found the resolver does not always seem to update itself with the new file in /etc/resolver
When that happen, it seems renaming the file to .tmp, the move it back to the good name solve the issue.
I tried to touch the file or touch the directory without success.

The only thing I did to make it work is generating the file in /tmp, the mv it to /etc/resolver.



[ Reply to This | # ]