PDA

View Full Version : any way to determine real IP address through router or w/router in the way


bloozman
03-11-2006, 06:41 PM
It's clear that it should be easy enough to determine one's DHCP assigned IP address if you take your cable modem and run the outgoing ethernet right into the back of your machine. However, is there a tricky, sneaky way to determine what that real assigned underlying ip address is if the modem runs through a router first, in other words with the router still in the way?

Reading one of your recent posts, this link offered up by DarrellGreenwood

http://www.cccomm.info/support/dhcp_ts.html

explains a lot of the basics, but we all know the IP address using those various methods will yield 192.168.1.100 or something similar through a router. Solving it by unhooking the router is one thing, and of course, the simple solution. However, is there a way to do it leaving any routers in the way? Is there a relatively easy approach?

I ask this question because my 78 mother switched ISPs and I can no longer use VNC to take over her East Coast machine remotely from the West Coast anymore to help her solve simple problems. Trying to explain to her over the phone how to find her cable line and unhook and bypass her router is not an easy thing. It is also inconvenient to do on a regular basis. However, if there was some sneaky way I could learn to determine an IP address using software, maybe with some Unix commands via the terminal, then we would have an alternative approach. I can test anything you would offer using my own IP address here through my router(s) on my Mac.

I thought it was an interesting question. I am pretty certain that my particular situation will involve having to open a port on her system, but I suspect one part of this will still require determining the underlying IP address. Perhaps there is no solution through the router, but I thought some of you geniuses might know of one.

Possibly complicating matters, she is now using VIOS, which is not entirely typical internet service either. I am now endeavoring to read up on this and figure out if there is anything uniquely different about VIOS configuration and any attached router.

Thanks in advance, Bloozman

cwtnospam
03-11-2006, 06:50 PM
http://whatismyip.com/

tbsingleton73
03-11-2006, 07:55 PM
I use Wimp (http://www.versiontracker.com/dyn/moreinfo/macosx/28938), which emails me the IP Address of my computer everytime it detects a change.

tbsingleton73
03-11-2006, 09:36 PM
Hi Guys,

What I want to be able to do is use a comman in Terminal to determine the IP Address that has been assigned to my router from my ISP. I am not looking for the IP assigned to my Mac from the router.

I know I can do this other ways, but I'm looking for the Terminal way.
using ifconfig doesn't seem to give that info, unless I'm missing some -option.

I have searched both Google and these forums but can't find what I'm looking for.

If someone know the command or can point me to another post that covers this, that would be helpfull.

Thanks in advanced.

hayne
03-11-2006, 10:15 PM
What I want to be able to do is use a comman in Terminal to determine the IP Address that has been assigned to my router from my ISP.

I merged your new thread into this existing thread since it is on the same topic.
I'm not sure why you are asking the question after having just answered this question above in this thread.

I.e. there is no way to find out the external address of the router except by asking the router, or by communicating with an external site and then asking that external site what IP address was used.
To ask the router would depend on what facilities are provided by the router.
Most consumer-level routers don't provide any (easy) way to get this info - you need to go via their configuration web-page.

hayne
03-11-2006, 10:22 PM
Here's a Perl script that extracts the IP address from the HTML from www.whatismyip.com:

#!/usr/bin/perl

my $url = "http://www.whatismyip.com/";
my $html = `/usr/bin/curl -s -f $url`;

if ($html =~ /<TITLE>[^\d]*(\d+\.\d+\.\d+\.\d+)/i)
{
my $ipaddr = $1;
print $ipaddr;
print "\n"; # remove this line if newline at end not wanted
exit;
}
print STDERR "Failed to get IP address from $url\n";
exit;

tbsingleton73
03-12-2006, 04:44 AM
Thank for the tranfer to this post and the answer, hayne.
I was looking for a command in Terminal but you confirmed that my frustration in looking was that you can't do what I want in Terminal with one command (like ifconfig or netstat).
Thank you for your script, I will give that a try.

cpragman
03-12-2006, 05:39 AM
there is also http://dyndns.org (http://www.dyndns.org), which lets you generate a URL that always points to your machine.

carouzal
03-12-2006, 06:05 AM
I use the following bash script, works well for me.

#!/bin/bash
curl -s http://checkip.dyndns.org | awk '{print $6}' | awk ' BEGIN { FS = "<" } { print $1 } '

acme.mail.order
03-12-2006, 07:19 AM
I was looking for a command in Terminal but you confirmed that my frustration in looking was that you can't do what I want in Terminal with one command (like ifconfig or netstat).

Sure you can. You are just not thinking the same way that unix works. You want to ask a question and receive the answer (one command, like curl) but the answer contains excess information, so we need to trim it down a bit (awk|sed|perl etc).
So take carouzal's script, save it in one of the appropriate directories and you have your single command.

tbsingleton73
03-12-2006, 08:38 AM
You are just not thinking the same way that unix works
You're right, I am not thinking about it correctly, and I am just getting into the Unix book I bought, so it's making more since then it was.

Thanks to carouzal for the bash spript, I have added it to a .sh file to retreive my IP Address and I've added it as an extra line in a status.sh that now outputs "My IP Address: xxx.xxx.xxx.xx"

Thanks guys for all your help. Just what I was looking for.