Networking Forums

Networking Forums > Computer Networking > Linux Networking > reading external ip

Reply
Thread Tools Display Modes

reading external ip

 
 
stephen
Guest
Posts: n/a

 
      08-27-2004, 03:11 AM

My ISP recently changed my IP. That's ok, they have to deal with their
problems, but I want to protect access to my home network through a script
that polls my router for its ip and then emails to my webmail account any
change in ip.

How do I do that? I've googled as well as I can, but all I get is
unanwered questions!!

Please someone suggest a fruitful query or perhaps even (oh joy!) a really
good link to the issues I'm dealing with.

Please help.

Thanks.




 
Reply With Quote
 
 
 
 
Allen Kistler
Guest
Posts: n/a

 
      08-27-2004, 03:31 AM
stephen wrote:
> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a script
> that polls my router for its ip and then emails to my webmail account any
> change in ip.
>
> How do I do that? I've googled as well as I can, but all I get is
> unanwered questions!!
>
> Please someone suggest a fruitful query or perhaps even (oh joy!) a really
> good link to the issues I'm dealing with.
>
> Please help.
>
> Thanks.


It depends on the kind of connection you have. I have PPPoE at home, so
I do what you describe in /etc/ppp/ip-up.local so I can ssh back when
I'm on the road. On my laptop I put a custom script in /sbin/ifup-local
for other reasons (i.e., no mail).

How did I find them? I read the start-up scripts to find what were the
user-defined scripts. Your distro may use different ones.
 
Reply With Quote
 
ynotssor
Guest
Posts: n/a

 
      08-27-2004, 06:07 AM
"stephen" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)

> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a
> script that polls my router for its ip and then emails to my webmail
> account any change in ip.
>
> How do I do that? I've googled as well as I can, but all I get is
> unanwered questions!!


Write a simple script that is run in a cron job.

If the output of

wget -O- whatismyip.com 2>/dev/null | awk '/Your ip/ {print $4}'

is different from the last time you checked, then send the email. ("Your ip"
is an exact literal text string, _not_ your current IP number.)

tony

--
use hotmail for email replies

 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      08-27-2004, 02:10 PM
stephen wrote:

>
> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a script
> that polls my router for its ip and then emails to my webmail account any
> change in ip.
>
> How do I do that? I've googled as well as I can, but all I get is
> unanwered questions!!
>
> Please someone suggest a fruitful query or perhaps even (oh joy!) a really
> good link to the issues I'm dealing with.


The exact answer depends on your distro, but generally, the dhcp client will
run a script after address change, which can be used to generate the
e-mail. There are a couple of ways of determining the new address. Also,
you may want to see if your host name changes, when the IP does. If not,
you've got a consistent host name, which will always provide the current
address.

--

(This space intentionally left blank)
 
Reply With Quote
 
Jeroen Geilman
Guest
Posts: n/a

 
      08-27-2004, 05:25 PM
stephen wrote:

> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a script
> that polls my router for its ip


How will this help you "protect" your LAN ?

I'm really curious as to why it would be needed.



--
J

All your bits are belong to us - again.
 
Reply With Quote
 
Jose Maria Lopez Hernandez
Guest
Posts: n/a

 
      08-27-2004, 09:26 PM
stephen wrote:
> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a script
> that polls my router for its ip and then emails to my webmail account any
> change in ip.
>
> How do I do that? I've googled as well as I can, but all I get is
> unanwered questions!!
>
> Please someone suggest a fruitful query or perhaps even (oh joy!) a really
> good link to the issues I'm dealing with.
>
> Please help.
>
> Thanks.
>
>
>
>


I think in the dyndns.org (maybe the spelling is wrong) there are some
scripts to do something like that, but it was a long time ago when I
check it and I can be wrong...


--

Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
(E-Mail Removed)
bgSEC Seguridad y Consultoria de Sistemas Informaticos
http://www.bgsec.com
ESPAÑA

The only people for me are the mad ones -- the ones who are mad to live,
mad to talk, mad to be saved, desirous of everything at the same time,
the ones who never yawn or say a commonplace thing, but burn, burn, burn
like fabulous yellow Roman candles.
-- Jack Kerouac, "On the Road"
 
Reply With Quote
 
stephen
Guest
Posts: n/a

 
      08-29-2004, 06:08 PM

> How will this help you "protect" your LAN ?
>
> I'm really curious as to why it would be needed.


Sorry, my bad explanation. I mean 'protect my access' as in maintaining my
ability to connect to my home network from outside. If my ip changes while
I'm away, I have no way of knowing my new ip. I guess I'm looking for a
way for a net node to discover the network's external ip.

The real solution, I guess, is to pay for a static ip, but I figure I'm
paying too much already for my dynamic one.

I'm looking into the ideas others have posted here.

Thanks.

 
Reply With Quote
 
stephen
Guest
Posts: n/a

 
      08-29-2004, 06:15 PM
>
> Write a simple script that is run in a cron job.
>
> If the output of
>
> wget -O- whatismyip.com 2>/dev/null | awk '/Your ip/ {print $4}'
>
> is different from the last time you checked, then send the email. ("Your ip"
> is an exact literal text string, _not_ your current IP number.)
>
> tony


I am using a DLink wireless router with a web admin interface. So
using wget I could parse out the ip address? Thank you. I give that a
try, but haven't found out how to pass authentication.

 
Reply With Quote
 
stephen
Guest
Posts: n/a

 
      08-29-2004, 06:54 PM
On Fri, 27 Aug 2004 23:26:37 +0200, Jose Maria Lopez Hernandez wrote:

> stephen wrote:
>> My ISP recently changed my IP. That's ok, they have to deal with their
>> problems, but I want to protect access to my home network through a script
>> that polls my router for its ip and then emails to my webmail account any
>> change in ip.
>>
>> How do I do that? I've googled as well as I can, but all I get is
>> unanwered questions!!
>>
>> Please someone suggest a fruitful query or perhaps even (oh joy!) a really
>> good link to the issues I'm dealing with.
>>
>> Please help.
>>
>> Thanks.
>>
>>
>>
>>

>
> I think in the dyndns.org (maybe the spelling is wrong) there are some
> scripts to do something like that, but it was a long time ago when I
> check it and I can be wrong...


Looks like just the thing. Thanks.

 
Reply With Quote
 
vhu
Guest
Posts: n/a

 
      08-30-2004, 04:47 PM
stephen wrote:

> My ISP recently changed my IP. That's ok, they have to deal with their
> problems, but I want to protect access to my home network through a script
> that polls my router for its ip and then emails to my webmail account any
> change in ip.
>
> How do I do that? I've googled as well as I can, but all I get is
> unanwered questions!!


no-ip.org is what you need. Sign up for account, you get a small client
that will track ip address of interface you specify and then it will
update your 'whatever.no-ip.org' address.

If you for some reason don't want to do it like this, you could run
script in crontab to check the current ip address of interface and
compare it to previous ip.

Here is a script you could start building on :

#!/bin/sh

ifconfig eth1 | grep "inet addr:" | cut -c 21- | cut --delimiter=" " -f
1 > /tmp/eth1-current-ip
cmp /tmp/eth1-current-ip /tmp/eth1-ip > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "IP address of eth1 has changed."
cp -f /tmp/eth1-current-ip /tmp/eth1-ip
fi
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Football. Why are you reading this? Murry Broadband 2 06-11-2010 05:22 PM
Reading\Writing to Networked External Hard Drive neil154 Windows Networking 4 09-21-2007 12:46 AM
Light Reading Jeff Liebermann Wireless Internet 6 08-13-2007 04:34 PM
reading adjecent pc's name kernel.lover Linux Networking 2 02-26-2005 05:56 PM
Please recommend some reading pjl Wireless Internet 1 08-03-2004 11:39 PM



1 2 3 4 5 6 7 8 9 10 11