From owner-freebsd-questions Tue Jul 11 0:27:48 2000 Delivered-To: freebsd-questions@freebsd.org Received: from merlin.prod.itd.earthlink.net (merlin.prod.itd.earthlink.net [207.217.120.156]) by hub.freebsd.org (Postfix) with ESMTP id 1125837BD0E for ; Tue, 11 Jul 2000 00:27:42 -0700 (PDT) (envelope-from cjc@pool0290.cvx21-bradley.dialup.earthlink.net) Received: from pool0290.cvx21-bradley.dialup.earthlink.net (pool0290.cvx21-bradley.dialup.earthlink.net [209.179.193.35]) by merlin.prod.itd.earthlink.net (8.9.3-EL_1_3/8.9.3) with ESMTP id AAA24386 for ; Tue, 11 Jul 2000 00:27:39 -0700 (PDT) Received: (from cjc@localhost) by pool0290.cvx21-bradley.dialup.earthlink.net (8.9.3/8.9.3) id AAA00759 for freebsd-questions@freebsd.org; Tue, 11 Jul 2000 00:25:59 -0700 (PDT) Date: Tue, 11 Jul 2000 00:25:58 -0700 From: "Crist J. Clark" To: freebsd-questions@freebsd.org Subject: Having ppp(8) Set Hostname Message-ID: <20000711002558.D182@dialin-client.earthlink.net> Reply-To: cjclark@alum.mit.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 dialin-client ppp[58]: tun0: Command: EarthLink: shell /root/sethostfromip MYADDR Jul 11 00:23:03 dialin-client ppp[58]: tun0: Command: EarthLink: !bg /usr/sbin/sendmail -q Jul 11 00:23:03 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