Cloud DNS配置异常:api.mysite.com子域名无法解析求助
Let's break down your issue step by step, starting with the DNS records you shared:
mysite.com. NS 21600 ns-cloud-c1.googledomains.com. ns-cloud-c2.googledomains.com. ns-cloud-c3.googledomains.com. ns-cloud-c4.googledomains.com. mysite.com. SOA 21600 ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 api.mysite.com. A 300 34.xx.xxx.xx client.mysite.com. CNAME 60 c.storage.googleapis.com.
You mentioned you can access the frontend at client.mysite.com and the backend via its raw IP, but api.mysite.com throws a "server not found" error. This points to a DNS resolution issue—here are the most likely causes and fixes:
1. DNS Propagation Delays or Local Cache Stale Data
Even though your A record has a short TTL (300 seconds / 5 minutes), DNS servers worldwide might still cache an old (or non-existent) record for api.mysite.com.
Test with direct DNS queries: Run these terminal commands to verify what global DNS servers return:
# Check using Google's public DNS dig api.mysite.com @8.8.8.8 # Or use nslookup if dig isn't available nslookup api.mysite.com 8.8.8.8If the output shows
NXDOMAIN(domain does not exist), the record hasn't finished propagating. Wait 10-15 minutes and re-test.Flush your local DNS cache: Your device might be holding onto outdated data:
- Windows:
ipconfig /flushdns - macOS:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Linux:
systemd-resolve --flush-caches(orsudo service nscd restartfor older distros)
- Windows:
2. Misconfigured A Record in Google Domains
Double-check the record in your Google Domains console to rule out small errors:
- Confirm the
api.mysite.comA record is saved correctly—no typos in the IP address, extra spaces, or missing trailing dot (your config shows the dot, which is correct for fully qualified domain names). - Ensure there's no conflicting record (like a CNAME for
api.mysite.com—CNAME and A records can't coexist for the same subdomain).
3. Incorrect Nameserver Setup for the Domain
Make sure your domain's authoritative DNS servers are actually set to the four Google Cloud DNS servers you listed. It's common to update zone records but forget to switch the domain's nameserver settings at the registrar (even in Google Domains, you need to confirm this in the "Nameservers" section of your domain dashboard).
If you recently switched to these nameservers, it can take up to 48 hours for the change to fully propagate globally (despite the NS record's 6-hour TTL).
4. Network-Specific DNS Restrictions
Try accessing api.mysite.com from a different network (like your phone's cellular data instead of Wi-Fi). If it works on cellular but not your home/work network, your local network's DNS server might be blocking or failing to resolve the record. You can temporarily switch your device's DNS to Google Public DNS (8.8.8.8) or Cloudflare DNS (1.1.1.1) to test this.
内容的提问来源于stack exchange,提问作者TheDubiousDubber

