A Look Into the Connection Between CDNs and EDNS
Read on to learn the basics of CDNs and EDNS, how they work, and to get a few tips on how to leverage these technologies in your monitoring strategy.
Join the DZone community and get the full member experience.Join For Free
let’s start by going back in time to the 1980s. this was when one of the most widely used protocols on the internet – dns –was developed. in case you are new to dns or need a refresher, take a look at this detailed post on dns before reading further.
dns uses udp as the transport layer protocol, except in some cases where it can switch to tcp. thus, the size of the dns message is limited to 512 bytes when using udp. the basic dns message begins with a fixed 12-byte header, followed by four variable-length sections:
- questions (or queries)
- authority records
- additional records
the image below illustrates a typical dns message structure.
dns was developed to fit the speeds and traffic that was seen in the ’80s because the internet was accessible to only an elite few involved in research and development. however, a lot has changed since regarding speed, traffic, and, more importantly, the way the internet is structured. we’ve come a long way from a centralized server architecture— the internet is now distributed and serves a global audience.
as you can see from the dns message structure above, the dns message in its current form doesn’t have sufficient space to add any more information. given this backdrop, it became vital to enhance the dns protocol to cater to newer requirements. hence, extension mechanisms for dns, aka edns, was proposed. on a high level, edns allows us to overcome the restrictions in the size of several flags fields, return codes, and label types in the dns header. it also allows for extending the dns message size from 512 bytes (when udp is used as the transport protocol) without the necessity to switch to tcp.
impact of edns
now that we have established why edns came into the picture, let’s dive right into the topic of discussion – how is this enhanced version of dns enabling content delivery networks to deliver high performance to end users?
content delivery networks (cdns) ensure an end user is served from a server geographically close to them. this is usually done in two ways –
- cdns that rely on dns and serve a unicast address : the logic to determine the closest server is based on the location of the recursive resolver from which the request originates and is ingrained to the dns resolution process.
- cdns that rely on anycast : bgp ensures that the user hits the cdn server closest to the end user.
the dns experience test in catchpoint can be used to understand the dns resolution process that is used by the cdns belonging to the 1 st category. this test type also helps in monitoring the performance and availability of the dns servers on the cdn network.
tlds return the authoritative name server for the domain:
the authoritative name servers return a cname record which points to the cdn infrastructure:
notice that the dns servers from this step onwards belong to the cdn:
the cdn authoritative name server at the final level of resolution uses the ip of the recursive resolver from where the request originated to hand out a cdn server close to the end user.
the below diagram illustrates the dns resolution process when the isp’s dns resolver is used. the end user is served from a cdn server close to it.
with the emergence of public dns recursive resolvers like google dns and open dns as well as isps that use a centralized dns resolver infrastructure, the assumption that the end user and the recursive resolver are topologically close is no longer valid. for example, open dns resolvers aren’t present in india yet, and, hence, if an end user is using the open dns resolver, the dns query may be made to an open dns resolver in, say, singapore ( https://www.opendns.com/data-center-locations/ ). the impact – increased roundtrip time and latency. due to the increase in distance or number of hops, the percentage packet loss might also increase.
the diagram below illustrates the resolution process when, for example, an open dns resolver is used:
to overcome the above-mentioned problem, recursive resolvers can pass an edns-client-subnet (ecs) edns0 option to the forwarding resolvers, intermediate name servers, and, eventually, to the authoritative name servers. authoritative nameservers then use the ecs as a hint to the end user’s network location and provide a geographically-aware answer.
the diagram below illustrates the change in the dns resolution logic when the edns-client-subnet option is passed:
edns saves the day for cdns relying on dns and ensures they meet the improved performance promise.
the support for the use of ecs edns0 option has been provided by cdns like akamai, dns providers like dyn and ns1 and public dns resolvers like google dns. using dns tests along with the advanced setting to pass client subnet information, one can ensure that the network infrastructure that they rely on is working well with this latest enhancement to the dns protocol.
if you answer yes to any of the points below, you should include dns tests where you pass the edns client subnet in your dns monitoring strategy:
- you have users who use public dns resolvers that complain about dns issues.
- you use a cdn and see users being routed to distant cdn servers all the time.
- you provided your name server domains to public dns resolvers for whitelisting to support edns client subnets. birthday attacks and cache pollution are two security concerns associated with using the edns client subnet. whitelisting ensures that the recursive resolvers send ecs only to whitelisted authoritative name servers and vice versa.
- you see dns time going up after enabling support for ecs. the dns resolution process goes through a bunch of resolvers and servers – stub resolvers, forwarding resolvers, recursive resolvers, intermediate servers, and authoritative servers. since edns is fairly new, not all components may support it, resulting in retries and increased dns time. a resolver will add the ecs option in its request if it supports it. the server responds with the ecs option if it supports it. otherwise, it ignores the option.
- you see the same cdn server ip being returned to a wide network of end users and the server is overloaded. when using ecs, the dns entries are cached against the client subnet included in the query. if the client subnet is generic enough to serve a large number of ips, the same cdn server may be served against it.
from a monitoring perspective, it is always essential to factor in the latest changes and enhancements to protocols. having a strategy to adopt the enhancements and a platform to test and monitor the adoption is paramount as well. happy monitoring!
Published at DZone with permission of Navya Dwarakanath, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.