On Fri, 7 Jun 2002, Jean-Francois Pirus wrote:
used in New Zealand. My ultimate goal is to check users visiting a website to see if they are connected to the internet within New Zealand and redirect them to different pages accordingly, much like Google seems to be able to do these days, ie when I enter www.google.com, I end up at www.google.co.nz, and I'm assuming that this is done based on the IP address of the machine I'm on...??..
The way most people do it is by doing a reverse-dns lookup on the ip address of the client and looking for .nz at the end (for example) it will work most of the time.
I have a php script that does that if you are interested.
Probably, the only other way would be to get the AS numbers of all the local ISP and then find out the address ranges they use, but of course those keeps changing.
jfp.
It will work most of the time, but those few who do have .com reverse lookups will fail. I grab a national table from http://noc.win.co.nz/nationalroutes and it's not far off the mark (last time I checked). A national BGP feed is probably the most reliable as that's the way your traffic is going to travel. DNS and ASs sometimes aren't a reliable indicator. Then you have to weigh up the difference between the number of != .nz reverse lookups and missing networks from win and I guess you'll come to the better of the two. Chris -- - To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog