Skip to main content Alex Collie's blog

How Does My Router Know How to Get to Google.com

At first glance, this question might seem trivial. However, the process behind a browser loading a webpage is a complex marvel that we take for granted every day—handling millions of requests and intricate routing to reach servers like Google’s. Let’s take a journey into this process.

We’ll break it down into two main steps: first, discovering the site’s address, and second, retrieving data from that site. For the sake of brevity, some details will be simplified.

Finding the site’s location or DNS

DNS (Domain Name System) is the technology used to resolve a name like google.com into an IP address (for example, 172.217.169.36). First, let’s find google.com. Your browser will begin by checking your computer’s local DNS cache. In our example, there’s no cached record (this is known as a cache miss), so it will then query your ISP’s DNS server. If the ISP’s server doesn’t have the record, it will check a root name server (for instance, root name server A, which is always at 198.41.0.4). Since we need the IP address for google.com, the process continues by querying a .com top-level domain (TLD) server, which can then provide the IP address for the google.com name server.

Technically, this entire process is known as recursive name resolution, where each server fetches the necessary subsequent records until the final IP address is obtained.

image 4 An example response from a dns server might look like th following

code snippet start

; <<>> DiG 9.10.6 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21340
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             207     IN      A       216.58.213.14

;; Query time: 55 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Sun Feb 16 13:16:24 GMT 2025
;; MSG SIZE  rcvd: 55

code snippet end

From here we can see the A record (IPv4 record for IP address) for google.com is 216.58.213.14

Getting Our Message to the Server

Now that we have the IP address, we can try to visit the site. But where is 216.58.213.14, and how does my computer know how to reach it? First, your router passes the request to your ISP. The ISP then checks its routing table to find the most specific match for the destination. Let’s consider a sample network topology as shown below.

image 4 Routers maintain an internal routing table that lists the IP addresses they can reach and the paths to reach them.

For example, our ISP might have a routing table that looks like the following:

DestinationNextHop
IEXBT
BTeth0
Threeeth1

Eth meaning an Ethernet port. Which is a way of saying they are directly connected. In this case, IEX is only reachable via the BT network, so its NextHop is BT. BT is directly connected to the ISP, so its NextHop is eth0. Three is directly connected to the ISP, so its NextHop is eth1.

In the example, BT’s routing table might look like this

DestinationNextHop
IEXeth0
(YourISP)eth1

Finally the IEX’s routing table might look like this

DestinationNextHop
Googleeth0
BTeth1
Verizoneth2

Your ISP might not know the direct path to google.com; however, it does know how to reach an Internet Exchange Point (IEX). Since the IEX is directly connected to Google’s network, the packet only needs to reach the IEX to be forwarded to google.com. The next router determines where to send the traffic by matching the destination IP address more precisely.

This procedure is similar to how a packet would be routed to your friend’s computer on another ISP.

In short, your computer reaches google.com by first obtaining an IP address from an authoritative DNS provider. Then, a packet is sent with that IP address to your ISP, which uses its internal routing table to forward the packet. Each router along the path does the same, using the most specific match available until the packet reaches its destination.