Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine NATed address 1

Status
Not open for further replies.

osuman

Technical User
Nov 22, 2000
281
US
Does anyone know of a way to do this while behind a router NATing your traffic?

I want to write a program that will determine this address but can't think of a way to do it locally. Assuming I can't ask the router what it's public interface address is and can't go to a site like whatismyip.com, what is left?

Doing a trace route to an external site returns the private interface address from my router (192.168.1.1).

Any good ideas?
 
other than somehow querying your ISP? .. I don't know of many ways to do it from behind the NAT'ing device.

Computer/Network Technician
CCNA
 
jimbo,
Thanks for the post but not really what I'm after. That program makes use of an external server. I'm trying to determine the address without the use of another machine on the internet.

Maybe this just can't be done...
 
Is you assume you can't ask the router and can't go to an exernal site like whatismyip.com, then it can't be done.

You could setup a dynamic dns service (like install the client piece, and nslookup the host name you setup in dyndns, but that involves an external service (DNS).

Is that helpful?
 
osuman,

What router are you using? Some routers have in-built Telnet clients that you can access to gain info or an inbuilt FTP program that again can be used to gather info. I had a friend who was a Sun admin, he wrote a script that logged into his router via FTP, d/l the running config file, then analyze the file for the external address.

Long shot, but you never know.
 
Thanks for the posts.

This is really just for a home project. I have a Linksys WRT54G. I really don't think it's cool enough to have any of the functions you mentioned. I looked through all of the settings and didn't see anything. Tried to telnet to it with no luck also.

The only way to login to it is through it's web interface. I don't really know how to write a program to do that, but I suspect it's either extremely difficult or not possible.

Is there any way I could leverage the device's MAC address? What commands can you issue with the MAC addr, ARP or something like that?

Maybe it would end up with the same problem though. An ARP request would just return it's internal address...

Any more thoughts?

 
Investigate third-party firmware for the WRT54G.
Telnet is available on several.

This is easily the best selling and best third-party supported product available on the market.

There is an incredible amount of resources available for this device. See, to start: Be sure to view the Forums.

Sveasoft, HyperWRT and others offer telnet access, for example.
 
If anything I would think that SNMP would be the go. Make sure that the private community is enable for the SNMP of the router. Then it is a matter of finding out the SNMP trap IDs. One of them will be the info for the external interface (at least I think it would be). I never really delved into SNMP that much, but the little bit I did play with, gave me much valued information about switches, traffic loads, etc.

I would start looking over the SNMP details for your router and see what comes up. Start looking for a good SNMP query program as well.

DT
 
I looked at the page you suggested. Many of the other firmware's offer SNMP, telent, and so forth. This would probably allow me to do what I want.

However, using a 3rd party firmware makes me kind of nervous. I'm a little skeptical that others could write better firmware than the manufacturer of the device itself.
 
Well maybe the UPnP options might offer some help.

I found this tool on the Intel Website:
I haven't had a chance to test it yet as it requires the .NET framework and I can't reboot this machine. It looks as though it might be able to help though.

Has UPnP device sniffers etc. Hopefully one of the tools will be able to get you the WAN address.

I had a quick look and the WRT54G does support UPnP.

DT

I like children. If they're properly cooked.
-- W.C. Fields
 
Thanks for the info!

I saw the UPnP setting on the router but had yet to look up what it is.

There is a utility in the archive you directed me to called Device Spy.exe. There is a method in it that retrieves the external IP address. So clearly UPnP provides the functionality that I am looking for.

I was planning on writing a .NET app for this anyway so I might just be able to reference the dll that program is using.

Will re-post if I get it all working.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top