Finding IP

P

PMR

I have a FC4 box running as a web server with an internal IP
192.168.1.5 running behind an ADSL router connected to the 'net via a
dynamic IP. I have a domain which is hosted by a company and any
requests to that domain name get sent to a Perl script running on those
machines, which looks up its most recent record of my server's IP in a
text file and redirects to my machine.

The router receives the request, and my FC4/Apache box is set up as a
DMZ host so it receives the requests.

Problem is I have a cron script running on my local server which
updates my local server/router's IP on my hosted website every 2minutes
and the IP is determined based on the REMOTE_ADDR environment variable
set when I make a HTTP request to the update script - this is hogging
resources.

I need a script to run on my local server that only updates my IP on my
remote server when it detects my local IP changes. Problem is how do I
find the IP address of my server - as it would appear to 'the world'
(i.e. actually the external IP of the router) from a script run on the
server itself?

Any hints would be appreciated!

Cheers

Pete
 
S

Shane

I have a FC4 box running as a web server with an internal IP
192.168.1.5 running behind an ADSL router connected to the 'net via a
dynamic IP. I have a domain which is hosted by a company and any
requests to that domain name get sent to a Perl script running on those
machines, which looks up its most recent record of my server's IP in a
text file and redirects to my machine.

The router receives the request, and my FC4/Apache box is set up as a
DMZ host so it receives the requests.

Problem is I have a cron script running on my local server which
updates my local server/router's IP on my hosted website every 2minutes
and the IP is determined based on the REMOTE_ADDR environment variable
set when I make a HTTP request to the update script - this is hogging
resources.

I need a script to run on my local server that only updates my IP on my
remote server when it detects my local IP changes. Problem is how do I
find the IP address of my server - as it would appear to 'the world'
(i.e. actually the external IP of the router) from a script run on the
server itself?

Any hints would be appreciated!

Cheers

Pete

I wrote a script that did this for me at home, You need the routers
commands, and then make a script to telnet the router, asking it to tell
you its current external ip.
My script, upon detecting a change, then emails my gmail account so that I
am made aware of the change regardless of where I am, although
Web::Mechanize could be used to login to the dyndns site and update the
account(s)

So first question, what sort of router/modem, and do you have the commands
 
J

John Bokma

PMR said:
I need a script to run on my local server that only updates my IP on my
remote server when it detects my local IP changes. Problem is how do I
find the IP address of my server - as it would appear to 'the world'
(i.e. actually the external IP of the router) from a script run on the
server itself?

Ask the router.
 
U

usenet

PMR said:
I need a script to run on my local server that only updates my IP on my
remote server when it detects my local IP changes.

As others have said, you get this info from your router. It (probably)
has a web-based administration interface - you use Perl to capture the
output from the "status" page and parse the raw HTML for your WAN
address.

But, I'm curious: do you find your DHCP address actually changes? I've
had the same IP address (via DHCP) for more than two years. Even if my
router is shut down for several days, I can connect again and pick up
the same address.
 
T

Todd W

PMR said:
I have a FC4 box running as a web server with an internal IP
192.168.1.5 running behind an ADSL router connected to the 'net via a
dynamic IP. I have a domain which is hosted by a company and any
requests to that domain name get sent to a Perl script running on those
machines, which looks up its most recent record of my server's IP in a
text file and redirects to my machine.

The router receives the request, and my FC4/Apache box is set up as a
DMZ host so it receives the requests.

Problem is I have a cron script running on my local server which
updates my local server/router's IP on my hosted website every 2minutes
and the IP is determined based on the REMOTE_ADDR environment variable
set when I make a HTTP request to the update script - this is hogging
resources.

I need a script to run on my local server that only updates my IP on my
remote server when it detects my local IP changes. Problem is how do I
find the IP address of my server - as it would appear to 'the world'
(i.e. actually the external IP of the router) from a script run on the
server itself?

I have the same setup, I use ddclient to update my dynamic IP with
dyndns.org:

http://dag.wieers.com/packages/ddclient/

Todd W.
 
P

PMR

Yes my WAN IP (assigned by DHCP) is changing approx every 2 days by my
ISP which is very annoying. Thanks for the replies, I think connecting
to the router and parsing the HTML sounds like a good idea.

Cheers all

Pete Reid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top