Networking Forums

Networking Forums > Wireless Networking > Wireless Internet > Retrieving WAN IP address directly from a Linksys WRT64G Broadband Router

Reply
Thread Tools Display Modes

Retrieving WAN IP address directly from a Linksys WRT64G Broadband Router

 
 
Mike
Guest
Posts: n/a

 
      10-16-2006, 07:40 PM
I was browsing groups earlier this week and noticed lots of folks
wanting to retrieve their broadband router's WAN IP address without
relying on an internet site.

Here's a VBScript that will do it from within Windows. It can be
easily tweaked for other broadband routers.

Enjoy!

Dr. C.
__________________________________________________ __________________
SCRIPT:
'================================================= ===========
' *Retrieve WAN IP* (c)2006 F.M. Covington, Lancanyon Labs
'================================================= ===========
'This script retrieves the WAN IP address directly from a Linksys
WRT64G broadband router.
'Replace default internal router IP address and password as necessary.
'================================================= ===========
Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://192.168.1.100/StaRouter.htm", True,
"UserName","admin"
xml.Send
wscript.sleep 1500
x=15
IP = mid(xml.responsetext,instr(xml.responsetext,"var wan_ip = ")+14,x)
do while instr(IP,"""")
x=x-1
IP=mid(IP,1,x)
loop
wscript.echo "Current IP Address: "&vbcrlf& IP
'================================================= ============

 
Reply With Quote
 
 
 
 
Jeff Liebermann
Guest
Posts: n/a

 
      10-16-2006, 11:35 PM
"Mike" <(E-Mail Removed)> hath wroth:

>I was browsing groups earlier this week and noticed lots of folks
>wanting to retrieve their broadband router's WAN IP address without
>relying on an internet site.
>
>Here's a VBScript that will do it from within Windows. It can be
>easily tweaked for other broadband routers.


I think you mean WRT54G in the Subject: line.
Very nice VBS "scraper". Mind if I "borrow" it?

Here's how to do roughly the same thing with SNMP and WRT54G with
DD-WRT v23 SP2.

In the WRT54G, enable SNMP under
Administration -> Services -> SNMP
Save settings.

Fill in the fields. These are mine:
SNMP [x] Enable Disable
Location Fort Fungus
Contact (E-Mail Removed)
Name My home router
RO Community public
RW Community private <- change this !!!
The community names are actually passwords and should be kept secret.
Save settings.

Download and uncompress the Microsoft NETUTIL.EXE binary. This is an
all in one SNMP query program that originally came with Windoze NT
Resource kit. See:
http://www.wtcs.org/snmp4tpc/testing.htm
Copy NETUTIL.EXE to the c:\windows\system32\ directory.

Run:
snmputil walk 192.168.1.1 public .1.3.6.1.2.1.3.1.1.3.1.1

Variable = at.atTable.atEntry.atNetAddress.1.1.63.249.85.1
Value = IpAddress 63.249.85.1 <---- my router IP

Variable = at.atTable.atEntry.atNetAddress.1.1.192.168.1.11
Value = IpAddress 192.168.1.11 <---- my desktop IP

Variable = at.atTable.atEntry.atNetAddress.1.1.192.168.1.105
Value = IpAddress 192.168.1.105 <---- the neighbors via wi-fi

Variable = at.atTable.atEntry.atNetAddress.1.1.192.168.1.111
Value = IpAddress 192.168.1.111 <---- My PDA phone

(etc...)

End of MIB subtree.

This will show the router IP address and all the connected IP
addresses, on all ports.

For entertainment value, run:
snmputil walk 192.168.1.1 public .1.3
and you'll get all the various SNMP OID's (variables) that are
available. It's quite a long list.

SNMP v2 is somewhat of a security risk. The community names (i.e.
passwords) are sent unencrypted. The router is set by default to NOT
accept SNMP queries from the internet port, so this is only a problem
if you plan to run SNMP queries over the internet.

--
Jeff Liebermann (E-Mail Removed)
150 Felker St #D http://www.LearnByDestroying.com
Santa Cruz CA 95060 http://802.11junk.com
Skype: JeffLiebermann AE6KS 831-336-2558
 
Reply With Quote
 
Jeff Liebermann
Guest
Posts: n/a

 
      10-17-2006, 03:37 AM
Jeff Liebermann <(E-Mail Removed)> hath wroth:

> snmputil walk 192.168.1.1 public .1.3.6.1.2.1.3.1.1.3.1.1
>
> Variable = at.atTable.atEntry.atNetAddress.1.1.63.249.85.1
> Value = IpAddress 63.249.85.1 <---- my router IP


Oops. That's my ISP's default gateway, not my router IP. The OID
shown is the one for the connected IP's, not the assigned IP's.

snmputil walk 192.168.1.1 public .1.3.6.1.2.1.4.20.1.1

Variable = ip.ipAddrTable.ipAddrEntry.ipAdEntAddr.63.249.85.1 27
Value = IpAddress 63.249.85.127 <--- My router WAN IP address

Variable = ip.ipAddrTable.ipAddrEntry.ipAdEntAddr.127.0.0.1
Value = IpAddress 127.0.0.1 <--- loopback adapter

Variable = ip.ipAddrTable.ipAddrEntry.ipAdEntAddr.192.168.1.1
Value = IpAddress 192.168.1.1 <--- LAN side IP address.

End of MIB subtree.



--
Jeff Liebermann (E-Mail Removed)
150 Felker St #D http://www.LearnByDestroying.com
Santa Cruz CA 95060 http://802.11junk.com
Skype: JeffLiebermann AE6KS 831-336-2558
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless access through a router connected directly to a hub? sb5309@yahoo.com Linux Networking 1 04-01-2008 02:48 AM
Retrieving WAN IP address directly from a Linksys WRT54G Broadband Router Mike Wireless Internet 0 02-01-2007 01:49 PM
retrieving page from router Eric Linux Networking 1 06-19-2006 03:45 AM
Retrieving the MAC address of remote machine? Rajesh Gupta Windows Networking 2 07-08-2004 12:16 AM
A home use BT Yahoo! Broadband connetion, is it possible to have my own wireless adsl router setup directly without any BT modem or router? John Hsu Home Networking 1 07-07-2004 09:39 PM



1 2 3 4 5 6 7 8 9 10 11