473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

router ip address

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

tia,

steve
Nov 20 '05 #1
3 2830
"steve" <a@b.com> wrote in news:10*************@corp.supernews.com:
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 (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2
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

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn**************************@140.99.99.130...
| "steve" <a@b.com> wrote in news:10*************@corp.supernews.com:
|
| > 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 (RE********@rogers.com)
| Please delete "REMOVE" from the e-mail address when replying.
| http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #3
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.
"Brooke" <Br****@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
Steve, I am not sure what router you have, but here is how I did it. If you hear of a better way, please let me know.

Oh, You will need to make a new form and add these properties
webbrowser - called WebBrowser1
label - called label1
timer - Timer1

---------------------------------------------------------
Option Explicit
Dim webtx As String

Private Function RefreshPage()
Dim K1 As Integer, k2 As Integer, k3 As Integer, result As Integer
Dim IPaddress1 As String, IPaddress2 As String
If WebBrowser1.Visible = True Then
WebBrowser1.Refresh
End If
webtx = WebBrowser1.Document.body.innertext
If Len(webtx) > 50 Then
K1 = InStr(1, webtx, "IP Address")
k2 = InStr(K1 + 11, webtx, "IP Address")
IPaddress1 = Mid(webtx, k2 + 11, 16)
k3 = InStr(IPaddress1, " ")
IPaddress2 = Mid(IPaddress1, 1, k3 - 1)
Else
result = MsgBox("Login Not Confirmed, Please Try Again", vbOKCancel) If result = 1 Then
WebBrowser1.Stop
Form_Load
Else
End
End If
End If
WebBrowser1.Visible = False
Label1.Caption = "IP = " + IPaddress2
End Function

Private Sub Form_Load()
Dim result As Boolean
' position the Web Browser control below the command button.
WebBrowser1.Move 0, 200
' navigate to a Web site for testing purposes.
WebBrowser1.Navigate "192.168.0.1/st_devic.html"
Do Until Not WebBrowser1.Busy And WebBrowser1.ReadyState = 4
DoEvents
Loop
result = RefreshPage()
End Sub
' Use this if you want to keep the program running and refresh the IP once
and hour
Private Sub Timer1_Timer()
Dim result As Boolean, testtime As Integer
testtime = Minute(Time)
If testtime = 0 Then
result = RefreshPage()
End If
If testtime = 25 Then
result = RefreshPage()
End If
End Sub

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Brad Tilley | last post by:
Probably a stupid question, but here goes: Is there any way to get a scaled down version of Python onto a Linksys Wireless router? Are there any projects out there that are doing this? I've...
5
by: Gav | last post by:
hello all I had written a program a while back which simply grabs the ip address of my pc and using ftp uploads the file to a webspace. (This was written in C++) I have now purchased a Linksys...
1
by: Lorne Smith | last post by:
Hi, I'm running a small network and need to get the external IP address of my router so that I can update my DNS forwarding service should my IP change (it's a dynamic one)... I can get the IP...
4
by: seets375 | last post by:
Hi, I have two ethernet interfaces on my system, with IPs assigned to the interfaces from different subnets (e.g. eth1 - 10.10.10.10 and eth2 - 20.20.20.20 ). I'm connecting these interfaces to...
3
by: =?Utf-8?B?Vk1BTQ==?= | last post by:
Hi, I have a home network with a DSL router. I want to check the router state (connected, disconnected...) from an XP computer on the network by showing an icon (green / red) in the system tray....
6
by: Pete Kane | last post by:
Hi All, anyone know of a way to programatically get the WAN ip address of either a NIC or router ?
5
by: =?Utf-8?B?SmltbWVy?= | last post by:
Hello, I've been trying to create a WCF SOAP Router Service that can forward not just the message body but also any security headers set by the originator of the message. The destination service...
1
by: ghe | last post by:
Good day, I have this DSL connection which has a dynamic IP address, then I have a new Linksys router(wired), and I had set-up my linksys router through it's web-based “Setup” utility, I had use...
1
by: izecul | last post by:
Hi, I'm a newbie here, and what I know about networking you can probably copy on a matchbook :) That said, here's my problem: I've got two wireless routers - D-Link DI-524 and Airlink AR325W....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.