An online retailer reports that someone at a firm's head office tried to sign in to its customers' accounts. The retailer's logs give the firm's public address, a source port and the exact times. The head office's 300 computers reach the internet through an edge device that applies PAT.
How one request crosses a network
A request from a laptop to a website passes through several devices, and each one reads a different part of it. A switch reads one label, a router another, a firewall a third, and only the server reads the request itself. No background is assumed beyond the earlier network units. Knowing what each device can see and change tells a security manager where a control can work, where a fault can hide and who could read the traffic.
By the end of this unit you will be able to:
- Decide from two addresses and a mask whether a request is delivered directly or through the default gateway
- Explain why the hardware addresses change at every hop while the IP addresses stay the same
- Say what a switch, a router and a firewall each read and each rewrite
- Tell apart what TLS hides from devices on the path and what it leaves readable
The customer portal opens, and three people want to know how
An illustrative example
At a small insurance office, a member of staff opens the company's customer portal, which is run by a hosting company in another city. The page appears in under a second.
That afternoon the office manager asks three questions. Could the internet provider have read the customer's details on the way? Could the office firewall have stopped the visit if it had wanted to? And when the hosting company looked in its records, whose address did it see: the laptop's, or something else?
Which devices on the way could read the portal's address, and which could read the customer's details?
First decision: is the destination on my own network?
Before a laptop sends anything, it needs the destination's IP address. It asks the office's name server, through DNS, and learns that portal.example is at 203.0.113.20.
Next it compares that address with its own, using its subnet mask. The laptop is 10.20.30.25 with a mask of 255.255.255.0, so its network is 10.20.30. The portal's first three numbers are 203.0.113. They differ, so the portal is on another network.
That one comparison decides the whole journey. A destination on the same subnet is sent to directly, and no router is involved. A destination anywhere else is sent to the default gateway, the router or that leads off the subnet. Here the gateway is 10.20.30.1, the inside connection of the office's edge firewall.
Posting a letter inside the office or outside it
A note for a colleague goes straight into their pigeonhole. A letter for another town goes into the post room's out tray, and the post room handles the rest. The laptop makes the same choice for every .
Common misconception
“Every packet a computer sends passes through its default gateway.”
The gateway is used only for destinations outside the subnet. Traffic to a printer or server on the same subnet goes through the switch alone, so a firewall at the gateway never sees it.
Two addresses do two jobs: one for the hop, one for the journey
Every frame on the office network carries two kinds of address at once. The IP addresses in the packet name the two ends of the whole journey: the laptop and the portal. The hardware addresses in the frame name the two ends of one link only.
So the laptop builds a packet addressed to 203.0.113.20, but puts it in a frame addressed to the gateway's hardware address. It learns that address with , by asking the office network who holds 10.20.30.1.
When the frame reaches the gateway, the gateway throws the frame away and keeps the packet. To send the packet on, it builds a new frame with its own hardware address as the source and the next router's as the destination. Every router on the path repeats this. Each link from one device to the next is called a hop.
Hardware addresses change at every hop. IP addresses stay the same from end to end, unless a device translates them on purpose.
Common misconception
“The web server can see the hardware address of the laptop that sent the request.”
A hardware address is used on one link and then discarded. The server sees the hardware address of the router on its own network, never the laptop's.
What a switch, a router and a firewall each read and change
Each device on the path opens the wrappers it needs for its job, and no more.
| Device | Highest layer read | Decides by | Rewrites |
|---|---|---|---|
| Office switch | 2 | Destination hardware address, looked up in its MAC address table | Nothing |
| Edge firewall | 4, or 7 for some kinds | Its rules, on addresses, ports and the state of each connection | The frame; the source address and port, through ; the time to live |
| Internet router | 3 | Destination IP address, looked up in its routing table | The frame; the time to live |
| Web server | 7 | The request itself | Nothing: it writes the reply |
A switch keeps a MAC address table: a list of which hardware address was last seen on which of its ports. A router keeps a routing table: a list of networks and the next router towards each one. A router that finds no better entry uses its default route.
The office firewall is stateful: it remembers each connection a member of staff opens, and lets in only replies that belong to one of them. On the way out it also applies port address translation (PAT). It replaces the private source 10.20.30.25 with its own public address, 198.51.100.2, and gives the conversation a new source port. The reply comes back to that public address and port, and the firewall's table sends it to the laptop.
Every router, the firewall included, lowers the packet's time to live by one. A packet that reaches zero is discarded, which ends loops.
What arrives at the server, and what was changed on the way
What changes as a request crosses three links
Read this figure as text
A laptop in an insurance office opens the customer portal, which a hosting company runs on another network. The figure follows one request and shows, link by link, which addresses are rewritten and which are not.
- The laptop, 10.20.30.25, builds a packet for the portal at 203.0.113.20 on TCP port 443, and puts it in frame 1, addressed by hardware address from the laptop to the firewall's inside connection, its default gateway.
- The office switch reads only the destination hardware address in frame 1 and rewrites nothing, so frame 1 reaches the firewall unchanged.
- The edge firewall checks its rules and records the connection. It removes frame 1, applies port address translation so that the source becomes 198.51.100.2 with a new source port, lowers the time to live by one, and builds frame 2 from its outside connection to the router.
- The internet router reads the destination IP address, lowers the time to live by one, removes frame 2 and builds frame 3 from its own hardware address to the portal's.
- The portal server is the only device that reads the request, because the request is sealed by TLS from the laptop to the portal.
- Across the whole journey the destination, 203.0.113.20 on port 443, never changes. The source reads 10.20.30.25 inside the office and 198.51.100.2 after the firewall, which is why only the firewall's translation records link the request back to one laptop.
Follow one field at a time from the laptop to the portal.
- Destination IP address: 203.0.113.20 from start to finish. Nothing on the path changed it.
- Source IP address: 10.20.30.25 inside the office, then 198.51.100.2 after the firewall. The hosting company's records show the office's public address, not the laptop's.
- Source port: changed once, by the firewall's PAT. Destination port: 443 throughout.
- Hardware addresses: new at every hop.
- Time to live: one lower after every router.
- The request inside: unchanged, and encrypted from end to end because the portal uses TLS.
This pattern tells an investigator where to look. The firewall's translation records are the only place that links the public address back to one laptop. Without them, the hosting company's logs point at the whole office.
TLS hides the request but not the addresses
Transport Layer Security (TLS) the data that a program sends over . It runs at the two ends, so the request and the reply are readable only to the laptop and the portal.
Everything beneath TLS has to stay readable, because the devices on the path need it to deliver the packet. Each router must read the destination IP address. The firewall must read the ports to apply its rules. The internet provider can therefore see which address the office talked to, when, on which port and how much data passed.
| Readable on the path | Hidden by TLS |
|---|---|
| Source and destination IP addresses | The page requested and the path within the site |
| Source and destination ports | Names, passwords and customer details typed in |
| Timing and amount of data | The content of every reply |
| Usually the site's name, sent openly in TLS's first message | Cookies and other session details |
Hiding the addresses as well needs a tunnel: a protected link that wraps the whole packet, addresses included, inside a new packet between two trusted points. A path device then sees only the tunnel's outer addresses.
Common misconception
“Any firewall that the traffic passes through can block it on what the request contains.”
A device can act only on what it can read. Once the content is encrypted, a firewall that merely forwards it can judge the addresses and ports, nothing more. Inspecting content means decrypting it at a proxy that the organisation controls.
Worked example: The portal request, hop by hop
Laptop 10.20.30.25, mask 255.255.255.0, gateway 10.20.30.1. Edge firewall inside 10.20.30.1, outside 198.51.100.2. Internet router 198.51.100.1 on one side and 203.0.113.1 on the other. Portal 203.0.113.20, TCP port 443.
- DNS turns portal.example into 203.0.113.20.
- The network parts 10.20.30 and 203.0.113 differ, so the packet goes to the gateway, 10.20.30.1.
- ARP finds the gateway's hardware address. The frame is addressed to the gateway; the packet inside is addressed to the portal.
- The switch reads only the frame's destination and sends it out of the gateway's port.
- The firewall checks its rule that staff may open secure websites on TCP 443. It records the connection, applies PAT to give source 198.51.100.2 and a new port, lowers the time to live and builds a new frame for 198.51.100.1.
- The internet router reads the destination IP address, finds 203.0.113.0/24 on its other side, lowers the time to live and builds a frame for the portal.
- The portal removes each wrapper in turn and answers 198.51.100.2. The firewall matches the reply to its table and sends it to the laptop.
Three frames were built, one per link. The destination address never changed, the source address and port changed once at the firewall, and only the two ends read the request.
A question, worked through
A council's web filter sits at the internet edge and forwards traffic without decrypting it. The security manager is told to stop staff uploading files to one named file-sharing website. Staff reach every website over TLS. The manager must choose a rule that the filter can enforce as it is.
Which rule can the filter enforce as it is now set up?
Decide on your answer, then open the reasoning
- The question asks what the filter can act on as it stands. It forwards TLS traffic without decrypting it, so it reads only what lies beneath TLS.
- Rule out a: the content of an upload is inside TLS. The filter cannot see whether a council document is there.
- Rule out c: the page path is part of the request, which TLS encrypts. The filter never reads it.
- Between b and d: the filter can measure traffic volume, but it cannot tell an upload request from any other request to the same address, so d is not enforceable as written.
- The destination IP address must stay readable for delivery, so a rule on the site's addresses is the one the filter can apply. The answer is b.
Answer: B. Block traffic to the file-sharing site's published IP addresses
Choosing between good answers
- Two devices on the same subnet cannot reach each other
- look at the cable, the switch and ARP before any router or firewall, because neither is on that path.
- A device can reach its neighbours but nothing beyond the subnet
- suspect the default gateway or the subnet mask before anything further away.
- A question asks what a device on the path can see in TLS traffic
- answer addresses, ports, timing and volume, and not the content or the page requested.
- An outside party's logs show only the organisation's public address
- the link to one inside device is in the translation records of the device that ran PAT.
Try it
Step through the portal request hop by hop, then set a fault such as a wrong gateway and find where the request stops.
Loading the preview.
Check your understanding
3 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 3
What to remember
- A computer sends directly to a destination on its own subnet and through its default gateway to any other.
- Hardware addresses are rewritten at every hop. IP addresses stay the same end to end unless a device translates them.
- A switch reads hardware addresses, a router reads IP addresses, and a firewall reads addresses, ports and connection state. Only the server reads the request.
- PAT at the edge changes the source address and port, so outside logs show the organisation's public address.
- TLS hides the content of a request from devices on the path. It does not hide the addresses, ports, timing or amount of traffic.
Say it from memory
As a packet crosses three routers, which addresses change and which stay the same?
The hardware addresses change at every hop, because each router discards the frame and builds a new one. The source and destination IP addresses stay the same end to end, unless a device such as a NAT firewall translates them on purpose.
What does a switch, a router and a stateful firewall each base its decision on?
A switch: the destination hardware address and its MAC address table. A router: the destination IP address and its routing table. A stateful firewall: its rules on addresses and ports, and whether the packet belongs to a connection it has already recorded.
When a website is reached over TLS, what can a device on the path still read?
The source and destination IP addresses, the ports, the timing and amount of data, and usually the site's name in TLS's first message. The request, the page, credentials and replies are encrypted.
How does a computer decide whether to send a packet directly or to its default gateway?
It compares the destination IP address with its own, using its subnet mask. A destination on the same subnet is sent to directly, through the switch alone, with no router involved. A destination anywhere else is sent to the default gateway, the router or firewall that leads off the subnet.
After port address translation at the edge, which record links the public address in a server's logs back to one inside computer?
The firewall's translation records. PAT replaces the private source address with the firewall's public address and gives the conversation a new source port. Without those records, the server's logs point only at the organisation's public address.
Sources
- RFC 1812: Requirements for IP Version 4 Routers, IETFA router removes the link-layer header a packet arrived with, forwards by the destination IP address using its routing table, lowers the time to live and adds a new link-layer header.
- RFC 1122: Requirements for Internet Hosts, Communication Layers, IETFA host sends directly to a destination on its own network and to a gateway for any other destination.
- IEEE 802.1Q-2022: Bridges and Bridged Networks, IEEE Standards AssociationA switch is a bridge that forwards frames by their destination hardware address, using addresses it has learned on each port.
- RFC 826: An Ethernet Address Resolution Protocol, IETFARP finds the hardware address of the next device on the local network from its IP address.
- RFC 791: Internet Protocol, IETFThe source and destination address fields and the time to live field of the IPv4 header.
- RFC 3022: Traditional IP Network Address Translator, IETFNetwork address and port translation rewrites the source address and port of outgoing packets and keeps a table to return replies to the right inside host.
- NIST SP 800-41 Rev. 1: Guidelines on Firewalls and Firewall Policy, NISTA stateful firewall tracks connections and admits replies that belong to them; a firewall cannot apply content rules to traffic it cannot decrypt.
- RFC 9846: The Transport Layer Security (TLS) Protocol Version 1.3, IETFTLS protects the data of a connection between client and server; the ClientHello and ServerHello are not encrypted.
- RFC 6066: Transport Layer Security (TLS) Extensions: Extension Definitions, IETFThe server_name extension in the ClientHello tells the server which site name the client wants.