Re: [JunkMail] Re: Finding your dynamic external IP

2003-08-04 Thread Bill Campbell
On Mon, Aug 04, 2003 at 10:07:18AM -0700, Mark Woodson wrote:
...
>dhclient allows you to execute scripts when it runs.
>
>man dhclient-scripts and see the HOOKS sections, but the gist is that you can 
>create an /etc/dhclient-(enter|exit)-hooks script to do whatever you might 
>need.

This is fine so long as your system is directly connected to the public
Internet, but doesn't work if going through a NAT router of some kind.  We
use quite a few LinkSys VPN boxes at client sites because they're cheap,
easy to configure, and reliable.  Unfortunately they're not easy to query
to find status which is why I started using the sshclient service I posted
here last week.

Bill
--
INTERNET:   [EMAIL PROTECTED]  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
URL: http://www.celestial.com/

``Freedom from prices is freedom from responsibility. You can simply pass
laws, using the magic wand of government to satisfy your own desires at
unspecified costs to be paid by others.'' -- Thomas Sowell Aug 2000
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [JunkMail] Re: Finding your dynamic external IP

2003-08-04 Thread Mark Woodson
On Monday 04 August 2003 08:39 am, Technical Director wrote:
> On Sun, 3 Aug 2003, 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?

dhclient allows you to execute scripts when it runs.

man dhclient-scripts and see the HOOKS sections, but the gist is that you can 
create an /etc/dhclient-(enter|exit)-hooks script to do whatever you might 
need.

-Mark

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-04 Thread Technical Director

Hello,

AFAIK in 4.#(.#) releases, /var/db/dhclient.leases also has the current IP
in a block format:

eg:

lease {
  interface "de0";
  fixed-address X.X.X.X;
  on and on
  ...
}

NOTE: When a new address is assigned it is "appended" to the end of the
leases file.

R.

On Sun, 3 Aug 2003, 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?
> 
> -- 
> David S. Jackson[EMAIL PROTECTED]
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Life is divided into the horrible and the miserable.
>   -- Woody Allen, "Annie Hall"
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Bob Hall
On Mon, Aug 04, 2003 at 12:21:59AM -0400, Lowell Gilbert wrote:
> "Bob Hall" <[EMAIL PROTECTED]> writes:
> 
> > On Sun, Aug 03, 2003 at 11:02:19PM -0400, Lowell Gilbert wrote:
> > > "David S. Jackson" <[EMAIL PROTECTED]> 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
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Lowell Gilbert
"Bob Hall" <[EMAIL PROTECTED]> writes:

> On Sun, Aug 03, 2003 at 11:02:19PM -0400, Lowell Gilbert wrote:
> > "David S. Jackson" <[EMAIL PROTECTED]> 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?  
Having dhclient do it for you makes sure it happens right away on
every change, automatically...
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Bob Hall
On Sun, Aug 03, 2003 at 11:02:19PM -0400, Lowell Gilbert wrote:
> "David S. Jackson" <[EMAIL PROTECTED]> 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. 

Bob Hall
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Lowell Gilbert
"David S. Jackson" <[EMAIL PROTECTED]> 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...



dhclient-exit-hooks
Description: dhclient-exit-hooks for use with noip.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Daniel Rudy
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  | 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  | 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=

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

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Finding your dynamic external IP

2003-08-03 Thread Bill Campbell
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 sshclient.celestial.com

Bill
--
INTERNET:   [EMAIL PROTECTED]  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
URL: http://www.celestial.com/

``If the personal freedoms guaranteed by the Constitution inhibit the
government's ability to govern the people, we should look to limit those
guarantees.''
   -President Bill Clinton, August 12, 1993
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"