10. Computer Networks
Opening
Big idea: Communication depends on agreed identities, usable paths and devices that connect those paths.
Use a separate practice folder for the programs. Each example is self-contained unless its section says otherwise.
- Distinguish network scopes and device roles.
- Compare topologies and their failure trade-offs.
- Explain MAC addresses, IP addresses, the Web, IoT and DNS.
Read the rule, trace the worked example, and try the quick check before reading its answers. When a result surprises you, change one input and explain the difference.
This is an original lesson following the listed syllabus topics. Examples, datasets, questions and diagrams were created for this edition.
The previous chapter asked precise questions of data already stored in one place. This chapter moves that data between places.
A school record is useful on one computer. It becomes far more useful when the office, the library and the classroom can all reach it safely.
The chapter builds in six stages. First it defines a network and separates connection from permission.
Then it traces how packet switching and common rules joined separate networks. Then it names network scopes and the devices that connect paths.
Last it compares topologies, addressing, the Web and the name system.
Three running situations return throughout. A school shares one printer among several computers.
A student joins a video call from home. The library lends a device and records the loan.
Each situation needs a path, an identity and a permission check.
Study by predicting. Cover each expected output and each result table.
Say the answer aloud first. When a prediction fails, find the first line where your trace diverged.
That line holds the lesson. Short sentences carry one idea each.
Expect the same vocabulary in every section. Node, link, protocol, address, route and cache keep one meaning throughout.
When a sentence confuses you, check which term it uses. Technical words are defined in plain words at first use.
A common early mistake is treating new vocabulary as decoration. Each term in this chapter earns its place in a trace or a decision.
If you can use node, link and address correctly in an answer, the vocabulary is working.
Diagrams in this chapter are tools, not decoration. Cover the caption and explain the arrows first.
Then read the walkthrough and check your explanation. Figures that you can redraw from memory are figures you understand.
Worked examples follow one pattern: goal, approach, trace, result. Read the goal before the steps. Trace each step against the diagram or code. State the result in your own words before reading it.
Numbers in this chapter come from stated assumptions, not from measurements of real services. Link rates and file sizes are small classroom figures chosen for clear arithmetic.
Real-world speeds vary by plan, medium and load, so ask your teacher for current local figures before quoting them.
A usable path, a correct identity and a permission check: all three must hold before shared data can move safely.
10.1 INTRODUCTION TO COMPUTER NETWORKS
A network gives devices a way to exchange messages. It does not decide that every user may read every file. The application still needs to identify the requester and check the requested action.
Think of a client asking a server for a record. The path carries the request. The server decides whether that record may be returned. A successful connection can therefore still lead to a legitimate access-denied response.
- Identify the sender and the service being requested.
- Check whether messages can travel between them.
- Check whether the requested use is permitted by the application.
Two devices become more useful when they can exchange data instead of moving files by hand.
A computer network connects communicating devices through links and agreed protocols. A node is one participating device.
A link carries communication between nodes. A protocol is an agreed set of message and behaviour rules used by communicating systems.
Think of the school printer. Several computers share it through the room network.
Each computer is a node. The cables or radio signals are links.
The agreed printing rules form a protocol. Without the rules, signals would arrive as meaningless noise.
A second picture helps. The library keeps one record per device.
When the office asks for that record, the office computer is the client that requests a service. The library computer is the server that supplies it.
The same machine can be a client in one exchange and a server in another.
In a peer-to-peer arrangement, participants share resources without one central application server controlling every exchange. Each participant can both offer and request files.
The sharing rules still matter, even though no single boss directs them.
| Sharing gives | Sharing demands |
|---|---|
| Access to files, printers and services from many nodes. | A clear record of who may use each service. |
| One connection usable by many programs. | Rules for fair use when traffic grows. |
| Fewer repeated copies of the same file. | Reliable equipment and someone who manages it. |
Read the table. The left column lists gains.
The right column lists duties. Every shared benefit creates a management task.
A network design should state who needs to communicate, what traffic is expected, which failures matter and who manages the equipment.
Read the diagram. The client states its request.
The network carries it. The server checks the request against its permissions.
Only then does the client use the response. A reply of “access denied” is still a successful delivery of a decision.
Connectivity answers whether messages can travel. Authorisation answers whether this use is permitted.
More links alone do not guarantee a useful or secure system. Do not treat a successful connection as permission to read everything.
A short arithmetic example shows why rates matter. Assume a file holds 5 megabytes. One byte holds 8 bits, so the file holds 40 megabits. That is the amount the link must carry.
Now assume the link carries 10 megabits each second. This rate is a classroom assumption for clear arithmetic, not a measured real-world speed.
Divide amount by rate: 40 / 10 = 4. The transfer takes 4 seconds under these assumptions.
Read the steps again. Size first, in bits. Rate second, in bits per second. Division last, giving seconds. If the file doubles, the time doubles. If the rate doubles, the time halves. Units guide the calculation.
Try a second assumed rate to test the pattern. If the same 40-megabit file used a 20 megabit-per-second link, the time would be 40 / 20 = 2 seconds.
Doubling the rate halves the time. The method never changes: size in bits divided by rate in bits per second.
Does connecting two laptops automatically permit every file on both laptops to be read?
Goal. Decide whether a new link changes file permissions.
Approach. Separate the delivery path from the permission rules.
Trace. The link supplies a path for messages. Applications and their settings decide which files each laptop exposes. Nothing in the cable rewrites those settings.
Result. No, connectivity and authorisation are separate requirements.
Result: No. The path is new, but permissions still decide what each laptop shares.
A message travels from the sender through router A to the receiver. How many hops does it cross?
Goal. Count the forwarding steps between the endpoints.
Approach. List the stops in order, then subtract one.
Trace. The stops are sender, router A and receiver: three stops. Hops equal stops minus one, so 2 hops. Each hop carries the packet closer to its destination.
Result. Two hops: sender to router A, then router A to the receiver.
Result: Two hops. Three stops always give 2 forwarding steps.
A network moves messages. Applications decide what those messages may do. Never confuse the two.
10.2 EVOLUTION OF NETWORKING
The Internet connects networks. The Web provides one way of locating and exchanging resources over that infrastructure. The Web did not need to invent every cable, router or packet-delivery mechanism again.
When reading networking history, separate a new physical link, a common protocol and a new application. Each can be an important development, but each solves a different problem.
- Identify what a development made possible.
- Ask whether it changed connections, message rules or an application.
- Place later services on the infrastructure that already existed.
Modern networking grew by joining different kinds of networks through common communication rules.
Early computer links often depended on particular machines or organisations. A message sent on one system could not easily travel on another. Each group used its own wiring and its own rules.
Packet-switching research changed that picture. A long message is split into smaller units called packets.
Each packet carries its destination address. Packets from many conversations can share the same links.
The receiver rebuilds the original message from its packets.
Think of postcards from one long letter. Each card carries the address and a part number. The cards may travel by different vans. The receiver sorts them by number and reads the whole letter again.
Read the diagram. First every conversation needs its own link, which is wasteful.
Then messages split into packets. Shared links carry packets from many users.
The receiver reassembles its own packets into the original message.
ARPANET was an important experimental network that tested these ideas. It was not the same thing as the later World Wide Web. Keep the two apart: one tested packet delivery, the other built linked documents.
TCP/IP provided a common internetworking foundation. An internet can connect separate networks while allowing their internal technologies to differ.
Different wirings and signals can still exchange packets under shared network-layer rules.
TCP/IP names a family of rules that lets different networks cooperate. Some rules split and address packets.
Others control reliability and delivery order. Applications use these services without rewiring the underlying links.
The public Internet grew through research, education and later wider commercial and personal use. The Web was developed later at CERN. It introduced a linked-document system using web addresses, HTTP and HTML.
| Development | Why it mattered |
|---|---|
| Packet switching | Several communications can share links through separately forwarded packets. |
| Internetworking | Different networks can communicate through a common network-layer framework. |
| The Web | Linked resources can be addressed and retrieved through browsers and web servers. |
Read the table. Each row solves a different problem. Sharing links is a transport trick. Joining networks is an agreement problem. Linked pages are an application idea. One row does not replace the others.
Email and many other applications also use the Internet. The Internet supplies broad communication infrastructure.
The Web is one service family using it. A video call, a file transfer and a web page can share the same cables.
A page arrives with garbled text although every packet reached the receiver. Which layer should you suspect: delivery or interpretation?
Goal. Separate successful delivery from correct meaning.
Approach. Ask whether the packets arrived before blaming the interpretation.
Trace. All packets arrived, so packet switching and routing did their jobs. The bytes still need an agreed text encoding to become characters. A wrong interpretation rule garbles a correctly delivered message.
Result. Suspect interpretation, not delivery: check the encoding and format rules.
Result: Delivery succeeded; interpretation failed. Confirm the agreed encoding before resending anything.
A student says the Internet and the Web are two names for one invention. What is wrong with that claim?
Goal. Place each term on the correct layer.
Approach. Ask whether the term names infrastructure or a service family.
Trace. The Internet connects networks and carries packets for many applications. The Web is one application family: linked resources fetched through browsers and servers. The Web arrived later and used the existing Internet.
Result. They are different layers, invented at different times for different jobs.
Result: The Internet carries messages; the Web is one way of using that carriage. Do not merge them.
History here is a sequence of related ideas, not one invention by a single person. Name the layer before praising the change.
10.3 TYPES OF NETWORKS
Personal, local, metropolitan and wide area networks describe useful scales. A local wireless connection can be part of a much wider journey when it leads to a remote service.
A device can use more than one scope at once. A headset may communicate near its owner while the owner’s computer also connects through a building network to a distant server. Wired versus wireless is another classification.
- Choose the connection or network you are describing.
- Identify its coverage and management context.
- Describe its medium separately from its scope.
Network scope labels describe a useful scale, but they do not impose exact universal distance boundaries.
Scope labels describe how far a network reaches and who manages it. They do not set exact distance borders. A room network and a building network can both be local. The label guides planning, not measurement.
Think of a student with a headset, a laptop and a school account. The headset reaches only a few steps. The laptop joins the building network. The account reaches distant services. One person uses three scopes at once.
| Scope | Typical setting | Design concern |
|---|---|---|
| PAN: personal area network | Devices used around one person | Short-range pairing, power and personal-device access. |
| LAN: local area network | A room, building or managed local site | Local capacity, switching and access control. |
| MAN: metropolitan area network | Connections across an urban-scale area | Inter-site infrastructure and administration. |
| WAN: wide area network | Connections across large separated areas | Provider links, routing, delay and resilience. |
Read the table row by row. PAN covers the person. LAN covers the site. MAN covers the urban area. WAN covers distant sites. The right column shows what each scale forces the designer to plan for.
Read the diagram from top to bottom. Near the person sits the PAN.
Inside one site sits the LAN. Across a city sits the MAN.
Across distant regions sits the WAN. A personal headset may connect to a laptop, the laptop to a building LAN, and the LAN to remote services over a WAN.
Wireless versus wired describes a medium, not the same classification as local versus wide area. A wireless link inside one building is still local in scope.
A wired link between cities is still wide in scope. Medium and scope answer different questions.
Ownership is another separate distinction. A private organisation can operate a WAN. A public service can provide local wireless access. Avoid treating every label as a promise about ownership or security.
| Connection | Medium | Scope |
|---|---|---|
| Lab computers over cable | Wired. | LAN. |
| Lab computers over radio | Wireless. | Still LAN. |
| City branches over leased lines | Wired. | MAN. |
| Distant offices over provider links | Mixed. | WAN. |
Read the table. The same LAN appears twice with different media. The city and distant cases share no medium pattern. Medium never decides scope on its own.
Bandwidth is the amount of data a link can carry per second. It is measured in bits per second, not bytes per second.
The earlier file example assumed 10 megabits per second. Real links vary widely, so treat that figure as a teaching assumption.
A device uses Wi-Fi inside one building. Does “wireless” make its network a WAN?
Goal. Classify the example by scope, not by medium.
Approach. Ask where the network reaches and who manages it.
Trace. The medium is wireless, but the coverage and management remain local in this example. Nothing crosses to distant administered sites.
Result. No, it can be a wireless LAN.
Result: No. The medium is wireless, but the scope and management are local.
A school connects its three branches across one city so records move between them. Which scope fits best, and why?
Goal. Choose the scope label that guides the design.
Approach. Match the coverage to the table: one site, one city or distant regions.
Trace. One building would be a LAN. Distant regions would be a WAN. Three sites across one urban area sit between them. Inter-site links and shared administration dominate the planning.
Result. MAN fits best: urban-scale links between administered sites.
Result: MAN. The design problem is inter-site links across one urban area.
Scope describes reach and management. Medium describes wire or radio. Ownership describes who runs it. Keep the three apart.
10.4 NETWORK DEVICES
A network device should be understood by its work. An interface attaches a host. A switch forwards traffic within the relevant link-layer system. A router moves network-layer packets between networks.
One product can contain several such roles. A familiar home box may therefore do more than its everyday name suggests. Identifying the logical role is more useful than memorising the shape of the box.
- Ask which part of delivery needs attention.
- Match that responsibility to the relevant device role.
- Check whether one physical product combines several roles.
Devices should be explained by what they do to traffic, not just by the shape of their connectors.
A new box with blinking lights tells you little. Ask what the box does to a passing message. Each device below has one clear job in the packet journey. Learn the job, not the plastic case.
Think of the home connection box. The family calls it one router.
Inside, several roles cooperate: a radio access point, an Ethernet switch, a router and sometimes a modem. One product can combine several logically separate roles.
An Ethernet port and connector provide a physical attachment for a suitable wired Ethernet link. Classrooms often call the familiar modular plug by its common name.
The name describes the plug shape, not the forwarding decision.
| Device or part | Role |
|---|---|
| Network interface card or adapter | Connects a host to a link technology. |
| Ethernet port and connector | Provide a physical attachment for a suitable wired Ethernet link. |
| Repeater | Regenerates a signal to extend a physical link under its technology’s limits. |
| Hub | Repeats received traffic across ports at the physical layer; it does not learn selective forwarding like a switch. |
| Switch | Forwards link-layer frames using learned addressing information. |
| Router | Forwards network-layer packets between networks using routes. |
| Modem | Adapts signals for a particular access medium and service. |
| Gateway | A connecting or translation role whose precise meaning depends on the protocol and context. |
Read the table as a journey. The adapter attaches the host.
The repeater or hub extends or shares the local signal. The switch forwards within the local system.
The router moves packets between networks. The modem adapts to the access medium.
The gateway translates where two systems meet.
Read the diagram step by step. A frame arrives at the device.
If its destination is known on a local port, the switch forwards it there. Unknown or broadcast traffic may be flooded to learn or reach everyone.
Traffic for another network goes up to the router, which chooses a next hop.
A switch can flood unknown or broadcast traffic, so “a switch sends every frame only to one destination” is too absolute. A router chooses a next hop from routing information; it is not simply a stronger repeater.
A hub repeats; a switch learns; a router routes.
Calling the whole home box a router does not make those roles identical. When a fault appears, name the role that failed: the radio link, the switch forwarding, the routing choice or the access signal.
The right remedy depends on the role.
A gateway translates or connects where two systems meet. A home gateway may join the local network to the provider service.
An application gateway may translate between two message formats. Always ask which two sides it joins before assuming its job.
Why can replacing a cable with a router fail to solve a weak physical signal?
Goal. Match the remedy to the failing layer.
Approach. Ask whether the signal can be decoded before any forwarding choice matters.
Trace. The tasks occur at different layers. A weak signal means the receiving interface cannot reliably decode bits. Routing decides paths for decoded packets; it cannot recover a signal the interface never read correctly.
Result. Match the remedy to the failing layer.
Result: A router cannot fix a signal too weak to decode. Repair the physical link first.
Two classroom LANs must exchange records, and each LAN already switches its own traffic well. Which device joins them, and why?
Goal. Choose the device that connects separate IP networks.
Approach. Ask whether the job stays inside one link system or moves between networks.
Trace. A switch forwards within its link-layer system, so it cannot decide between networks. A hub only repeats. The task needs network-layer forwarding with routes, which is the router’s job.
Result. A router, because it forwards packets between networks using routes.
Result: Install a router between the LANs. Switches keep handling local traffic on each side.
A home needs its first connection to a service provider over the telephone line. Should the family buy a switch or a modem for that job?
Goal. Choose the device that adapts signals to the access medium.
Approach. Ask whether the job is local forwarding or medium adaptation.
Trace. A switch forwards frames within the local link system. It cannot speak the provider line signals. The modem adapts signals for that particular access medium and service.
Result. A modem for the access line; a switch can serve the home computers behind it.
Result: A modem adapts to the provider line. A switch organises traffic inside the home.
Name the role before naming the box. The forwarding decision tells you which device you need.
10.5 NETWORKING TOPOLOGIES
A topology drawing shows dependencies. In the star example, every device has its own link to a shared switch. The diagram is useful because it lets you compare the loss of one edge link with the loss of the shared centre.
Do not judge a topology only by whether the picture looks tidy. Ask which paths remain after a failure and whether the real forwarding system can use them.
- Identify the component whose failure you want to study.
- Remove its link or node from the mental picture.
- Trace which intended communications still have a usable path.
A topology describes the arrangement of connections and helps predict failure effects.
A topology is the arrangement of links between nodes. It predicts what survives a failure. Two networks can hold the same devices yet behave differently, because their links join them differently.
Imagine the computer lab before a lesson. If one printer cable comes loose, one computer loses printing.
If the shared lab switch loses power, every computer loses printing. The diagram explains both outcomes before they happen.
Read the figure. Four device boxes sit at the corners. Each has its own line to the central switch. No device cable touches another device directly. The switch is the shared dependency of all four paths.
A physical topology describes actual links. A logical topology describes how traffic behaves.
They need not look identical. Wireless clients may form a logical star around an access point while sitting scattered across a room.
Read the figure. One horizontal backbone crosses the diagram.
Four short taps join the devices to it. Every message shares that backbone.
A break in the backbone can split the whole bus, while a broken tap isolates only its own device.
Read the figure. Arrows run from each device to the next, forming a loop.
A message travels neighbour to neighbour until it reaches its destination. If one link fails, traffic must use the other direction or a recovery method the ring design provides.
Read the diagram. The main switch feeds two branch switches. Each branch switch feeds its own devices. This tree scales to many rooms, but the upper switches become shared dependencies that need planning and backup.
| Topology | Organisation | Typical trade-off |
|---|---|---|
| Star | Separate links join a central device. | An edge-link failure can isolate one node; central failure can affect many. |
| Bus | Nodes share a common communication path. | The shared path and its termination or access rules matter. |
| Ring | Nodes connect around a loop. | Forwarding and fault recovery depend on the ring implementation. |
| Mesh | Nodes have several interconnections. | Alternative paths can improve resilience but add links and management. |
| Tree or hybrid | Branches or combinations of arrangements. | Scales hierarchically, while shared upper dependencies need planning. |
Read the table. Each row names the shape, then states the price of that shape.
Star risks the centre. Bus risks the backbone.
Ring risks the loop. Mesh buys alternative paths with extra links.
Tree scales but concentrates risk upward.
A spare cable is not automatically safe redundancy. A loop can trouble a network not designed to manage it. Redundancy needs working paths and suitable forwarding behaviour, not just extra lines on a drawing.
For n nodes in an undirected full mesh with one direct link per pair, the link count is . A partial mesh has fewer direct connections and relies on multi-hop paths.
Check the formula with four nodes. Ordered pairs give 12. Each undirected link is counted twice, so divide: 12 / 2 = 6. Four nodes need 6 links.
Check it again with six nodes. Ordered pairs give 30. Divide by two: 30 / 2 = 15. Six nodes need 15 links, which is why full meshes suit small groups.
A partial mesh keeps only the links that matter most. Busy pairs get direct links. Quiet pairs travel through intermediate nodes. The design saves links but must still offer a usable path after each single-link failure.
In the star diagram, what changes if Device A’s link fails compared with the central switch failing?
Goal. Compare the impact of two different failures.
Approach. Remove each component from the mental picture and trace the remaining paths.
Trace. A single edge-link failure normally affects that endpoint only. Devices B, C and D still reach the switch. The central switch is shared by all depicted paths, so its failure removes every device’s route through it.
Result. The failure impact depends on which component is lost, not only on how many components exist.
Result: An edge failure isolates one node. A central failure affects all four paths.
How many direct links does a full mesh of six nodes need?
Goal. Count undirected links for six fully connected nodes.
Approach. Count ordered pairs first, then remove the double counting.
Trace. Six nodes give 6 × 5 = 30 ordered pairs. Each link joins two nodes, so each link was counted twice. Divide: 30 / 2 = 15.
Result. Fifteen links.
Result: Fifteen links. Six nodes need 15 direct connections in a full mesh.
A tree network loses its main switch on a school day. Which parts keep working, and which stop?
Goal. Trace a tree failure from the shared dependency downward.
Approach. Remove the main switch and test each remaining path.
Trace. Devices under one branch switch still share their own branch. But no branch can reach another branch, because every cross-branch path passed through the main switch.
Result. Each branch works internally; all cross-branch traffic stops.
Result: Local branches survive; the shared upper dependency decides the rest.
Draw the failure before judging the topology. The component you remove decides the answer.
10.6 IDENTIFYING NODES IN A NETWORKED COMMUNICATION
A name, an IP address, a local-link address and a transport port are not interchangeable labels. They help with different parts of reaching a service.
A human can use a domain name. Address resolution can supply an IP address. Routing uses the network-layer destination. Local forwarding uses the relevant link-layer addresses along each part of the journey.
- Name the service the application wants.
- Identify the network-layer destination and required transport service.
- Distinguish local delivery decisions from routing across networks.
A local-link identity and an internetwork address solve related but different delivery problems.
Sending a message needs two kinds of answers. Which local device should receive this frame next. And which final destination should the packet travel toward. One address cannot do both jobs well.
Think of a school building. A room number guides you inside the building.
A street address guides the taxi across the city. The room is useless to the taxi driver.
The street address is too coarse for the corridor. Networks split the jobs the same way.
A MAC address is used by relevant link-layer technologies, such as Ethernet, for local-link delivery. Common Ethernet MAC addresses have a fixed-length hexadecimal representation.
Switches learn them to forward frames within the local system.
MAC addresses are not reliable proof of a person’s identity. Addresses can be changed, duplicated or randomised. Do not treat a MAC address as a permanent authenticated identity.
An IP address identifies a network-layer interface or location in an addressing plan. IPv4 uses dotted decimal notation with four number groups. IPv6 uses a larger hexadecimal address space for far more addresses.
Address configuration, subnetting and routing determine which destinations are local and which require a next hop. One device can have several interfaces and addresses, and an address can change over time.
The documentation address 192.0.2.10 is suitable for a written example. It is not a public server this lesson expects you to contact. Reserved example addresses keep classroom exercises safe.
First cover the output box and say what the program should print.
address = "192.168.1.10"
parts = address.split(".")
print(parts)
print(len(parts))
for part in parts:
print(part)Opens in a new tab with the code ready. Click Visualize Execution, then step through the program.
- The first line stores one address as text, not as four numbers.
- Split cuts the string at each dot and returns a list of four parts.
- The first print shows the whole list; the second print shows its length.
- The loop prints each part on its own line in left-to-right order.
['192', '168', '1', '10']
4
192
168
1
10Replace the address with 10.0.0.5 and predict the four printed parts before running.
Read the program again. The dots are separators, not decimal points. Splitting gives 4 text parts. Each group holds 8 bits, so each group has 256 possible values from 0 to 255.
The whole IPv4 space therefore holds addresses, which equals 4294967296. That is a large number, yet planning, waste and growth still required the larger IPv6 space. Counts alone do not remove the need for careful allocation.
| Feature | IPv4 | IPv6 |
|---|---|---|
| Notation | Four decimal groups with dots. | Hexadecimal groups with colons. |
| Address space | About 4,300 million addresses. | A far larger hexadecimal space. |
| Classroom habit | Reserved example addresses only. | The same habit: never invent public targets. |
Read the table. Notation differs, and the space differs enormously. Classroom habit stays the same: use reserved example addresses and never probe real targets from an exercise.
A transport port number names a program endpoint on a host, together with its protocol. Two programs on one computer can each hold conversations because their ports differ.
The address finds the machine; the port finds the program.
| Purpose | Address or identifier |
|---|---|
| Forward an Ethernet frame on a local link | A relevant MAC address. |
| Route an IP packet across networks | Destination IP address. |
| Identify a transport endpoint service | A transport port together with the relevant address and protocol. |
| Provide a human-readable service name | A domain name resolved through DNS. |
Read the table. Each row pairs one delivery question with its answer. Frames use MAC addresses. Packets use IP addresses. Programs add port numbers. People use names that DNS resolves.
Predict the printed lines before reading them. The trace explains each one.
route = ["sender", "router A", "router B", "receiver"]
for i in range(len(route)):
print(str(i + 1) + ". " + route[i])
print("hops: " + str(len(route) - 1))Opens in a new tab with the code ready. Click Visualize Execution, then step through the program.
- The list names the four stops in travel order.
- Range produces one index per stop; adding one makes the display count from 1.
- Each loop line joins the position number to the stop name.
- The last line subtracts one from the stop count to report forwarding steps.
1. sender
2. router A
3. router B
4. receiver
hops: 3Remove router B from the list and predict the new hop count before running.
Read the program again. Four stops give 3 hops. Three stops would give 2 hops. The rule is simple: hops equal stops minus one. Trace the list whenever a path question confuses you.
Does knowing a device’s MAC address let you route a packet to it anywhere on the Internet?
Goal. Decide whether a local address can guide global routing.
Approach. Ask which layer each address serves.
Trace. MAC addressing belongs to the local-link role. Switches use it inside their own system. Routing across networks uses network-layer addresses and next-hop decisions. A local label carries no global route.
Result. No, a local address is not a global route.
Result: No. Use the destination IP address for routing; use MAC addresses for local delivery.
Each address has one job. Local delivery, global routing, program endpoints and human names need different identifiers.
10.7 INTERNET, WEB AND THE INTERNET OF THINGS
The Web exchanges resources through browsers and servers. An Internet of Things system may also connect sensors and actuators. A useful IoT design explains how a measurement becomes a permitted action.
A sensor reading can be missing, stale or implausible. A controller must know what to do in those cases. Treating a missing observation as a normal value can produce a confident action from no evidence.
- Identify the observation and the unit it uses.
- Check that the observation is suitable for the decision.
- Apply the stated rule and its failure policy before acting.
The Internet carries many services, while the Web is a particular way to address and exchange resources.
A video call freezing and a page loading slowly feel similar. Their causes can differ completely.
One is a live conversation over the Internet. The other is a document fetched through the Web.
Name the service before fixing it.
A browser is a client application. A web server responds to requests. HTML describes document structure.
CSS describes presentation. JavaScript can provide behaviour.
These are different from the network protocols carrying their bytes.
A URL identifies a resource using components such as a scheme, host and path. The scheme indicates how it should be accessed. A domain name in the host is not the entire URL, and a page path is not a DNS record.
| URL part | Example role | Meaning |
|---|---|---|
| Scheme | How to access the resource. | Names the method, such as web page retrieval. |
| Host | Which server is addressed. | Often a domain name that DNS must resolve. |
| Path | Which resource on that server. | Carried in the request; not a DNS record. |
Read the table. The scheme chooses the method. The host chooses the server. The path chooses the resource. A fault in one part needs a different repair from a fault in another. A wrong path is not a failed name lookup.
A page shows plain unstyled text although its words are correct. Which page part most likely failed: HTML, CSS or the network path?
Goal. Separate structure, presentation and delivery.
Approach. Ask what did arrive correctly.
Trace. The words arrived, so DNS, the server and the network path worked. HTML structure is present because the text shows. Presentation comes from CSS, so a missing style sheet explains plain but correct text.
Result. CSS most likely: structure and delivery both succeeded.
Result: Check the style sheet link before suspecting the network.
Why distinguish a hostname from a full URL? The URL also specifies how and which resource to request. Two pages on one server share a host but differ in path. DNS resolves the host; the request carries the path.
The Internet of Things, or IoT, connects sensing or acting devices with software services. A room sensor might send readings to a controller.
A controller might switch a fan or raise an alert. The value lies in the rules, not just the connection.
Useful design must address power, updates, connectivity loss, authentication and the consequences of incorrect readings. A sensor that cannot be updated becomes a permanent weakness.
A reading nobody checks is only decoration.
Read the diagram. The sensor measures.
The service receives. The rule evaluates the reading against its limits.
Only an authorised action follows. A missing or stale reading must trigger the failure policy, never a guessed normal value.
Should a missing room reading be treated as a safe normal reading?
Goal. Decide the correct response to absent sensor data.
Approach. Ask what evidence a missing value provides.
Trace. A missing value gives no evidence about current conditions. It could hide heat, cold or a dead sensor. A control rule needs an explicit fallback such as marking the state unknown and alerting a person.
Result. No, state the failure policy rather than inventing a measurement.
Result: No. Mark the reading unknown and follow the defined safe fallback.
A page fails to load, but the same server’s other page loads well. Is DNS the likely fault?
Goal. Locate the failing part: name, server or path.
Approach. Use the shared host as a test.
Trace. DNS resolves the host once for both pages. If the second page loads, the host resolved and the server answered. The failing page differs only in its path or its own content.
Result. DNS is unlikely; check the page path and the failing resource itself.
Result: Probably not DNS. One working page proves the name resolved and the server responded.
The Web is one service family on the Internet. IoT adds sensing and action, but only its rules make it useful.
10.8 DOMAIN NAME SYSTEM
DNS helps an application obtain records associated with a name. It is not the web page itself. After obtaining a suitable address, the application still needs to contact the intended service.
A resolver may reuse a cached answer instead of repeating the whole lookup. That saves work, but it also explains why an address change is not necessarily visible everywhere at the same instant.
- Ask the resolver for the needed name record.
- Allow a valid cached answer or a lookup through the responsible servers.
- Use the returned information for the separate application connection.
DNS translates names through a distributed system of records and delegated responsibility.
People remember names. Networks deliver to addresses.
The Domain Name System bridges the two by mapping names to records, including address records used to reach services. Typing a name starts a lookup, not a connection.
Think of a school office directory. You ask for the library desk.
The assistant checks a recent note first. If the note is fresh, you walk straight there.
If not, the assistant asks the building office, which knows who manages each room.
A client commonly asks a resolver. That resolver can answer from a valid cache or obtain information through the DNS hierarchy and the responsible authoritative servers. Each level answers only the part it manages.
Read the diagram. The application asks for a name.
The resolver checks its cache for a still-valid answer. If none exists, DNS servers supply records through delegation.
The application then uses an address for its own separate connection.
| DNS role | Job |
|---|---|
| Resolver | Asks on behalf of the application and reuses valid cached answers. |
| Root and directory levels | Direct the query toward the servers responsible for the name. |
| Authoritative server | Holds the records for its own portion of the namespace. |
| Cache with lifetime | Reduces repeated work while limiting how long an answer is reused. |
Read the table. The resolver starts the work.
Upper levels delegate downward. The authoritative server gives the answer for its zone.
The cache stores it only until its lifetime expires. No single server holds every name.
Follow one full lookup in words. The application asks the resolver.
The resolver reuses a fresh cached answer when one exists. Otherwise it follows delegation from the upper levels to the authoritative server for the name.
The answer returns with a lifetime, and later requests reuse it until expiry.
A time-to-live, or TTL, states how long a cached record may be reused. Short lifetimes spread changes faster but repeat lookups more often.
Long lifetimes save work but delay change. The lifetime is a trade-off, not a fault.
Names are hierarchical. Different authorities manage different portions of the namespace.
Caching reduces repeated work, while record lifetimes limit how long cached information should be reused. A changed record can therefore take time to be seen everywhere.
Say the output aloud in your own words before checking it below.
cache = {"library.test": "192.0.2.10"}
def lookup(name):
if name in cache:
return "cache: " + cache[name]
return "ask authoritative server"
print(lookup("library.test"))
print(lookup("new-site.test"))Opens in a new tab with the code ready. Click Visualize Execution, then step through the program.
- The dictionary models a tiny cache: one name mapped to one address.
- Lookup checks membership first; a stored name returns its cached address.
- An unknown name skips the cache and reports the next step.
- The two prints show a hit followed by a miss.
cache: 192.0.2.10
ask authoritative serverAdd a second cached name with the same address and predict both lookups before running.
Read the program again. The first lookup hits the cache and returns its address.
The second name is absent, so the function reports the next step: asking the authoritative server. Real resolvers follow delegation chains; this model shows only the cache decision.
A name may have multiple addresses, and many names may lead to one address. DNS does not itself download a web page, prove a page is honest or guarantee that the destination service is currently healthy. Never treat a successful lookup as proof that the service works.
A service changes its address but one device still reaches the old location. What should you investigate?
Goal. Explain why one device sees a stale address.
Approach. Ask where an old answer could survive.
Trace. The device or its resolver may still hold a valid cached answer. Another configuration may also override resolution. The page code is innocent until resolution is checked, because DNS runs before the application connection.
Result. Check resolution and cache lifetime before assuming the page code is broken.
Result: Inspect the cached record and its remaining lifetime. Flush or await expiry, then retest.
A new name is typed and the lookup reports “ask authoritative server”. What does that message mean in the model?
Goal. Interpret a cache miss correctly.
Approach. Trace the lookup function for an unknown name.
Trace. The function tests membership in the cache. The new name is absent, so the first branch fails. The function returns the fallback string. Nothing has failed; the answer simply was not cached.
Result. A miss, not an error: the resolver must now consult the responsible servers.
Result: It means the cache held no answer, so the lookup continues through the DNS hierarchy.
DNS answers “which records belong to this name”. The application conversation happens afterwards, on its own terms.
Summary
Use these points to test what you can explain without looking back.
- Networks combine nodes, links and protocols; access still requires authorisation.
- Packet switching shares links; internetworking joins different networks under common rules.
- The Internet carries infrastructure traffic; the Web is one later service family on it.
- PAN, LAN, MAN and WAN describe useful scales, not exact security guarantees.
- Medium, scope and ownership are three separate classifications.
- Interface, repeater, hub, switch, router, modem and gateway do different jobs.
- Topology and shared dependencies decide failure impact; name the removed part.
- Star, bus, ring, mesh and tree trade resilience against links and management.
- Full-mesh links follow n(n − 1) / 2; small groups mesh cheaply, large groups do not.
- MAC addresses serve local delivery; IP addresses serve routing across networks.
- IPv4 holds four groups of 256 values; ports name programs and DNS names people.
- DNS resolves records through delegation and caching; applications connect afterwards.
- IoT systems turn readings into authorised actions with explicit failure policies.
Exercise
Work independently. For a program, predict the result before running it. Explain your reasoning as well as giving an answer.
10.1 A message travels sender, router A, router B, receiver. List the stops and count the hops.
10.2 Predict the parts and the count when this address program runs on 10.0.0.5.
address = "10.0.0.5"
parts = address.split(".")
print(parts)
print(len(parts))10.3 A 5 megabyte file crosses the assumed 10 megabit-per-second link. Show every step of the time calculation with units.
10.4 Choose the device that joins two school LANs so records move between them. Explain the rejected options.
10.5 Predict the failure: the bus backbone breaks between Device B and Device C. Who can still reach whom?
10.6 Find the flaw: “Our star network is safe because it has four cables, so no single failure can stop printing.”
10.7 How many direct links join six fully meshed devices? Show the arithmetic.
10.8 Trace this lookup for an unknown name and state what happens next.
cache = {"library.test": "192.0.2.10"}
name = "club.test"
print(name in cache)10.9 A room sensor stops reporting during a hot afternoon. The controller keeps the last cool reading and takes no action. Name the design error and the repair.
10.10 Does knowing a printer’s MAC address let a distant school route packets to it? Explain.
10.11 One web page on a server loads, but another page on the same server fails. Is DNS the likely cause? Explain.
10.12 Two names, library.test and catalog.test, both lead to 192.0.2.10. What does this show about names and addresses?
10.13 Classify each link: a headset to a phone, a lab of computers, branches across one city, branches across distant regions.
10.14 A student writes the hostel Wi-Fi password on a notice board so “the LAN stays connected”. Name the two confused ideas.
10.15 State what each identifier in this row is for: MAC address, IP address, port number, domain name.
10.16 A ring carries lab traffic and one loop link fails at night. Describe the consequence and the condition for recovery.
10.17 A 40-megabit file takes 4 seconds on the assumed 10 megabit-per-second link. Predict the time on an assumed 20 megabit-per-second link and show the step.
10.18 A switch floods a frame because the destination address is unknown. A student calls this a failure. Is flooding a fault here? Explain.
Answers
10.1 Stops: sender, router A, router B, receiver. Hops: 3. Each hop moves the packet one step closer.
10.2 Parts: 10, 0, 0 and 5, with count 4. The dots separate 4 text groups.
10.3 5 megabytes × 8 = 40 megabits. 40 megabits ÷ 10 megabits per second = 4 seconds. Size first, rate second, division last.
10.4 A router. A hub only repeats, and a switch forwards only within its own link system. Only the router forwards between networks using routes.
10.5 Devices A and B stay connected on one segment; C and D stay connected on the other. No message crosses the break. The backbone is the shared dependency.
10.6 The count is wrong as a guarantee. Four edge cables plus one central switch means the switch is a single shared dependency. Its failure stops all four paths.
10.7 Ordered pairs: 6 × 5 = 30. Undirected links: 30 ÷ 2 = 15. Answer: 15 links.
10.8 The test is False because club.test is absent. The resolver must now consult the responsible servers instead of answering from cache.
10.9 Treating a missing reading as a safe normal value. Mark the state unknown and run the defined safe fallback, such as alerting a person.
10.10 No. The MAC address serves local-link delivery only. Distant routing needs the destination IP address and next-hop decisions.
10.11 No. The working page proves the host resolved and the server answered. Check the failing path and its own resources instead.
10.12 Many names may lead to one address. Names and addresses are not one-to-one, so counting names never counts machines.
10.13 PAN, LAN, MAN and WAN in that order. Each step widens the coverage and changes who manages the links.
10.14 Connectivity versus authorisation. The network can carry messages while the password controls who may join. Sharing the secret widens access instead of improving the link.
10.15 MAC: local frame delivery. IP: routing across networks. Port: naming the program endpoint with its protocol. Domain name: human-readable service name resolved through DNS.
10.16 Messages can no longer use the failed direction. Recovery needs the ring design to support the other direction or a repair. A loop alone, without suitable forwarding, is not usable redundancy.
10.17 Divide amount by rate: 40 ÷ 20 = 2. Answer: 2 seconds. Doubling the assumed rate halves the assumed time.
10.18 No. Flooding unknown or broadcast traffic is normal learning behaviour. A fault would be flooding a frame whose destination port is already known without reason.