brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dig +subnet shows the answer a resolver gives other regions

Dig
~/tips/tip-dig-subnet-ecs

dig @8.8.8.8 www.google.com +subnet=203.0.113.0/24

Send an EDNS client subnet with a query to see which servers a CDN picks for another network.

Big sites give different addresses depending on where the question comes from. Some resolvers pass a piece of your network address along, called EDNS Client Subnet, and dig can pretend to be somewhere else with +subnet.

dig @8.8.8.8 www.google.com +subnet=203.0.113.0/24
dig @8.8.8.8 www.google.com +subnet=198.51.100.0/24 +short

Look for the CLIENT-SUBNET line in the OPT section of the reply, for example ; CLIENT-SUBNET: 203.0.113.0/24/0. The last number is the scope: how much of the subnet the authoritative server actually used. A scope of 0 means the answer is the same for everyone, so the subnet made no difference. A larger scope means you got an answer tailored to that network, and with real prefixes from other countries you may see completely different addresses.

It is a way to check that a geo routing setup behaves as intended without a VPN in every region. Use real prefixes from the networks you care about; the documentation ranges above are only placeholders.

Not every resolver plays along. Quad9 and Cloudflare do not pass client subnets on for privacy reasons, so with them the option has no effect. That is also a reason I prefer those resolvers for daily use: ECS gives authoritative servers part of your address. +subnet=0 asks a resolver not to send any of your subnet.

Further reading: dig manual (BIND 9), RFC 7871: Client Subnet in DNS Queries

Going deeper: Guide: dig for beginners, look up DNS records and read the answer

More Dig tips dig +noall +answer DS example.com dig nope.iana.org @9.9.9.9 | grep -E 'status|SOA' dig +search nas dig +yaml example.com A dig +short +identify example.com @9.9.9.9 All Dig tips (36) All topics

Link