router ip address

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

anyone know how to get a network router's external ip address? any examples
w/b great!

tia,

steve
 
steve said:
anyone know how to get a network router's external ip address? any
examples w/b great!

You'll need to contact an external source to retrieve the IP.

Or your router may have an internal interface with the IP address.
 
actually, i've found 4 other ways...

1. use basic authentication in an http request to the router's web page that
shows its wan ip address and parse for it.
2. use microsoft's nat library.
3. use wmi.
4. use microsoft's upnp library.

of course, using some external site like showmyip.com would work...but i
can't guarantee they'll be up 100% of the time. thanks for your help just
the same. the easiest method seems to be getting a web page from the router
and parsing for the wan ip...since i've already got a great regexp for ip
address patterns, parsing won't be a big deal at all.

thanks again,

steve

|
| > anyone know how to get a network router's external ip address? any
| > examples w/b great!
|
| You'll need to contact an external source to retrieve the IP.
|
| Or your router may have an internal interface with the IP address.
|
| --
| Lucas Tam ([email protected])
| Please delete "REMOVE" from the e-mail address when replying.
| http://members.ebay.com/aboutme/coolspot18/
 
This isn't really a good method since it needs to be changed router to
router.

Here are two slightly better alternatives:

You could hit an external website like http://www.whatismyip.com/ which will
return the user's public IP address. The only problem with this method is
that the site may go down or be otherwise unaccessable. Note you can create
your own website that will simply return the IP without the need for parsing
and it might be more reliable; however, it can still go down.

The other alternative which works very well if your router supports it, is
to use a dynamic dns service like dyndns.org. If your router supports this
function you can sign up for a free account and have an address like
<hostname>.dyndns.org. The router will then automatically refresh the IP
every so often. Resolving this dns entry will be the IP of the router.
Allowing the user to simply input the dns address to resolve will pretty
much cover every case so the user could use any service they desired..

If anyone can think of any other more generic solutions please post them,
but for now these are the best methods I can come up with.
 

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

Similar Threads


Back
Top