in reply to ip and router

nathanvit,
I do not like this one bit - you really need to consider what could go wrong and try to develop a solution with that stuff in mind. For instance - is the reason the router changes it's IP everyday for security? If yes, you are now sending the IP in an email over the Internet. Only you will know the things that could go wrong, so I won't get up on a soapbox.

  • Create an alias that pipes the email to a script getip : "| /usr/local/bin/get_ip.pl"
  • In the get_ip.pl script, have it ping your broadcast 192.168.0.255 for instance
  • Have the script then perform an arp -a
  • You will have to hardcode the MAC address of the router so it will know what to look for - use a regex to extract the IP address
  • Finally, have the script send the IP to your home address system("echo $ip | mailx -s "today's IP" youraccount\@nowhere.com");

    Best of luck - L~R

  • Replies are listed 'Best First'.
    Re: Re: ip and router
    by u914 (Pilgrim) on May 26, 2003 at 17:18 UTC
      Would not a simple crontab entry on the private-network linux box work?

      0 23 * * * echo "message" | mailx -s "xx" account@some.place
      Then, just intercept the incoming mail message and parse it for the IP address...

      This is no more insecure (in terms of sending the IP across the network) than sending any other mail through the router.

      hmm.

      i agree that it's wierd for a router to change it's IP though....

        914,
        An email message doesn't retain the IP address of the router's that it was routed through - only the MTAs. There is no guarantee of this since any MTA can strip those headers (that's how remailers work).

        While this would work in a script that gets the IP before sending the email- it adds several new security concerns. What happens if nathanvit forgets to shut off the cronjob before going on vacation. He isn't around to monitor his email and his mailbox fills up - where does the undeliverable go?

        This is just plain bad juju - I don't like this one bit, I do not like it Sam I am.

        L~R

          hmmm... good point.

          I suppose he could also use one of the dynamic DNS services, and simply assign his host a name, and get to it that way...

          It's my (imperfect) understanding that those services run a small daemon on the client machine which updates the hostname/IP mapping every so often.