Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Aug 2003 16:16:55 -0700
From:      Daniel Rudy <dcrudy@pacbell.net>
To:        "David S. Jackson" <deepbsd@earthlink.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Finding your dynamic external IP
Message-ID:  <3F2D97E7.3020802@pacbell.net>
In-Reply-To: <20030803221318.GA13418@sylvester.dsj.net>
References:  <20030803221318.GA13418@sylvester.dsj.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Somewhere around the time of 08/03/2003 15:13, the world stopped and
listened as David S. Jackson spoke these words of wisdom...:

> 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?
> 

If you know what interface you are running on, then you can do this to 
get the IP address:

ifconfig <interface> | head -2 | tail -1 | awk '{print $2}'

to get the IP address.  Then if you want to mail it to yourself, then 
you can do the following:

/usr/bin/printf "Current IP address: `ifconfig <interface> | head -2 | 
tail -1 | awk '{print $2}'`\n" | /usr/bin/mail -s "IP Address 
Assignment" root &

To update your Dynamic DNS, use the following:

ddclient -use=if -if=<interface>

This will run ddclient in daemon mode so that anytime the IP address 
changes on <interface> it will update the DDNS provider's servers.
-- 
Daniel Rudy



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