Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Aug 2003 01:30:03 -0400
From:      "Bob Hall" <rjhjr@cox.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Finding your dynamic external IP
Message-ID:  <20030804053003.GA24096@kongemord.krig.net>
In-Reply-To: <44fzkicas8.fsf@be-well.ilk.org>
References:  <20030803221318.GA13418@sylvester.dsj.net> <44ptjm9lc4.fsf@be-well.ilk.org> <20030804041209.GB23334@kongemord.krig.net> <44fzkicas8.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 04, 2003 at 12:21:59AM -0400, Lowell Gilbert wrote:
> "Bob Hall" <rjhjr@cox.net> writes:
> 
> > On Sun, Aug 03, 2003 at 11:02:19PM -0400, Lowell Gilbert wrote:
> > > "David S. Jackson" <deepbsd@earthlink.net> writes:
> > > 
> > > > If your external IP number changes, as with DHCP, is there a way
> > > > to find out what it currently is?  I was thinking you could keep
> > > > BitchX logged into a chat channel and script a /dns yournick and
> > > > email yourself the results from time to time.   
> > > > 
> > > > How would you do it?
> > > 
> > > For DHCP specifically, the best thing to do is to use the
> > > dhclient-exit-hooks script to do whatever you want.  My particular
> > > example is attached...
> > 
> > I use
> > 	ifconfig rl0 | grep "inet " | awk '{print $2}'
> > where rl0 is my external interface. 
> 
> And how do you decide when to run that?  

My ISP isn't going to change my IP address while I'm using it, so 
as long as my dhclient is doing its job and renewing the lease in a
timely manner, the IP number won't change. For an always-on connection, 
I run it when I boot the gateway box. When I was using a dial-up 
connection regularly, I had a script that grepped the output from 
netstat to get IP addresses. Obviously, I ran that when I dialed up.

Bob Hall



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030804053003.GA24096>