Finding your dynamic external IP

Bill Campbell freebsd at
Sun Aug 3 15:35:59 PDT 2003

On Sun, Aug 03, 2003 at 06:13:18PM -0400, David S. Jackson wrote:
>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?

I set up an account on our Linux router/firewall that has a very simple C
program as its shell.  This program simply gets the SSHCLIENT environment
variable and returns it on stdout.  We have several customers on cable and
dynamic DSL connections so I have an hourly cron job that uses this to see
if their IP address has changed, then sends e-mail if it hss.

	ssh -l sshclient

INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``If the personal freedoms guaranteed by the Constitution inhibit the
government's ability to govern the people, we should look to limit those
   -President Bill Clinton, August 12, 1993

More information about the freebsd-questions mailing list