Interview Q&A / Computer Networks

INTERVIEW Q&A · 55 QUESTIONS

Computer Networks interview questions

What happens when you open a website, TCP vs UDP, DNS and HTTP.

  1. What happens when you type a URL in the browser and press Enter?

    The browser finds the server's IP address with DNS, opens a TCP connection, sets up TLS for HTTPS, sends an HTTP request, gets a response and then parses and renders the HTML, CSS and JavaScript into the page you see.

    BeginnerIn-depth3 min read
  2. How does DNS resolution work, step by step?

    Your device asks a recursive resolver, which checks its cache and, if needed, asks a root server, then the TLD server (like .com), then the domain's authoritative server, which returns the IP address. Every answer carries a TTL, so resolvers and devices cache it and skip most of these steps next time.

    IntermediateIn-depth4 min read
  3. What are the common DNS record types: A, AAAA, CNAME, MX, TXT and NS?

    A maps a name to an IPv4 address, AAAA to an IPv6 address, CNAME makes one name an alias of another, MX names the mail servers, TXT holds free text such as verification and SPF data, and NS lists the authoritative name servers for the domain.

    BeginnerQuick answer1 min read
  4. What is DNS TTL, and why do DNS changes seem to take time to "propagate"?

    TTL is how many seconds resolvers may cache a record. When you change a record, resolvers that cached the old one keep serving it until its TTL expires, so different users see the change at different times.

    BeginnerQuick answer1 min read
  5. What are DNS over HTTPS and DNS over TLS, and what problem do they solve?

    Plain DNS is unencrypted, so anyone on the path can read and alter your lookups. DNS over TLS (port 853) and DNS over HTTPS (port 443) encrypt the query between you and the resolver, hiding what names you look up from the local network.

    IntermediateQuick answer1 min read
  6. What is the difference between a recursive and an iterative DNS query?

    In a recursive query, the client asks a resolver to do all the work and return a final answer. In an iterative query, the server replies with its best referral and the asker follows it to the next server. Your device asks recursively; the resolver then asks iteratively.

    IntermediateQuick answer1 min read
  7. Why does DNS mostly use UDP, and when does it switch to TCP?

    A DNS lookup is one small question and one small answer, so UDP avoids the cost of a handshake. DNS falls back to TCP when the answer is too large for a UDP response (truncated flag set), for zone transfers, and for DNS over TLS.

    IntermediateQuick answer1 min read
  8. What is DNS cache poisoning, and how is it prevented?

    An attacker tricks a resolver into caching a forged answer, such as a bank's name mapped to the attacker's IP. Later users of that resolver are sent to the fake site. Defences include random source ports and query IDs, and DNSSEC, which signs records.

    AdvancedQuick answer1 min read
  9. Why can you not put a CNAME record on the root domain, such as example.com?

    A CNAME means this name is an alias for another name, so no other record may exist at it. The root of a zone must also hold NS and SOA records, so a CNAME there would conflict. Providers offer ALIAS, ANAME or CNAME flattening as a workaround.

    AdvancedQuick answer1 min read