Computer networks · Concept
How DNS finds a website's address
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
When you type a website's name, how does your computer find its IP address? Walk me through the DNS lookup step by step.
Then
Follow-ups the interviewer asks next
- What is TTL in DNS, and why do DNS changes take time to show up?
- What are A, AAAA, CNAME and MX records?
- Which port and protocol does DNS use?
- What is the hosts file, and when is it checked?
- A site opens by IP address but not by name. What does that tell you?
The answer
What a strong answer covers
- Caches first: the browser's, then the operating system's (which also reads the hosts file).
- Then the configured resolver: the college's or ISP's, or a public one like 8.8.8.8 or 1.1.1.1. It does the work for you (a recursive lookup).
- If the resolver hasn't cached it: it asks a root server, which points to the servers for .com (or .in); those point to the domain's authoritative name servers; those give the actual record. The resolver caches the answer and returns it.
- TTL says how long a record may be cached, so a change shows up only after the old TTL runs out.
- A: an IPv4 address. AAAA: an IPv6 address. CNAME: an alias to another name. MX: the mail server. Also NS and TXT.
- Mostly UDP port 53, TCP 53 for big answers; DNS over HTTPS uses port 443.
- The hosts file (
/etc/hosts, orC:\Windows\System32\drivers\etc\hosts) is checked before DNS on most systems. - Works by IP but not by name: the problem is DNS (resolver down, wrong record, or the name blocked), not the server.
- Tools: nslookup and dig.
The red pen
Common traps
Avoid:"DNS is one big server with every name"; not mentioning caching; "the router stores every website's IP".
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.