The issue of dynamic IP's

Hi,

I’m new to web app. development and I have a burning question regarding dynamic IP addresses.

If a host PC, running a web app. has a static IP address - then obviously the users will always know the IP address and can connect to the web app. no problem.

However, what if the PC has a dynamic IP address which changes from time to time. Obviously the users won’t know the new IP address unless they go hunting around for it - which is all very inconvenient, if not a complete no no for a web app.

How on earth do you go about solving this issue? Is it an I.T. issue? are I.T. responsible for making the IP static, or are there other techniques to somehow “fixing” the location of the web app.?

Thank you

Darren

You can use a dynamic DNS service. I use no-ip.com. You can install a client app on your server and when it detects an IP change it updates the dynamic DNS service with the new ip so users visit a ‘chosen name’, i.e. myhost.ddns.net, and this always then points to the right place.

In addition some internet providers/IT departments can provide a fixed IP address if you ask.

Hi Paul,

Thank you, but is this a suitable method for a commercial product?
The web app. will be used by engineers/technicians on their company LAN.

Ideally, any software installation (including web app. on a LAN PC) should require minimal or better, zero configuration.
If an engineer or technician was to install the web app. on a LAN PC, they are very unlikely to have skills to set a static IP or use no-ip.com or similar.

Are you saying that an I.T. professional will always be required to install/configure a web app. if a static IP or fixed name / domain is required?

What I’m saying is:

I would rather the web app. be completely configure-less.
Install-and-go… if you like, much like a desktop app.

Or is this impossible? am I dreaming?

I am sure it is possible, create a standalone app, have some sort of installer package bundle it up and install it but ultimately the application should be running on a fixed IP server. You could always change your ‘pricing model’, host the app yourself, give each customer a unique serial code and point them at your own server running it, the unique code differentiating each user/site. That latter is what I do with one of my apps and the users pay an annual fee to access and use it which more than covers the cost of the hosting. Its an ongoing revenue stream and many web app. users employ a similar model.

The IT professional won’t need to have a degree in computer science to install a standalone web app on a machine on a LAN. but the user still needs to be able to find it so a fixed IP in the scenario you outline is a must as far as I can tell.

Someone more knowledgeable may be along in a minute maybe the web app could ‘broadcast its location’, although I see even more complexity in this sort of approach.

If they are installing it on their company LAN for internal use then they should either be installing it on a machine with a static IP or a reserved DHCP address which is linked to the MAC address of the network adaptor meaning that the IP will never change.

An IP address on DHCP will only change if certain criteria are met, they are usually reserved for a minimum time period and will usually be reassigned the same address unless the machine is off the network long enough for its IP to be assigned to a machine that has been added to the network while the other machine is off and only then on the off chance that the new machine has been given the same IP address from a pool of IPs.

Technically you can have a DHCP machine that registers itself with the local DNS server, so you could access the machine using http://DarrensMachine/ and that address will always work no matter what the IP is for that machine, but that will need to be set up by the person that admins the LAN and isn’t guaranteed to be in place.

Dynamic DNS services are only really used for internet facing servers that are on a internet connection that isn’t designed for hosting your own services, like a home internet connection. There are commercial grade connections that will be on a static IP address or a number of them which the company can use/allocate to different services.

You would have to write a small desktop app that they would run that would locate your web app and then start your web app for them in their default browser after locating the current address of your machine.

Or you could write a web facing service on your web server that they visit from their LAN which fires off a load of ajax requests on their lan, when one hits your service it redirects them to your internal IP a bit like how http://find.synology.com/ works.

Thanks all for your input.
Please understand I’m neither a web dev. nor a network expert.

The app. will only ever run as self-hosted on a customer LAN machine. It won’t be hosted externally, so I have to find a method to fix the location.

If you’re saying that it has to be the customer’s responsibility to fix the IP address or configure a domain, then so be it.
This is not ideal, but if it cannot be avoid then that is the final answer.

I get the impression it’s possible to access a PC by it’s computer name, rather than IP?
This would be great, but I don’t know if it can be guaranteed to work for every customer. Some networks may not support this.

Weirdly, I can ping my computer name, but when I place my computer name in a URL, the page doesn’t load. Does anyone know why this could be?

[quote=394829:@Darren Logan]
Weirdly, I can ping my computer name, but when I place my computer name in a URL, the page doesn’t load. Does anyone know why this could be?[/quote]
You use windows services like WINS to resolve computer from name in terminal or perhaps file browser windows.

Your browser uses DNS. What network people must do (if DNS is internal) is maintain a DNS entry synced with the DHCP lease. Much easier as said before, use an static IP or add an static entry to DHCP server (MAC/IP). Depending the way DHCP is operated, may be easy or impossible.

Hey Darren,

Just to be clear, these aren’t Xojo-specific issues. Configuring a static IP and/or DNS records is a necessary complication for any web site or app you’re going to run in-house, regardless of what is used to develop the site.

If you need people to be able to access it from outside your location (via the internet), there’s another layer of complications involving public vs. private IP addresses. Most ISP’s offer “public static IP” addresses for $5-20/month, or Dynamic DNS services (mentioned above) can provide an alternative approach.

If it’s just for internal use, all it takes to set it up is administrative access to the network infrastructure–it’s some of the most basic stuff any IT tech should be able to configure–but if done wrong, can break your entire network.

Avoiding these hassles is one of the reasons for the popularity of cloud-based web hosting (including the Xojo Cloud option, although Xojo web apps can be hosted on most any cloud service and isn’t limited to their own).

Hi Seth,

No, it’s an issue all LAN-based web apps. face and I’m surprised there’s not more information on the subject. Perhaps it’s not a common scenario and what I’m asking is unusual?
If it’s unusual, then why are there self-hosting web app. solutions (like Xojo web) available?
What’s the point if you can’t guarantee a static address?

At first I thought… WOW… a standalone web app., awesome, but then you start to realise there’s a bit more to it.

Yes - just for internal (LAN) use. Not for outside access.

You say it’s “basic I.T. stuff” (I can’t argue because I don’t know), but what this is telling me is; YES, some configuration is necessary and probably by I.T. professionals who will need to make a special arrangement for the app.
I know all too well that I.T. do NOT like fiddling with their networks.Not for anyone!

This shifts away from the ideal of zeroconfig and makes the system less friendly, but if it can’t be helped then that’s fine - at least I know in advance.

Maybe cloud is the best way.

There is another complication. My web app. will need to communicate with other PC’s on the same LAN.
Web app. will need to “poll” each client for data.
So, another aspect of this system is that the clients will need to register with the server/web app., and the web app. will need to know the IP’s of the clients - which could also change.

Please note the full context of my statement: [configuring ip addresses for a web server] “…is basic I.T. stuff any I.T. tech should be able to configure.”

If someone is employed as an I.T. tech responsible for setting up and maintaining the network in an organization, they should be capable of doing this very quickly and easily. Setting up a web server is very similar to setting up various other types of servers (file servers, email servers, etc.). It’s part of their job–one of the simplest parts, in most cases (setting up security certificates and making sure the whole thing is secure is often the most involved part).

For anyone who does not manage/configure networks as part of their day-to-day job–this includes programmers, hardware technicians and even many web site designers–there are a lot of details to learn and hundreds of variations of how a network may be set up.

If you have an internal I.T. team, you should ask them the best way to set up a web server for your specific organization’s network. They might prefer an internal Linux server, internal Windows server, internal Mac server, cloud-based Linux server, cloud-based Windows server, cloud-based Mac server, running any of those things in a Virtual Machine instead of on bare metal, running alone on a machine or VM, running as one of many items on a PC or VM, running as a stand-alone app or running as a stand-alone service, running as a cgi application behind Apache (on Windows, Mac, or Linux) or IIS (on Windows) or some other web application, or numerous other possibilities…

Xojo web apps can run in ANY of those dozens of combinations of environments–and all of them require setting up IP addresses and DNS entries. I would encourage you to decide what web server approach is best for your environment, figure out how to set that up, and then you can get specific help deploying your Xojo app into that environment.

…or use Xojo Cloud to avoid most (but not all) of the complexities of setting up a web server.

For polling the clients, that’s another entirely different topic which could also be handled using dozens of different approaches in Xojo (or any other development environment). You should probably start a new topic in the forum if you want to discuss that, but just to get you started, here are a few different approaches for that:

  • PC’s only talk to server when user has web site open in a browser, or
  • PC’s run an agent (built with Xojo) that runs continuously (with GUI or a faceless console app or a service)
  • Agents can push data to the server (server doesn’t have to know their IP addresses in advance), or
  • Agents can respond when server polls them for data (data “pull” instead of “push”–but server needs list of addresses)
  • Server and/or agents can search local subnet or specific IP addresses for responding service to find each other
  • Server and/or agents can have a hard-coded list or a GUI-configured or file-loaded list of addresses to find each other

You could build any of those things in Xojo, or any of numerous other approaches.

Like the @Seth Ober write above is the full explanation…

[quote]There is another complication. My web app. will need to communicate with other PC’s on the same LAN.
Web app. will need to “poll” each client for data.
So, another aspect of this system is that the clients will need to register with the server/web app., and the web app. will need to know the IP’s of the clients - which could also change.[/quote]
1 )A small Linux server is best and have very low cost.
2) With a Router you can use the DHCP reservation telling the router that a specific device always uses a specific IP address, which is set aside or "reserved" for it
More details here

Hi there,

Thanks for the comprehensive answers. Much appreciated.

However, the system will be deployed on customer / factory LAN’s, not home networks.

Typically, the customer will have the freedom to install the standalone web app. on their work desktop or a dedicated server.
If running on their desktop, then “somehow” remote connections to it (from other desktops around the factory) will need to know the (fixed) IP of the web app.

I guess that we would need to provide generic instructions to the customers that “somehow” they will need to either:
1/ Fix the IP address of the desktop which is serving the app. or
2/ If possible, use the server COMPUTER NAME instead of IP, or
3/ Setup their own domain name for the app.

… and essentially just leave it to the customer to sort this out.
However, I anticipate that the customers will want support for any of the options above, and this is where it could get messy, UNLESS we categorically tell the customer that we CANNOT support networking issues.

But, you know, I would still love to be able to provide a system that just works “out of the box” with zeroconfig.

My preference is that the web app. could be called by computer name:
E.g. http://TheServerComputer:

Then we don’t need to worry about IP’s, but there’s still the issue of the PORT number!
Is there anyway to automatically assign a known, working port?

Thank you

Have you reviewed http://developer.xojo.com/iis-deployment this page of the Xojo documentation?

If your needing to poll data from the clients machines. You definitely need a desktop app running on the client machines. Not going to a a reliable way to do that any other way. That app could determine and maintain the server address and periodically upload data to the server.

You can have your app display the IP address and/or registered DNS name of the computer it’s running on:

"Please tell clients to connect to: https://192.168.37.3 or //myserver.mydomain.co.zz

Your app can definitely determine the IP address of the machine it’s running on, it can listen on any port you want to tell it to listen on, and in most cases, you could use rDNS to find out the name of the machine that’s listed in the DNS records for the machine’s IP address.

Once your customer’s I.T. has assigned a static IP to the machine hosting the app, you can even register a domain name and point it at that internal IP.

For example, if the internal server IP is 192.168.1.50, you can register MyWebApp.com and have DNS point to 192.168.1.50. That way your clients will always be able to access it via that domain from within their LAN, but to the outside world it will just not load.

Just thinking: you can design the webapp to respond on port 6789 (or the like) and also implement your own route (like /getinfo/) in its .HandleSpecialURL eventhandler, from where it could deliver some information about itself.

So when the webapp scans all local addresses and then for instance on http://192.168.1.112:6789 it discovers a responding webapp, it could request more infos from it by calling http://192.168.1.112:6789/getinfo/

Now each webapp can build up an app-internal table of other available Webapps of the same type and connect to those according to business rules or user-interaction.

The webapp can refresh such table according to an interval you set or when the user hits a refresh button.