Link to home
Start Free TrialLog in
Avatar of tighec
tighec

asked on

Access IIS site by IP and site ID?

Is it possible to access many different sites on one server by IP address and pass in site id somehow in the url?

For instance, if I have mulitple sites, each given their own DNS name, I can access all by DNS without any issues.  However, I am on a dynamic IP and thus it cahgnes, some users are blocked from accessing sites hosting on a dynamic IP, so need to see if it is possible to access the site using the IP address itself and somehow redirect to the site they need to get to.

Thanks.
Avatar of Systech Admin
Systech Admin
Flag of India image

You can set up the Dynamic DNS with your ISP or Router whatever you are using , it will help you to resolve your issue

Refer http://howto.wired.com/wiki/Set_Up_Dynamic_DNS
Avatar of tighec
tighec

ASKER

That won't help, that is what I currently have.

Bottom line, if I know the IP address of the server, can I get to different sites that it hosts?
Firstly, let's be clear why you're having issues. The reason why your sites are inaccessible to some clients when the IP changes is related to your Dynamic DNS "TTL" (Time To Live). When your clients do a DNS lookup to resolve a hostname to your dynamic IP, the TTL specifies how long they should use that IP for, after which they should re-query the hostname again for a new IP. When the IP changes, the site will appear offline to your client until that TTL expires and they re-resolve the hostname. You might ask "why not have the TTL be 1 second?" -- that's not efficient, and would add latency to your requests, and load on the DNS server. Many DNS providers won't even let you set this for less than 15 minutes, and that's a lot of downtime.

Another challenge with the TTL is that the clients are not REQUIRED to honor it. In some organizations, they set standards where DNS lookups will only be repeated once per hour, regardless of the TTL. Further complicating things, some organizations and internet cafes and wireless hotspots have "proxy servers" that relay the client's request to the server, and sometimes those proxy servers don't honor the TTL. And the worst offenders of all, is that there are some cases where clients do a DNS lookup once, and never again.

So if your clients connect to your site via a dynamic IP, even after they get to the site the first time, after that whenever that IP changes, there's a good chance that some percentage of your clients will experience some amount of downtime. This is unfortunately, unavoidable.

Let's put this issue aside for a moment, and discuss the second part of your issue: If you know what the IP is, can you get to virtual servers using just the IP?

What you're trying to do is unfortunately not really optimal based on how the HTTP spec is designed. Before I suggest a better approach, I'll illustrate the (likely) only way you can accomplish this if all you utilize is your server running on a dynamic IP, and the challenges that approach would have for you.

If all your sites run under a single IP and port, you have to provide some sort of unique identifier so the HTTP server knows which content root to route you to.

HTTP 1.1 typically achieves this by using the HOST Header, which notes the hostname you typed into the browser as the unique identifier.

If you only use the ip, then you have to pass a unique identifier some other way, and you have to create logic on the server side to read that identifier and perform an http redirect for you.

For example,
http://1.2.3.4/default.aspx?site=site1
http://1.2.3.4/default.aspx?site=site2

You then need to write logic into /default.aspx to read the value of the "site" variable and redirect to some other URL accordingly:

(This is pseudo-code)
if (site="site1") {
     redirect to /site1/default.aspx
} elseif (site="site2") { {
     redirect to /site2/default.aspx
} else {
     redirect to /error/default.aspx
}

Open in new window


Of course, for this to work, all of the content in each site must be wholly contained in a unique top-level directory. My guess is your existing sites are not structured this way, so this method may not be practical.

The other obvious issue is that it's cumbersome to expect the user to have to type the /default.aspx?site=<site> syntax. That's not user friendly at all.

So if you combine the TTL issue, and the access-via-IP issue, you've got multiple strikes against you, and you really have to think out of the box.

If I was in your shoes, and had no other options, this is what I would do:

1. Create a "landing page" on a free website hoster, which would be up 24/7 with a static IP. I'd setup the DNS records for all of my sites to point to that IP.

2. The landing page would contain redirection logic to redirect requests to the dynamic IP of your server based on the hostname the user typed. You need to ensure that this page ALWAYS knows what your current dynamic IP is, possibly by having the page do a DNS lookup directly to your dynamic dns server every time it gets a request. This is pretty heavy-handed, but necessary if you want to minimize downtime.

3. Once the clients get redirected to your dynamic IP, they are talking to your server directly. This will work fine until the IP changes, at which point they'll still have the TTL related issues.

4. To minimize the downtime due to TTLs, set it as low as your DynDNS provider will allow.

Unfortunately, you're still going to get TTL-related downtime. It's unavoidable.

5. However, the benefit of the always-on landing page, is if the user tries to go back to the original hostname if they lose connectivity, they'll immediately be given the new IP and be good to go again. But for this to work, the users need to be trained to perform that action when they lose connectivity. This is fine if you control the user community (eg. your employees), but impractical if your users are strangers on the wild-wide-web.

I think this combination will -minimize- (but not eliminate) downtime. It's not a perfect solution, but likely the best solution for the limitations of your configuration. This would be sufficient for friends hitting your personal sites, but not for professional sites that require 99.9% uptime.

I'm curious to see if anyone else has any better ideas, but I just don't see how you get around some downtime when the IP changes.

Good luck!

- Jon
SOLUTION
Avatar of tighec
tighec

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tighec

ASKER

Thanks.... will give you all the points just for the time, effort and explanations... much appreciated.