What is Anycast? How does IPinfo geolocate anycast IPs?

Anycast IP addresses explained

An anycast IP address is a single IP address assigned to multiple devices or servers in different locations. When a device sends a request to an anycast IP address, the request is routed to the nearest or most optimal server in the network based on routing protocols, network topology, and network operator policies.

Anycast is often used in content delivery networks (CDNs), DNS services, and distributed systems to reduce latency, improve load balancing, and enhance redundancy. Anycast improves network performance by routing user requests to the closest or most responsive server, reducing latency and improving response times. For example, when you query an open DNS resolver with an anycast IP address like 8.8.8.8 or 8.8.4.4, your query is routed to the closest available DNS server, ensuring faster response times.

Routing for anycast IP addresses is determined by the network’s routing protocols (e.g., BGP). The protocol calculates the shortest or most efficient path to the server based on various factors such as topological distance and network operator policies, ensuring that traffic is directed to the optimal server.

For example, running traceroute from two machines in different locations to Cloudflare’s 1.1.1.1 anycast IP address.

VM#1 $ traceroute 1.1.1.1

 1  * * *
 2  141.101.73.4 (141.101.73.4)  12.996 ms  12.977 ms  12.953 ms
 3  141.101.73.212 (141.101.73.212)  13.363 ms 141.101.73.18 (141.101.73.18)  38.497 ms 141.101.73.216 (141.101.73.216)  12.881 ms
 4  one.one.one.one (1.1.1.1)  14.209 ms  12.574 ms  12.046 ms

VM#2 $ traceroute 1.1.1.1
 1  * * *
 2  r2b4.n1.p1401.lax.multacom.net (64.69.46.11)  0.838 ms r1b4.n1p1400.lax.multacom.net (64.69.46.9)  0.618 ms r2b4.n1.p1401.lax.multacom.net (64.69.46.11)  0.826 ms
 3  ce-1-4-2.a04.lsanca07.us.bb.gin.ntt.net (128.241.15.73)  0.521 ms  0.499 ms  0.481 ms
 4  ae-0.cloudflare.lsanca07.us.bb.gin.ntt.net (128.241.9.245)  1.077 ms *  1.911 ms
 5  141.101.72.87 (141.101.72.87)  3.384 ms 141.101.72.34 (141.101.72.34)  1.400 ms 141.101.72.83 (141.101.72.83)  1.450 ms
 6  one.one.one.one (1.1.1.1)  0.953 ms  0.950 ms  0.979 ms

The path and time taken to reach the destination IP address 1.1.1.1 are different for the two machines. Tools like traceroute might give some indication of the general path traffic takes, but they will not pinpoint the exact server location.

Anycast and load balancers distribute traffic to multiple servers, but operate at different layers. Anycast uses IP routing to send traffic to the nearest or most optimal server based on network conditions. At the same time, load balancers typically operate at the application layer, distributing traffic among servers within a specific data center or network.

Difference between Anycast, Unicast and Multicast

In IP networks there are generally three types of destination addresses: unicat, anycast, and multicast addresses.

Unicast: Traffic is sent from one source to one specific destination. Example: A user sends a request to a web server, and only that server responds. Most IP addresses are unicast addresses.

Anycast: Traffic is sent from one source to the nearest or most optimal destination among multiple possible receivers sharing the same IP address. Example: A DNS query is routed to the closest DNS server using the same anycast IP address.

Multicast: Traffic is sent from one source to multiple specified destinations in a group. Multicast IPv4 addresses are within the range of 224.0.0.0 to 239.255.255.255. These addresses are reserved for multicast communication and for sending traffic to multiple receivers in a multicast group. Multicast is generally used within private networks or specific controlled environments like IPTV systems.

Is it possible to know the server instance behind an anycast IP address?

Identifying servers behind an anycast IP address can be challenging due to the abstraction of the network infrastructure. The routing protocols direct traffic dynamically, making it hard to pinpoint the handling server instance, as these are generally not publicly disclosed. Anycast routes traffic to the nearest or optimal server without revealing its specific server instance.

How does IPinfo geolocate an anycast IP address?

Finding the precise location of a server with an anycast IP address is challenging due to routing decisions based on network topology rather than proximity. Geolocating an anycast IP address is unreliable since the server managing the request can change due to factors like network load, outages, or routing protocol changes. The same anycast IP may be resolved in different locations for different users or at different times.

Considering that anycast IP addresses cannot be reliably geolocated via our probe network’s latency-based geolocation method and other network-based location methods, we report the IP geolocation we see in the WHOIS records for anycast IP addresses. Even though we have all the location information for all the anycast instances, returning WHOIS-reported location is generally more reliable and standard location data. If we opted for latency-based geolocation, we would be reporting different locations for the IP addresses at different points in time and from our data from different probe servers.

WindowsTerminal_OigeqWM1aP

We recommend users to look out for the anycast flag in the API payload before considering the location information provided.

Identifying anycast IP addresses with IPinfo

You can explore a list of Anycast IP addresses from our IPinfo IP metadata tags page.

msedge_HO1OndyT4N

We also share this data through a custom database export.

On our website, anycast IP addresses are also tagged, for example: 8.8.8.8 IP Address Details - IPinfo.io

Through our API, we also mention if an IP address is anycast or not:

{
    "ip": "8.8.8.8",
    "hostname": "dns.google",
    "anycast": true, <-----------•
    "city": "Mountain View",
    "region": "California",
    "country": "US",
    "loc": "37.4056,-122.0775",
    "postal": "94043",
    "timezone": "America/Los_Angeles",
    "asn": {
        "asn": "AS15169",
        "name": "Google LLC",
        "domain": "google.com",
        "route": "8.8.8.0/24",
        "type": "hosting"
    },
    "company": {
        "name": "Google LLC",
        "domain": "google.com",
        "type": "hosting"
    },
    "privacy": {
        "vpn": false,
        "proxy": false,
        "tor": false,
        "relay": false,
        "hosting": true,
        "service": ""
    },
    "abuse": {
        "address": "US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043",
        "country": "US",
        "email": "network-abuse@google.com",
        "name": "Abuse",
        "network": "8.8.8.0/24",
        "phone": "+1-650-253-0000"
    },
    "domains": {
        "ip": "8.8.8.8",
        "total": 10831,
        "domains": [
            "hdchina.org",
            "kuweimi.com",
            "youxuan68.com",
            "musicool.cn",
            "nmgk2.com"
        ]
    }
}

Anycast IP addresses enhance network performance by routing traffic to the nearest server, reducing latency and improving reliability. IPinfo’s service can identify and analyze these anycast IP addresses, offering detailed geolocation and routing data. By utilizing IPinfo’s API, organizations can optimize their network infrastructure and improve service efficiency.