Recently, WeChat, Douyin, Weibo, public accounts and other platforms have all launched the user IP location function. Simply put, when you post or speak on the Internet, you will include your address information. For example, when you post or leave a message on a public account, your address will be included. As the saying goes, laymen watch the excitement, experts watch the doorway. So how is this function implemented? What is the technical principle behind it? How to check other people's address information? IP Territory PrincipleAs we all know, to access the Internet, you need a public IP address. Public IP addresses are provided by ISPs. However, ISPs are just middlemen, and global IP addresses are allocated one level at a time. IANA manages all IP addresses. With a wave of its hand, it allocates all available 8-bit addresses to five RIRs. These five RIRs are ARIN, RIPE NCC, APNIC, LACNIC, and AfriNIC.
IPv4 addresses have a total of 256 8-bit segments, and private addresses, loopback addresses, reserved addresses, etc. need to be excluded. There are only about 200 available 8-bit segments. However, an 8-bit segment has more than 16.77 million available IP addresses for redistribution by RIR. Details on global IP address allocation can be found in the following link:
From the IANA address allocation table, we can determine which RIR the IP address belongs to by the first eight bits of the IP address, and thus know the location range of the IP address. However, this range is too large, equivalent to one-fifth of the global range. If you want a more precise location, you can look down at the RIR address allocation table to determine which country or region the IP address belongs to. Take APNIC as an example, and view the APNIC address allocation details through the following link:
The table records the allocation of all APNIC addresses in detail. The table format is divided into registration agency, country/region code, type, starting address, quantity, allocation date, and status. Through this table, you can find out which country or region the IP address belongs to. However, the IP location function shows the province or municipality, so you have to dig deeper. These five RIRs manage different regions. They do not directly allocate IP addresses to users, but allocate them to NIRs, which in turn allocate them to LIRs, which finally allocate them to ISPs or end users. CNNIC is the only NIR in China and also the NIR under APNIC. China's ISPs/IDCs/ICPs/enterprises and institutions all apply for IP addresses through CNNIC.
The CNNIC official website can be used to find the location information of IP addresses, but the location information may not be accurate to the province or municipality level. Take my own IP address (120.229.6.109) as an example:
The query result is China Mobile, and the location range is at the national or regional level, not the provincial or municipality level. Because the query found that 120.229.6.109 belongs to the range of 120.190.0.0 - 120.255.255.255, that is, the 120.192.0.0/10 network segment, the information of this network segment is displayed. And 58.60.110.20 can find specific province information: Guangdong Province. The fundamental reason is that when applying for an IP network segment, some have already determined the province/municipality to be used, while others have only determined the country/region to be used. Later, according to the needs, the ISP will divide the IP network segment. At this time, we can use another network parameter to locate the IP address, that is, ASN, which is the actual value on the network. The Internet is a huge network, which consists of hundreds of thousands of networks called AS (Autonomous Systems). AS is a large network managed by ISPs, regional networks, etc., and is also a large router pool. Each AS has its own ASN (Autonomous System Number), which is a 16-bit AS number for easy identification and distinction. AS contains several subnets and location information. Let's take my own IP address (120.229.6.109) as an example:
It is found that 120.229.6.109 has two ASNs, one is AS9808, including the 120.192.0.0/10 network segment, and its location is China. The other is AS56040, including 120.229.0.0/16, and its location is Guangdong, China. For more accurate positioning, it is necessary to select the longest matching network segment according to the longest matching principle, that is, to select the location information of 120.229.0.0/16, which is Guangdong, China. LocationIf you want specific location information, accurate to the street level, you need to ask the ISP to provide it. The ISP has complete IP address location information. Through the IP address, you can locate your home address, workplace, movement trajectory, etc. Of course, this information is personal privacy and the ISP will not disclose it to the public. Disclosing privacy is illegal. However, we can also locate the city or district level location information through the public IP address database on the Internet. Still taking your own IP address as an example:
The result shows Guangdong Province. Taobao IP address database also provides an API interface, which can be directly called by the program to automatically display the IP location. However, there is no city information. For more accurate location information, you can use the following website to query:
The query result is Futian District, Shenzhen City, Guangdong Province. Shenzhen City is correct, but Futian District is wrong. IP address databases all have this kind of problem. The accuracy of city-level location information is quite high, while the district-level location information is not very accurate. Here, we can find that without the help of ISP information, IP addresses can only accurately locate city locations. In fact, in addition to IP addresses, there are many other positioning technologies, such as GPS positioning, WiFi positioning, Bluetooth positioning, big data positioning, etc., which are more accurate and have higher accuracy! Therefore, even if the IP address is blocked, the exact location can still be found! |
<<: A thorough understanding of container network communication
>>: A comprehensive guide to IP addresses
background With the rapid development of the Inte...
With the belated conclusion of the 2021 China Uni...
[[374759]] This article is reprinted from the WeC...
Quick definition: A computer network hub is a lay...
IT Home reported on December 7 that the 2023 Worl...
In this digital age where data is like gold, how ...
[51CTO.com original article] It has been a week s...
With the advent of a multi-cloud world, software-...
Recently, the Ministry of Industry and Informatio...
GreenCloudVPS, which we often call GreenCloud, is...
According to the Ministry of Industry and Informa...
spinservers has released this month's promoti...
Introduction I mentioned before that I would like...
Forrester Research pointed out in its research th...
On the afternoon of December 7, 2018, the first S...