Highlights

Contents

Part XI
11

CDN, P2P and cloud networking

A packet path can be shortened by a nearby cache, complicated by a peer’s NAT, or hidden inside a virtual network. Without distinguishing logical endpoints from physical forwarding, a cloud diagram can conceal the same link and routing constraints we already calculated. We will place cached objects at the edge, attempt direct peer paths, and follow virtual interfaces into cloud route tables.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Network models andphysical signals2Data link and Ethernetswitching3VLANs and IP addressing4IP forwarding and routing5Transport and TCP6Flow and congestioncontrol7DNS and HTTP8QUIC, TLS and websessions9Proxies, tunnels andfirewalls10Socket programming andI/O11CDN, P2P and cloudnetworking12The complete browserrequest

#Section 49CDN, edge caches and anycast

A content delivery network, or CDN, serves eligible content closer to users. Its point of presence, or PoP, contains edge infrastructure; the origin remains the authoritative source behind caches.

On a cache hit, the edge returns a stored representation under its freshness policy. On a miss, it fetches from the origin, returns the result and may store a copy. A cache key can include host, path, query and selected variant headers. Omitting a meaningful variant risks incorrect or private content reaching another user. An edge cache is therefore an application correctness boundary as well as a capacity tool.

CDN ATLAS / MANY SERVING EDGES, ONE SOURCE OF CONTENTCDN ATLAS / MANY SERVING EDGES, ONE SOURCE OF CONTENTLondonMumbaiTokyoSão PauloSydneyoriginhit: selected edge serves permitted bytesmiss: fetch from source, then retain a usable copy
Figure 2.54Illustrative serving-site atlas. Nearby edges can answer reusable hits while misses fetch from the authoritative origin. The highlighted route shows one selected edge; map distance is not a latency measurement.

DNS-based steering can choose a service address for a user, while anycast advertises the same service address from several locations and lets routing choose a reachable instance. The selected instance is determined by routing and policy, not guaranteed geographic proximity. Changes in routing may change the serving location, so long-lived stateful connections need suitable deployment design.

Using the illustrative freshness example, a 300 second object lifetime with 120 seconds elapsed leaves 180 seconds of simple reuse allowance. Explicit invalidation attempts to remove copies earlier, but independently held caches do not all update instantaneously by definition. Versioned object names let a new representation have a distinct cache key instead.

HTTP’s caching rules govern reuse, while CDN routing is a further deployment policy. An interviewer should hear which bytes are cacheable, who owns their key and lifetime, and what a miss costs. A CDN can absorb public object traffic; it does not automatically cache personalized mutations safely.

#Section 50P2P, NAT traversal, STUN, TURN and ICE

NAT traversal finds a usable peer path despite translation and filtering. Another peer cannot ordinarily initiate delivery to Finch’s private campus address without suitable boundary state.

A STUN exchange lets a peer observe the public address and port visible to a server. It discovers a mapping, not a permanent globally reachable endpoint. That mapping can depend on destination and expire. Hole punching asks both peers to send toward discovered endpoints so their gateways may create compatible outbound state.

DISCOVER, TEST A DIRECT PATH, OR RELAYpeer A + NATpeer B + NATSTUN serverTURN relayICE tests the direct pair
Figure 2.55STUN reveals an observed mapping, direct checks test it, and TURN supplies a relay when the direct path fails. Orange marks the attempted peer path rather than assuming discovery proves reachability.

TURN supplies a relay endpoint when direct traffic cannot pass. ICE gathers candidate addresses, tests candidate pairs and selects a working path. It can consider local, discovered and relayed candidates rather than assuming one technique succeeds everywhere. Relaying spends service bandwidth and introduces another failure boundary, but it can provide connectivity under restrictive network policy.

Finch’s illustrative public mapping is 198.51.100.7:40001, restoring to 192.168.10.70:51000 for the original flow. A STUN server might observe a different mapping from another destination. That is why a discovered public tuple cannot be treated as a promise that any peer can contact it. Keep the discovery observation and the actual peer-connectivity test distinct.

ICE’s specification describes connectivity checks. Encryption and peer authentication remain necessary after a path succeeds; STUN does not authenticate the other application’s identity. An interview answer should move through discovery, candidate tests, direct exchange if possible and relay fallback if needed. Peer-to-peer is a placement of application roles, not an exemption from firewalls or congestion control.

#Section 51Virtual NICs, bridges, VXLAN, SDN and NFV

A virtual network interface is a software endpoint. An overlay network carries a logical path above an underlay, adding encapsulation while retaining forwarding obligations.

A VLAN partitions broadcast membership within link infrastructure. VXLAN carries a logical Ethernet frame inside an outer packet so a virtual link can span an IP underlay. The outer route reaches a tunnel endpoint; the inner addresses identify the logical endpoints. A packet capture at one layer can therefore show different addresses from a capture at another without either being wrong.

LOGICAL DELIVERY USES A DISTINCT UNDERLAY ROUTEtenant A vNICtenant B vNICtunnel endpointtunnel endpointunderlayouter IP routeinner MAC and tenant addresses
Figure 2.56The overlay retains inner tenant addressing while the underlay forwards an outer packet between tunnel endpoints. Orange marks the outer IP route through the underlay, separate from the logical tenant link.

SDN

Software-defined networking, or SDN, makes forwarding control programmable through a separation between control decisions and packet handling. A controller or control system programs forwarding behavior; the data plane applies it. Removing a controller need not stop every packet immediately if forwarding state already exists, but new decisions and convergence can fail according to the deployment.

NFV

Network function virtualization, or NFV, implements functions such as firewalls or load balancers in software on computing infrastructure instead of requiring a dedicated appliance for each function. It describes where the function runs. SDN describes how forwarding is controlled, so the terms are related but not interchangeable.

Finch’s original 1,500 byte packet requires additional outer bytes in an overlay. VXLAN’s specification defines that wrapping; effective MTU planning must account for it. Virtual isolation also needs an enforced membership and policy boundary, not merely different interface names. The useful diagram shows inner endpoints, tunnel endpoints and the underlay route separately, then identifies which table or control system chooses each.

#Section 52Docker namespaces, port mapping and cloud routes

A network namespace gives a group separate interfaces and routes. A listener inside it still needs correct host connectivity, translation, and policy to serve the campus browser.

A published port creates a configured path from a host address and port to a container endpoint. It is distinct from merely declaring what port the application expects. Binding only to the container’s loopback interface can prevent traffic arriving through its other interface from reaching that listener. Names, routes, firewall rules and actual binding must agree.

A CONTAINER'S PACKET LEAVES THROUGH FOUR NESTED BOUNDARIES BEFORE IT REACHES THE INTERNETA CONTAINER'S PACKET LEAVES THROUGH FOUR NESTED BOUNDARIES BEFORE IT REACHES THE INTERNETVPC 10.0.0.0/16: routes and security groupssubnet 10.0.1.0/24host VM 10.0.1.12container nseth0 172.17.0.2docker0 bridgeiptables MASQUERADEinternet gatewaypublic serverthe reply needs the same path, in reverse, to be allowed
Figure 2.57A container’s virtual interface reaches host forwarding before cloud routing and policy apply. Orange marks the VPC boundary, whose routes and security policy must allow the flow.

Service-to-service traffic uses the intended network membership and service discovery rather than assuming a host-published port is always necessary. Docker’s networking documentation describes its drivers and network behavior; exact defaults depend on the chosen driver and installation, so this trace states its bridge assumption.

A virtual private cloud, or VPC, defines an administratively isolated logical network. Subnets define address segments, route tables choose next hops, an internet gateway provides an Internet-routing boundary, and a NAT gateway commonly supplies outbound translation for private endpoints. A security group expresses resource-associated traffic rules under the cloud provider’s semantics. A subnet’s label alone does not prove it is publicly reachable.

Finch already belongs to 192.168.10.64/26, with 62 ordinary host addresses. Moving that addressing pattern into a cloud diagram does not change longest-prefix matching or the need for a return path. Some cloud platforms reserve additional addresses, so the ordinary IPv4 count is not their allocatable-host count. Diagnose a cloud flow through namespace binding, local bridge, host policy, subnet route, gateway and return policy in order.