Click to See Complete Forum and Search --> : Need home router's external dynamic IP address. How get it?
pschiff
November 7th, 2002, 12:03 PM
Anyone know how to query (via a C or MFC program) a home router's status to get its external publically viewable IP addresses (that the ISP assigned to it dynamically) or can it be done by somehow pinging a remote server and sending back the real ip addresses assigned to the router. thanks.
Amn
November 7th, 2002, 12:21 PM
I am not an expert but this is better than nothing i think:
1. You can use the tracert.exe command, parse its output to extract the primary gateway address (router IP).
2. You may use the recently posted article about a custom "trace route" program, which also has the ability to extract the gateway IP.
3. You need to get familiar with the DHCP protocol - this is what router client (OS) uses to communicate with DHCP enabled router. DHCP protocl impl. shoudl be available on the Internet.
4. You may use a workaround, which involves parsing the HTTP_REFERER HTTP variable returned from a webserver. This will involve asking internet explorer to connect to 127.0.0.1:80 (or other for that matter) and retrieve and save the variable which contains the IP address of the client requesting the HTTP resource.
In my opinion, the #3 is the best solution.
pschiff
November 7th, 2002, 12:35 PM
Thanks AMn
But I know the dhcp protocol very well. It does not publish the external router's ip address to the client.
pschiff
November 7th, 2002, 12:38 PM
can you give me a link to the trace route program you mentioned? tks
Amn
November 7th, 2002, 04:14 PM
sure =)
here it is :
http://www.codeguru.com/network/tracert.html
Regarding the DHCP - like i said i am not expert at this :( but i know this: router reports its address to the nodes it comunicates with, and if you are one of them then you know it too :) BEsides, why shouldnt it report the address to you ? :D
pschiff
November 7th, 2002, 04:21 PM
Amn
The router reports its INTERNAL ip address to the internal clients (not its external ip address which is what I want).
tks
Kdr Kane
November 8th, 2002, 10:08 AM
pschiff,
Many routers use a web interface and/or telnet for administration of the router. You can usually read the external IP address from there.
Other than that, you'll need to use an internet resource to read your external IP address such as http://whatismyip.com/ .
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.