By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

Getting the public IP of a FIOS router

I'm new to FIOS. So far it's working well. Since I run an FTP server, I need to know the public IP address of my router. It's cumbersome to HTTP to the modem, give a password, and read the IP from the screen. Google turned up this command (with output).
v:\> nslookup -type=a myip.opendns.com resolver1.opendns.com
Server:  resolver1.opendns.com

Non-authoritative answer:
Name:    myip.opendns.com

Using "2>NUL" to get rid of "Non-authoritative answer:" and wrapping it up in a couple TCC functions, I now have this.

v:\> echo %@word[1,%@execstr[4,nslookup -type=a myip.opendns.com resolver1.opendns.com 2>nul]]

I suppose I'll further wrap that up into an alias or a user-defined function.

I'd love to see other solutions.
That's pretty slick. I assume there's something special about myip.opendns.com?
That's pretty slick. I assume there's something special about myip.opendns.com?
I suppose it's special in that its sole purpose is to return the IP from which the request came.

If you have DIG.EXE, you don't have to do much parsing.
v:\> dig +short myip.opendns.com @resolver1.opendns.com
I think it works like this. Both NSLOOKUP and DIG are told to use the DNS server resolver1.opendns.com. And that seems to be a real DNS server.
v:\> dig +short lucky.syr.edu @resolver1.opendns.com
That's correct, though I don't know why my former employer hasn't removed that record; it's almost a year out of date.

What's special is the name "myip.opendns.com". When that name is queried, resolver1.opendns.com returns the IP from which the query came. It's so simple that I wonder why such a mechanism isn't universally implemented by DNS servers.