Finding IP

Discussion in 'Perl Misc' started by PMR, Oct 26, 2005.

  1. PMR

    PMR Guest

    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
     
    PMR, Oct 26, 2005
    #1
    1. Advertising

  2. PMR

    Shane Guest

    On Wed, 26 Oct 2005 12:29:11 -0700, PMR wrote:

    > 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

    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Oct 26, 2005
    #2
    1. Advertising

  3. PMR

    John Bokma Guest

    "PMR" <> wrote:

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

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    I ploink googlegroups.com :)
     
    John Bokma, Oct 26, 2005
    #3
  4. PMR

    Guest

    PMR wrote:
    > 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.
     
    , Oct 26, 2005
    #4
  5. PMR

    Todd W Guest

    "PMR" <> wrote in message
    news:...
    > 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.
     
    Todd W, Oct 27, 2005
    #5
  6. PMR

    PMR Guest

    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
     
    PMR, Oct 28, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Coe

    Finding maximum clock rate

    Stephen Coe, May 16, 2004, in forum: VHDL
    Replies:
    0
    Views:
    618
    Stephen Coe
    May 16, 2004
  2. Colby L. Canutt

    Need help finding LRM Draft

    Colby L. Canutt, Sep 3, 2004, in forum: VHDL
    Replies:
    0
    Views:
    465
    Colby L. Canutt
    Sep 3, 2004
  3. rootz anabo
    Replies:
    3
    Views:
    561
    sarsizz
    Jan 2, 2005
  4. Preben Holm
    Replies:
    2
    Views:
    566
    Preben Holm
    Apr 28, 2005
  5. a_Conan

    Finding the execution time

    a_Conan, Sep 2, 2005, in forum: VHDL
    Replies:
    13
    Views:
    763
    a_Conan
    Sep 5, 2005
Loading...

Share This Page