This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 months ago.
The community reviewed whether to reopen this question 5 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
要快速开始地理定位,请打开命令行并输入
tracert stackoverflow.com
并密切关注结果。大多数情况下,前几行已经给出了有关您所在位置的重要提示。For a quick start into geolocation, open a command line and enter
tracert stackoverflow.com
and pay close attention to the results. Mostly, the first few lines already give away important hints about your location.基本上他们是根据 IP 地址猜测。他们在某个地方有一个 IP 地址范围和位置的列表。他们根据 whois、traceroute 和/或用户反馈的查找进行维护。
例如,MaxMind 似乎主要依靠用户反馈来保持其列表的最新状态。
人们使用 VPN 和代理来绕过 IP 基础地理封锁。有时该表只是有错误的数据。
如果你想要一些便宜且有效的东西,并且不担心疏远你的用户,那么这是一个很好的解决方案。不要期望超过 99% 的结果都位于实际用户位置 2000 英里范围内。
Basically they guess based on the IP address. somewhere they have a list of ip-address ranges and locations. which they maintain based on lookups against whois, traceroute, and/or user feedback.
MaxMind for instance seems to rely mostly on user feedback to keep its lists current.
People use VPNs amt Proxies to get around IP baes geoblocking. and sometimes the table just have wrong data.
If you want somtjhing that's cheap and mostly works and aren't worried about alienating your users it;s a good solution. don't expect better than 99% of results to be within 2000 miles of the actual user location.
将 IP 地址映射到地理位置是通过表完成的,其中 IP 映射到特定位置。不过,此位置不需要准确,因为 IP 地址不包含有关其位置的任何信息,这些都是近似值。
来自维基百科关于互联网地理定位的文章:
Mapping IP addresses to geolocations is done via tables, where an IP maps to a particular location. This location, however, doesn't need to be accurate, since IP addresses don't carry any information about their locations, these are approximated.
From Wikipedia's article on Internet geolocation:
据我了解,IP 子网被分配给服务提供商上游的提供商 - 因此,每个 IP 范围都被标记为位于该提供商的原籍国家/地区内,因此该范围内的每个 IP 都被假定位于该国家/地区内。
这并非万无一失 - 我们之前(在英国)由比利时提供商向我们提供卫星宽带。每次我们用谷歌搜索任何内容时,我们都会被要求只查看比利时境内的页面。
As I understand it, IP subnets are assigned to the providers upstream of your service providers - each IP range is therefore flagged as being within the country of origin of that provider, so each IP within that range is assumed to be within that country.
This is not foolproof - we previously had satellite broadband provided to us (in the UK) by a Belgian provider. Each time we googled anything, we'd be offered to see only pages within Belgium.
有许多组织负责管理 IP 地址的分配,例如美国互联网号码注册机构 (ARIN)。这些组织维护分配的 IP 地址块及其分配位置的主列表,并经常发布更新的列表。
地理定位软件充分利用这些列表,并提供将 IP 地址映射到国家/地区的快速方法。一般来说,商业产品会努力提高准确性并利用其他数据源。
查看维基百科上的地理定位软件文章,了解有关该主题的一些有趣链接。
There are a number of organizations that manage the allocation of IP addresses, such as the American Registry of Internet Numbers (ARIN). These organizations maintain master lists of allocated IP address blocks and where they are allocated to, and publish updated lists frequently.
Geolocation software takes full advantage of these lists and provides quick methods of mapping IP addresses to countries. Generally commercial products will strive for more accuracy and utilize other data sources as well.
Check out the Geolocation Software article on wikipedia for some interesting links on the topic.
互联网基础设施中有一个叫做自治系统的东西,定义这里
至少分配其中一项。 AS 具有唯一的 ASN(自治系统编号),在该 AS 内可以拥有网络(WAN 和 LAN)。
这些被分配给提供商,这些提供商当然有一个位置,因此路由协议通过 ASN 知道它们位于哪个区域。
使用 WHOIS 服务,我们可以确定 IP 地址属于谁,因为我们大多数人都分配了一个 IP 地址通过我们的提供商上网时,在 WHOIS 上,您主要会找到您所在提供商的城镇。但是 WHOIS 是一个网站,您会找到它的所有者,因此地理定位经常使用该服务。
There's in the internet infrastructure something called an Autonomous System, defintion here
Each provider has been assigned at least one of these. An AS has a unique ASN (Autonomous System Number), within that AS one can have networks (WAN & LAN).
These are assigned to providers, which off course have a location, so the routing protocols know by the ASN what zone they're in.
Using WHOIS services one can determine who an IP address belongs to, as most of us are assigned an IP address by our provider when going online, on WHOIS, you'll mostly find the town of the provider you're in. But WHOIS a website, you'll find it's owner, so Geolocation uses that service a lot.