views:

14

answers:

1

I'm writing a web page that will detect which college campus a user is accessing the site from. I have a list of which IP ranges go with which campuses. My question is whether it would be better to detect the user's campus from their IP, using this list, or from their hostname, or both.

My concern with using IP ranges is that these may change, and my list (found online) may already be out of date. My concern with using hostnames is that I don't know whether all campus computers will have the hostname of the campus. If neither of these methods is sufficient, maybe I should use both?

A: 

I think the most logical answer would be to use hostnames first, since they're less likely to change or be expanded. It might also give you some durability against things like a mass transition to IPv6, which is bound to happen eventually. But I would never trust one source to always provide the info you need, so I'd say you could use the IP ranges as a backup.

You could get different answers to this, each with its own merits and downfalls, but I think lots of people would say to check both in some order.

Lazy Bob