Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Obtaining router's external IP address programmatically....

Author
Message
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 20:38 Edited at: 10th Feb 2004 20:39
Hi, before I go scouring the web for information I figured I'd ask you guys first... I need to obtain my router's external IP address (assigned by isp) programmatically from a windows 2k machine. It can be a batchable command or some script or whatever, I am open.
It is needed because the router in question is being assigned via dhcp by the isp and the ip has the potential to change - since this router is in front of a VPN server I need to know when the ip changes so I can update the client vpn connections. I plan to write a windows service that obtains the ip address of the router and emails to my machine every 4 hours (or some similar occurence)

Thanks in advance
James (not Fat-Ass-Bob)

-RUST-
"What the... Mooooooooooo!"
Gery
20
Years of Service
User Offline
Joined: 24th Jan 2004
Location:
Posted: 10th Feb 2004 20:47
right clic on the connection icon, other menu (WinXP)
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 20:54
@ Ge3ri

what part of "Programmatically" didn't you understand ?

oh yeah, ALL OF IT!

-RUST-
"What the... Mooooooooooo!"
Gery
20
Years of Service
User Offline
Joined: 24th Jan 2004
Location:
Posted: 10th Feb 2004 21:19
i said how to get the isp....
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Feb 2004 21:21 Edited at: 10th Feb 2004 21:29
You would probably need to use the WNET commands - never used them yet, so I dont know exactly how to do it.

IanM would probably know...


The place for all great plug-ins.
XP3000+,1Gb RAM,FX5600,1Mb ADSL,Router,.Net 2003 Pro & me
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 21:26 Edited at: 10th Feb 2004 21:30
ya, I had a look at NET... commands and TRACE.. command (TRACE PRINT) but no joy. I may have missed something tho, that's why I am asking around and looking online. You can do this from Linux from a console command but I am using windows so....there ya go

where's IanM ?


edit: I just went thru WMI Objects and I can get the router's static internal address 192.168.1.1, if that helps somehow in getting me closer. Another thought I just had: Does dhcp renewal write to the system event log? If so I can hook into that event and snoop the entry object's data to see if it's the renewal, and if so shoot the email out via CDObjects....just a thought....

-RUST-
"What the... Mooooooooooo!"
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Feb 2004 21:33 Edited at: 10th Feb 2004 21:37
No idea - he's never around when his brain needs to be picked...

I wasn't talking about .NET by the way - I was talking abouw the WNET commands that are part of the Platform SDK (and thus availiable from C).

It looks like you may need to enumerate all networks first - before querying each IP address (possibly)...


The place for all great plug-ins.
XP3000+,1Gb RAM,FX5600,1Mb ADSL,Router,.Net 2003 Pro & me
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 21:39
nope, just figured it out SILLY ME - the email has the machine IP data I need in the hidden headers! DOH!



thanks anyway tho!!
<smacks self around with a smelly wet monk-fish>

-RUST-
"What the... Mooooooooooo!"
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 21:41
ps @ TCA I thought you menant NET.. commands from windows console, you know, like NET SHARE, NET STATISTICS, etc etc

-RUST-
"What the... Mooooooooooo!"
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Feb 2004 22:41
Glad you sorted it out yourself

I know how to get all sorts of details about the current machine, but I wouldn't know where to start to get the ip on an external router

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Feb 2004 23:30
ended up being blindingly simple - as most "huge" problems usually do.

do you use Windows Management Instrumentation (WMI) and/or Performance Counter Objects ? I find them very very powerful for windows programming - especially in .NET

rock on

-RUST-
"What the... Mooooooooooo!"

Login to post a reply

Server time is: 2024-11-24 17:26:16
Your offset time is: 2024-11-24 17:26:16