Free tech learning for everyone, from basics to pro

Network FundamentalsNetworking SecurityBeginner

What happens when you open a website: DNS, ARP, TCP, TLS, HTTP and routing step by step

In short: Opening a website uses almost every networking concept at once. The computer resolves the name with DNS, finds its gateway's MAC address with ARP, builds a TCP connection with a three-way handshake, agrees encryption with TLS, then sends an HTTP request. Along the way, switches forward frames by MAC address, routers forward packets by IP, and NAT translates the address at the edge.

The starting point

Your laptop is on the office Wi-Fi with address 10.10.20.57/24, gateway 10.10.20.1 and DNS server 10.10.5.53, all learned from DHCP when it joined. You type https://www.example.com and press Enter.

Opening a website, step by stepDNSname toaddressARPgateway MACTCP3-wayhandshakeTLSencryptionagreedHTTPrequest andresponseRoutinghop by hop
Figure 1. Several protocols work together in the first fraction of a second after you press Enter.

1. Finding the address (DNS)

The browser needs an IP address. It checks its own cache and the operating system's cache. If there is no answer, the laptop sends a DNS query (UDP port 53) to 10.10.5.53. The DNS server answers from its cache or resolves it through the root, .com and example.com servers, and returns, say, 203.0.113.10.

2. Is it local? (subnet check)

The laptop compares 203.0.113.10 with its own address and mask. It is not in 10.10.20.0/24, so the packet must go to the default gateway.

3. Finding the gateway's MAC (ARP)

To put a frame on Ethernet or Wi-Fi it needs the gateway's MAC address. If it is not in the ARP cache, the laptop broadcasts "who has 10.10.20.1?" and the gateway replies with its MAC.

4. Building the connection (TCP)

The browser asks the operating system for a TCP connection to 203.0.113.10 port 443. The laptop picks an ephemeral source port, say 51522, and sends a SYN. The data is encapsulated: TCP segment inside an IP packet (source 10.10.20.57, destination 203.0.113.10) inside an Ethernet frame (destination: the gateway's MAC).

5. Across the local network (switching)

The access point and switches forward the frame based on the destination MAC address, using their MAC address tables, until it reaches the gateway's port.

6. Through the routers (routing and NAT)

The gateway removes the Ethernet header, looks up 203.0.113.10 in its routing table, decrements the TTL and sends the packet towards the next hop in a new frame with new MAC addresses. At the internet edge, the firewall performs NAT, changing the source address to the company's public IP and remembering the mapping. Across the internet, each router repeats this hop by hop, guided by BGP routes, until the packet reaches the web server's network.

7. The handshake completes

The server replies with SYN-ACK, the laptop answers with ACK, and the TCP connection is open. The reply follows the same process in reverse; the firewall translates the destination back to 10.10.20.57 using its NAT table.

8. Encryption (TLS)

The browser sends a TLS ClientHello with the name www.example.com (SNI). The server answers with its certificate and key share. The browser checks the certificate chain and name, both sides derive keys, and everything after this is encrypted.

9. The request (HTTP)

The browser sends GET / HTTP/1.1 (or the HTTP/2 equivalent) with a Host header. The server replies 200 OK with the HTML. The browser then requests images, CSS and scripts, often from a CDN, reusing connections where it can.

10. Showing the page

All of this usually happens in well under a second. Each of these steps is also a place where something can go wrong, which is why working through them in order is such a good troubleshooting method.

Real-world example: using the walk-through to troubleshoot

A user reported "the internet is down". Following the steps: the laptop had an address and could ping its gateway (DHCP and ARP fine); nslookup www.example.com timed out (DNS failed); pinging 1.1.1.1 worked (routing and NAT fine). The problem was the DNS server, which had stopped after an update. The structured walk-through found it in two minutes.

Practice

Why does the laptop send the packet to its default gateway?
Because the destination address is not in its own subnet, which it checks using its subnet mask.
Which protocol finds the gateway's MAC address?
ARP.
Which addresses change at each router hop, and which stay the same?
The source and destination MAC addresses change at each hop; the IP addresses stay the same (except where NAT translates them).

Key takeaways

  • Opening a website uses DHCP, DNS, ARP, TCP, TLS and HTTP together.
  • Hosts send off-subnet traffic to the default gateway using its MAC address.
  • MAC addresses change at every hop; IP addresses stay the same except at NAT.
  • Walking through the steps in order is an effective troubleshooting method.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: