Date: Tue, 11 Jul 2000 00:25:58 -0700 From: "Crist J. Clark" <cristjc@earthlink.net> To: freebsd-questions@freebsd.org Subject: Having ppp(8) Set Hostname Message-ID: <20000711002558.D182@dialin-client.earthlink.net>
next in thread | raw e-mail | index | archive | help
My mail forwarding recently stopped working unless my PC has a valid
hostname. I am trying to get ppp(8) to set the hostname
automatically... but it turning out to be a lot harder than I
thought. I am trying to get it done in a ppp.linkup,
EarthLink:
shell /root/sethostfromip MYADDR
!bg /usr/sbin/sendmail -q
!bg su cjc -c /usr/local/bin/fetchmail
The script 'sethostfromip' does a reverse-lookup of MYADDR and tries
to set the hostname accordingly (yeah, a quick program would probably
be better, but I'm lazy),
if [ expr $1 : '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' > /dev/null 2>&1 ]; then
IP=$1
else
IP=`ifconfig tun0 | awk '/inet/ { print $2 }'`
fi
HOSTNAME=`nslookup $IP | awk '/^Name:/ { print $2 }'`
hostname $HOSTNAME
However, the nslookup keeps failing and neither the sendmail or
fetchmail runs very reliably. Here the stderr output from the
sethostfromip when I wake up the PPP connection right now,
*** Can't find server name for address 207.217.126.81: Timed out
*** Can't find server name for address 207.217.77.82: Timed out
*** Default servers are not available
Here is the ppp.log showing those actually being run,
Jul 11 00:22:31 <daemon.info> dialin-client ppp[58]: tun0: Command: EarthLink: shell /root/sethostfromip MYADDR
Jul 11 00:23:03 <daemon.info> dialin-client ppp[58]: tun0: Command: EarthLink: !bg /usr/sbin/sendmail -q
Jul 11 00:23:03 <daemon.info> dialin-client ppp[58]: tun0: Command: EarthLink: !bg su cjc -c /usr/local/bin/fetchmail
Others must be setting new hostname when they do a dialup, right? How
do you do it? I'm suprised it's not an option built into ppp... Or is
it and I have not managed to find it?
--
Crist J. Clark cjclark@alum.mit.edu
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000711002558.D182>
