Internal routing: MAC addresses and NAT

What this lesson covers

This lesson covers two things: why content delivery networks exist, and how a home router knows which internal computer a response belongs to. Fetching a google.com page from Google's server takes about a second, and since many people request the same page the response should be cached. Caching on the client's own computer risks a stale page when Google changes it. A CDN is a cache placed in many locations around the world, such as India, the US, Japan and China, so a router in China fetches the page from the nearby copy, which saves bandwidth and cuts response time, and Google can tell the CDN when the page has changed. For the return path, the router has two methods: keep a table mapping a request to the internal user who sent it, or put the sender's information in the request itself, which the video says is more common. Network address translation (NAT) gives each computer inside the network a virtual IP address, such as 22.22.3.5, that is unique only within that network and is mapped to the physical machine. Alternatively the router records the MAC address, which is burnt into the computer, against a request ID. Both work, but the video notes that someone who alters the router's table or spoofs a MAC address could pin their requests on another user, a security concern application engineers rarely handle.

  • A CDN is a set of caches placed around the world so a page is served from a nearby copy, saving bandwidth and time
  • A page cached on a local computer can go stale, whereas a CDN is updated when the origin changes
  • A router can match a response to its sender with a stored table or by carrying the sender's details in the request, which is more common
  • NAT gives each internal computer a virtual IP address that is unique only inside that network
  • Recording the MAC address burnt into a computer also works, but a changed table or a spoofed address can blame another user