--- title: Anycast description: "One IP address announced from many locations. Users reach the nearest point, but state and routing remain tricky." canonical: https://penasihathosting.com/en/hosting-wiki/anycast type: wiki locale: en updated: 2026-10-29 author: Willya Randika --- # Anycast ## Overview - **Summary:** One IP address announced from many locations. Users reach the nearest point, but state and routing remain tricky. - **Author:** Willya Randika ([profile](/penulis/willya-randika)) ## Article Anycast announces the same IP address from multiple network locations. Internet routers choose the best path via BGP, so users usually reach the topologically nearest location, not always the geographically nearest. This differs from unicast, where one IP points to one location. ## How it works A provider owns an IP block and announces it from several PoPs. Each PoP runs the same service, such as a DNS resolver or edge proxy. Routers between the user and the provider choose the best BGP route. If one PoP fails, the route may move to another PoP, depending on configuration and convergence time. Because routing makes the decision, anycast does not guarantee a specific location. Two users in the same city can reach different PoPs if their ISP paths differ. ## Benefits Latency can be lower for DNS and CDNs because requests do not cross continents. DDoS traffic is also spread across locations. If one location or route fails, the service can keep running through another location. The IP address does not change when capacity is added. Anycast underpins many public DNS services and CDNs. For ordinary applications, a CDN or load balancer usually provides it rather than direct server configuration. ## Limits and risks State is not automatically synchronized. If a long-lived TCP connection moves PoPs, the session can break. Apps that keep state in local memory need replication or sticky routing. Routing can change without warning. A route leak can also happen when BGP is misconfigured. The BGP “nearest” is not necessarily the lowest latency. Anycast is harder to debug. `traceroute` from one location sees only one path. Use looking glasses and measurements from several regions. `dig +short example.com` shows the DNS answer, not the anycast location. To measure the path, use `mtr` or `traceroute`. Anycast is often combined with [DNS](/en/hosting-wiki/dns-domain-name-system), a [CDN](/en/hosting-wiki/cdn), a [load balancer](/en/hosting-wiki/load-balancer), and [DDoS](/en/hosting-wiki/ddos) mitigation. ## FAQ No. The biggest gains are for stateless or replicable services such as DNS, CDN, and edge proxies. Stateful apps need extra design. No. A load balancer distributes traffic at one or more locations. Anycast chooses a location based on internet routing. They can be used together. BGP routing does not always follow geographic distance. Your ISP may choose a farther PoP that is better according to its network policy.