What You Need to Know About Anycast Routing
When talking about server routing, streaming and CDNs, the expression anycast is one you frequently bump into. It’s one of those words you already know but can’t explain what it stands for and how it works exactly. To put it simple, it’s a networking technique where the same IP address is attributed to multiple locations (e.g. servers). The network then decides which location to route the traffic to in order to achieve quickest responses at optimal costs.Today we are going to dig a little deeper into it and explain the meaning, basics and main characteristics.
According to Wikipedia, anycast is defined as:
“A network addressing and routing methodology in which datagrams from a single sender are routed to the topologically nearest node in a group of potential receivers.”
Beside anycast, network addressing systems apply other methodologies as well:
- Unicast (“one-to-one”) – used when two specific network nodes need to communicate. Each destination address uniquely identifies a single receiver endpoint.
- Broadcast (“one-to-many”) – traffic gets routed from a single sender to multiple destinations simultaneously in a single transmission. The traffic is then replicated by the network as needed for all eligible network receivers (links).
- Multicast (“one-to-unique”) – traffic gets routed from a single sender to multiple specific endpoints simultaneously in a single transmission. Unlike broadcast, it doesn’t touch all nodes. In order to gain access to information, the nodes have to be subscribed to a multicast group.
- Geocast – information is delivered to endpoints identified by their geographical locations. It’s a specialized form of Multicast which combines with routing protocols for mobile ad hoc networks.
Unicast vs Anycast
The vast majority of the network routing out there is executed through unicast schemes. It’s because most of the routing doesn’t require sophisticated solutions. With unicast, every network node is assigned a unique IP address. Routers keep a map of the world’s IP addresses and maintain a logic which aims for the shortest path between nodes. That way a router forwards packets to the next one which is closer to the final destination until the packet finally arrives at the address. With unicast your request will always be routed to a predefined location, a server which responds to a request.
Unicast is the easiest way to run a network, but for specific needs other methods are also implemented. In this article we will focus on the anycast scheme. With anycast routing, multiple locations share the same IP address. They are functioning as mirrors to each other, within globally distributed data centers and server farms. That way when a request is sent to an anycasted IP address, the network automatically reads the request, picks the closest routers and forwards the traffic to the server thus saving time.
You can track the packets’ path by running a traceroute ( tool that displays the route of packets across a network) to any site. It’s a useful tool, similar to ping, as it lists all the transactions between routers, known as “hops”. Every hop represents a transitions of packets between network nodes and the numbers in each line represent three samples of the time, in milliseconds, it takes for a packet to do a round-trip to the particular router. The last line is usually the most important as it shows an estimated the real-world network latency between you and the server. To find out more on how to use traceroute make sure to read this article.
The image above is an example of tracing the request path to globaldots.com. If you run the same traceroute to globaldots.com from anywhere in the world, you can see the requests routed to the closest data center.
With unicast you will always get the same IP destination no matter from where in the world you’re accessing the network. Anycast, on the other hand, will allow the network to find the closest IP destination and route the traffic accordingly.
Although it requires a certain level of sophistication to implement, anycast has proven to be the next step in network routing. It’s main benefits are:
- Attack Mitigation
Anycast is frequently implemented by CDN providers in their networks. According to an older Cloudflare blog post, they usually answer around 75% of requests from the edge without the need to access the origin, which significantly reduces network latency. Beside improved performance, applying anycast makes the network highly resilient. Considering that network traffic will find the optimal path, even if an entire data center gets brought offline, all of its traffic will automatically reroute to the next closest center.
Along with performance and resilience, anycast can also be useful for attack mitigation. In most DDoS attacks, compromised “zombie” computers also known as bots, get recruited into a bot army known as botnet. When a DDoS is launched, the botnet generates massive traffic directed at a single location which means a typical unicasted service can easily become unavailable.
The nature of anycasted networks is that they increase the impacted surface area and absorb such an attack. A botnet denial of service traffic will be absorbed by each of the data centers. Setting up an efficient anycasted network requires adequate hardware, direct relationships with upstream carriers and tuning of network routes to avoid traffic to “flap” between multiple locations.
Further technical specifics, more materials and deeper insights about anycast are available here.
Beside the previously mentioned technical benefits, some key advantages are to point out from the business perspective. Anycast allows users to have a faster, uninterrupted experience, while enterprises achieve lower administration costs since anycast routes around slow and failed nodes.
Ultimately it comes down to higher customer satisfaction since users are prevented from experiencing slow or unavailable services.
As suggested throughout the article, anycast can be difficult to implement but also provides a great way to improve the performance and resiliency of a network architecture. The security aspect is also significant as it can absorb massive DDoS attacks, which is important for all online endeavors ranging from ISP’s to private enterprises. Anycast is a no-brainer for services with growing user bases that require a system that can handle failures quickly and transparently. CDN is a must-have for CDN’s too as it allows to deliver content to customers faster than with any other routing scheme. If you feel your online assets could use anycast services, or have other web performance related questions, feel free to contact our experts at GlobalDots as they can help you boost your web assets performances.