← Back to Learning Hub

DNS • Intermediate • 6 min read

EDNS Client Subnet (ECS): How CDNs Localize DNS Answers

How EDNS Client Subnet passes part of your IP to authoritative servers so CDNs return a nearby edge, and the privacy trade-off making some resolvers refuse it.

Query the same hostname from two different networks and you can get two different IP addresses back. Much of the time the reason is a mechanism called EDNS Client Subnet, or ECS, which lets a recursive resolver pass part of your IP address along to the authoritative server so a content delivery network can pick an edge near you. It is the piece that makes resolver-level geographic routing accurate, and it is also the reason some privacy-focused resolvers refuse to use it. This guide explains what ECS puts on the wire, how a CDN turns it into a localized answer, the caching and privacy trade-offs it creates, and how to check whether the resolver you use is sending it.

Why DNS-based localization needs ECS

CDNs and GeoDNS services decide which address to return based on where the request appears to come from. Without ECS, the only source address an authoritative server sees is the recursive resolver's own IP, not yours. If you use a large public resolver whose servers sit far from you, the authoritative server localizes to the resolver's location and may hand you an edge on the wrong continent. ECS fixes that by carrying a portion of the real client's address into the query, so the CDN localizes to you rather than to your resolver.

This is the protocol-level detail underneath the behavior described in our guide on why a DNS checker shows different IPs by location, and it is the engine behind the routing styles covered in GeoDNS versus weighted versus round robin routing.

What ECS puts in the query

ECS is an EDNS0 option, option code 8, defined in RFC 7871, which was published as Informational in May 2016. The resolver adds the option to the OPT record of the outgoing query. Rather than sending your full address, it sends a truncated prefix, typically the first 24 bits of an IPv4 address or the first 56 bits of an IPv6 address, which identifies your general network without pinpointing your exact host. The authoritative server answers and echoes back a scope, telling the resolver how specific the answer is and therefore how it may be cached.

FieldWhat it holdsRole
FAMILY1 for IPv4, 2 for IPv6Says which kind of address follows
SOURCE PREFIX-LENGTHBits of client address the resolver is sharingControls how much of your IP leaks, for example /24
SCOPE PREFIX-LENGTHBits the authoritative answer depends onSet in the reply; tells the resolver how narrowly to cache
ADDRESSThe truncated client prefix itselfThe actual network bits the CDN uses to localize

In the query the SCOPE field is zero; the authoritative server fills it in on the way back. A scope of 0 in a reply means the answer is the same for everyone and can be cached globally, while a larger scope means the resolver must cache that answer only for the matching client prefix.

How a CDN turns ECS into a nearby answer

When an ECS-aware authoritative server receives a query carrying a client prefix, it maps that prefix to a geographic or network location and returns the address of an edge server close to it. It sets the SCOPE to the prefix length its decision depended on. The resolver stores the answer keyed to that client prefix, so the next user on a different network does not wrongly receive the first user's localized result. The end effect is that two users behind the same resolver but on different networks can each be steered to their own nearest edge.

The privacy and caching trade-offs

ECS buys accuracy at a real cost, which is why it is contentious. Two problems stand out.

It leaks your network to more parties

Your approximate location, in the form of a network prefix, now travels to every authoritative server in the lookup and anyone observing that traffic, not just to your resolver. For a privacy-focused resolver that is unacceptable, so as of November 2026 several large public resolvers, including the one at 1.1.1.1, deliberately do not send ECS, while others such as Google Public DNS do send it. That difference is why the same name can resolve differently depending only on which resolver you ask.

It fragments the cache

Because answers are now keyed per client prefix instead of per name, a resolver must store many more distinct entries for the same hostname. That raises memory use and lowers hit rates, pushing more queries through to authoritative servers. Operators weigh that overhead against the routing accuracy ECS provides.

Checking whether your resolver sends ECS

You can see your resolver's ECS behavior without special tooling by asking a diagnostic name that reflects the client subnet back to you.

  1. Run dig TXT o-o.myaddr.l.google.com @8.8.8.8 +short and look for an edns-client-subnet line in the output; it shows the prefix the resolver forwarded.
  2. Repeat the query against a privacy-focused resolver, for example @1.1.1.1, and compare. A resolver that strips ECS will not report a client-subnet prefix.
  3. To test a specific CDN name, run dig +subnet=203.0.113.0/24 example-cdn-host +short from a resolver that honors ECS and watch the returned address change as you vary the subnet.
  4. Confirm the result reflects the machine you care about, since forwarders on your network may add, strip, or rewrite the ECS option before it reaches the authoritative server.

Frequently asked questions

Does ECS send my full IP address?

No. The resolver sends only a truncated prefix, commonly the first 24 bits for IPv4 or 56 bits for IPv6, which identifies your general network rather than your exact host. A resolver can also choose to send a shorter prefix or none at all.

Why do I get different answers from 1.1.1.1 and 8.8.8.8?

As of November 2026, Google Public DNS sends ECS while the 1.1.1.1 resolver does not. When ECS is absent, the CDN localizes to the resolver's own location instead of yours, so the two resolvers can legitimately return different edge addresses for the same name.

Can I stop my resolver from leaking my subnet?

Use a resolver that does not send ECS, or run your own resolver configured to omit the option. You cannot force an upstream public resolver to drop ECS from the client side, so the choice comes down to which resolver you point at.

Does ECS improve performance for everyone?

Not uniformly. It improves routing accuracy for users whose resolver sits far from them, but it also fragments resolver caches and raises load on authoritative servers. For users already close to their resolver the benefit is small while the privacy cost remains.

Is ECS the same thing as GeoDNS?

No. GeoDNS is the authoritative-side policy that returns different answers by location. ECS is the protocol option that carries the client's network to the authoritative server so that policy can act on the real user rather than on the resolver.

ECS is the quiet reason a DNS answer can depend on who is asking and from where, trading a slice of location privacy for sharper CDN routing. To see how a name resolves for you and compare answers across resolvers, run it through the Valla DNS lookup tool.

Troubleshooting box

If results look inconsistent, compare authoritative nameservers first, then recursive resolvers by region. Capture snapshots every 10 minutes for deterministic incident timelines.

Try VallaDNS free →

Intermediate • 6 min

How to Find a DNS Record's TTL (Current Value)

Find the TTL currently set on a DNS record: read the TTL column in dig and nslookup, tell the authoritative TTL from a resolver's countdown, and confirm a change.

Intermediate • 7 min

How to Check If Nameservers Have Propagated

Nameserver changes live at the parent TLD and follow the registry NS TTL, not your zone. Check the parent delegation and confirm the new NS set worldwide.