Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Detect when WAN IP Address changes.

Axcontrols

New member
Joined
May 29, 2004
Messages
141
My Internet/Broadband router does not have a static IP. It changes quite often.

How can I detect the internet IP address of my router?

A google search for "What's my IP" brings up a ton of services that can tell me what my IP is. I can even send a message to my own external webserver and it'll tell me my own IP.

But surely there has to be a better way? Something that I can check at higher resolution without sending packets out onto the web all the time?

How do DDNS services do it?
 

techgnome

PowerPoster
Joined
May 15, 2002
Messages
32,778
DDNS works by having your modem send a packet on a regular basis, and it detects the IP it comes from... so I sign up with a service... then in my modem settings, I turn on the DDNS, give it the service & my login info... then on a regular basis, the modem will send a message to the DDNS ... that message includes my login info (or a token) so it knows who sent it, finds my record, updates the IP ...

-tg
 

Axcontrols

New member
Joined
May 29, 2004
Messages
141
Thanks Techgnome. Would you know how often that message is sent?

I mean if the modem sends the message, say, once an hour. And just a moment after the last update your IP changes then the DDNS is out of date until the next refresh almost an hour later.

Of course if the update is sent once a second then that problem goes away - but that's a lot of traffic.
 

techgnome

PowerPoster
Joined
May 15, 2002
Messages
32,778
It's been a while and I've since changed modems ... but it should be configurable. You can also do a manual refresh too.

-tg
 

Axcontrols

New member
Joined
May 29, 2004
Messages
141
Sorry. I'm not actually looking for how to set up my modem (broadband router). I'm looking to make a server product that has the ability to accept connections from outside client machines.

I've got a website out on the internet. lets call it WWW.MYWEBSITE.COM

In my house I have a program running that accepts connections from client processes running outside on the internet. Lets call that program SERVEX

Every 5 minutes SERVEX sends a message to MYWEBSITE.COM/STORE_IP.PHP
the webserver stores the IP address in a database.

Client machine, anywhere in the world, wants to connect to ServeX but can't know it's IP Address. (Doesn't need to know) It attempts to connect to SOME_SUB_DOMAIN.MYWEBSITE.COM and is immediately forwarded to the IP address of SERVEX.

So basically I'm running my own DDNS for my own client/server application.

So, in my case, DDNS is being updated every 5 minutes. But if the IP changes then, in theory, there could be a delay of up to 5 minutes during which time SERVEX is not accessible.

If I was using some commercial DNS would they be refreshing any quicker? In order to keep DDNS updated do they just send the message continuously? Or is it simply accepted that for periods of time the DNS is out of sync?
 

techgnome

PowerPoster
Joined
May 15, 2002
Messages
32,778
The question asked how DDNS services work... that's how they work... by receiving a sort of "keep alive" message from your modem/router. Some may also be smart enough to hit the DDNS when the IP changes... For me latency wasn't an issue... as long as I kept it on and didn't reboot it, my provider pretty much left my IP alone. Now when I'd reboot, I sometimes get a new address. Once, I went 6 months with the same IP.

That said, if you're setting up your own, then it doesn't matter what the others are doing... you send it out as often as you feel necessary. It's going to require at least a single packet... because that's the smallest that can be sent out... now, how larger of a packet or how often is then up to you. How much latency you think you can afford to lose following a change. If you feel that even a minute loss is going to be an issue, then you might want to go ahead and pop for a static IP address and then you wouldn't need to worry about it.

-tg
 

Axcontrols

New member
Joined
May 29, 2004
Messages
141
I just spent the last 2 weeks googling/working on this.

... smart enough to hit the DNS when the IP changes...

NATUPNPLib 1.0 type library.

That has the ability to query the WAN IP Address from a gateway/router that has uPnP enabled. ie without continuously pinging some outside service.

I was going to integrate uPnp into my product anyway so NATUPNPLib does both things. Seems quite simple as well.

But NATUPNPLib is 'COM'.

I've googled this quite a lot and anyone claiming to have a managed Net assembly for uPnP just has a NET Wrapper around the COM DLL. I couldn't find a pure .Net way of doing it.

Does anyone know of a pure .Net way to uPnp ?

Thanks.
 
Top