Computer Network Architecture Exercises
This chapter collects exercises on computer network architecture, covering basic concepts, performance metrics, the layered structure, the OSI model, the TCP/IP model, and network devices.
1. Briefly describe the three main functions of a computer network.
Approach
Group the functions by what the network does for its users: carrying data between machines, letting several machines use the same resources, and spreading a workload across many machines.
Steps
- Identify the communication function and describe it as the transfer and exchange of data between computers.
- Identify the sharing function and describe it as the shared use of hardware, software, and data.
- Identify the distributed processing function and describe it as a task split across several computers that work together.
- Check that each function is stated once and that none of them overlaps with the others.
Answer
The three main functions of a computer network are:
-
Data Communication
- Transfers and exchanges data between different computers
-
Resource Sharing
- Shares hardware, software, and data resources
-
Distributed Processing
- Assigns tasks to several computers that complete them together
2. By geographic range, how can computer networks be classified, and what are the characteristics of each class?
Approach
Classify networks by the area they cover, from the smallest (a personal area network) to the largest (a wide area network), and for each class state its coverage, distance, rate, typical use, and technical trait.
Steps
- Start with the widest class and work down to the narrowest.
- For each class, note the coverage area, the transmission distance, the transmission rate, the typical applications, and the main technical characteristic.
- Compare the rates: the wider the area, the lower the typical rate.
- Confirm that the typical applications match the scale of each class.
Answer
By geographic range, computer networks fall into four classes:
Wide Area Network (WAN):
- Coverage: spans cities, countries, or the whole globe
- Transmission distance: tens to thousands of kilometres
- Transmission rate: relatively low, typically a few Mbps to a few Gbps
- Typical applications: the Internet, corporate WANs
- Technical characteristic: uses public communication facilities, so the cost is high
Metropolitan Area Network (MAN):
- Coverage: covers a single city or region
- Transmission distance: a few to tens of kilometres
- Transmission rate: moderate, typically tens of Mbps to a few Gbps
- Typical applications: city networks, campus networks
- Technical characteristic: sits between a LAN and a WAN
Local Area Network (LAN):
- Coverage: within a building or a campus
- Transmission distance: a few hundred metres to a few kilometres
- Transmission rate: high, typically 10Mbps to 10Gbps
- Typical applications: office networks, home networks
- Technical characteristic: high rate, low delay, relatively low cost
Personal Area Network (PAN):
- Coverage: around a single person’s devices
- Transmission distance: a few to tens of metres
- Transmission rate: low, typically a few Mbps to a few hundred Mbps
- Typical applications: Bluetooth devices, wireless earphones
- Technical characteristic: short range, low power consumption
3. Briefly describe the components of network delay.
Approach
Split the total delay into the four contributions a packet experiences on its way from source to destination, and give the formula and the influencing factors for each.
Steps
- Start with the transmission delay, which depends on the data length and the rate.
- Add the propagation delay, which depends on the distance and the propagation speed.
- Add the processing delay, which depends on the speed of the intermediate devices.
- Add the queuing delay, which depends on congestion and the queue length.
- Note that the first two are fixed by the path, while the last two vary with load.
Answer
Network delay consists of the following parts:
Transmission Delay:
- Definition: the time required for data to move from the sending end to the receiving end
- Formula: transmission delay = data length / transmission rate
- Influencing factors: data size, transmission rate
Propagation Delay:
- Definition: the time a signal takes to propagate through the transmission medium
- Formula: propagation delay = distance / propagation speed
- Influencing factors: transmission distance, medium type
Processing Delay:
- Definition: the time a router or switch spends processing a packet
- Influencing factors: device performance, queue length
Queuing Delay:
- Definition: the time a packet waits in a router queue
- Influencing factors: network congestion, queue length
4. Calculation: a 1000-byte packet crosses a 10Mbps link. The transmission distance is 1000 kilometres and the propagation speed is 2×10^8 m/s. Find the total delay.
Approach
Compute the transmission delay and the propagation delay separately, then add them. The first term depends on the size of the packet and the rate; the second depends on the distance and the propagation speed.
Steps
- Convert 1000 bytes to bits and compute the transmission delay: 1000 bytes / (10×10^6 bps).
- Convert 1000 kilometres to metres and compute the propagation delay: 1000×10^3 m / (2×10^8 m/s).
- Add the two terms.
Answer
The computation:
- Transmission delay = data length / transmission rate = 1000 bytes / (10×10^6 bps) = 0.8 ms
- Propagation delay = distance / propagation speed = 1000×10^3 m / (2×10^8 m/s) = 5 ms
- Total delay = transmission delay + propagation delay = 0.8 + 5 = 5.8 ms
5. Briefly describe the three elements of a network protocol.
Approach
A protocol is complete only when it specifies what the bits look like, what they mean, and when they are exchanged. Cover the three elements in that order.
Steps
- State the syntax: the data format, the encoding, field lengths and ordering, control characters, and special symbols.
- State the semantics: the meaning of control information, the interpretation of operations, and error handling.
- State the timing: the order of events, the requirements for matching speeds, and synchronisation.
- Check that each element answers a different question: form, meaning, and order.
Answer
The three elements of a network protocol are:
Syntax:
- Data format and encoding
- Field lengths and ordering
- Control characters and special symbols
Semantics:
- The meaning of control information
- The interpretation of each operation
- How errors are handled
Timing:
- The order in which events occur
- Requirements for matching speeds
- Synchronisation and asynchronous mechanisms
6. Compare connection-oriented service with connectionless service.
Approach
Compare the two services on the same four axes: how the transfer is set up, what the advantages are, what the disadvantages are, and which protocol realises each of them.
Steps
- Describe the connection-oriented model: establish, transfer, release.
- Describe the connectionless model: send directly, with no setup.
- Weigh the reliability and ordering guarantees against the overhead and latency.
- Attach the typical protocol to each side.
Answer
Connection-Oriented Service:
- Characteristics: establishes a connection, transfers data, releases the connection
- Advantages: high reliability, ordering guaranteed
- Disadvantages: larger overhead, higher latency
- Typical application: the TCP protocol
Connectionless Service:
- Characteristics: sends data directly, with no connection to set up
- Advantages: small overhead, low latency
- Disadvantages: lower reliability, no ordering guarantee
- Typical application: the UDP protocol
7. List the seven layers of the OSI model and the main function of each.
Approach
Walk the stack from the bottom up. For each layer, state what it does and what its principal task is, so that the seven entries together describe a complete transfer.
Steps
- Start at the physical layer, which moves raw bits over the medium.
- Move up through the data link, network, and transport layers, which add framing, routing, and reliable end-to-end transfer.
- Continue with the session and presentation layers, which manage sessions and the representation of data.
- Finish with the application layer, which delivers network services to users.
- Check that the seven functions do not overlap and jointly cover the whole path.
Answer
The seven layers of the OSI model and their main functions:
Physical Layer:
- Function: transmission of bit streams
- Principal task: carry raw bit streams over a physical transmission medium
Data Link Layer:
- Function: framing, error detection, flow control
- Principal task: transfer frames reliably between adjacent nodes
Network Layer:
- Function: route selection, packet forwarding
- Principal task: transfer packets between different networks
Transport Layer:
- Function: reliable end-to-end transfer, flow control
- Principal task: provide a reliable data transfer service between end systems
Session Layer:
- Function: session management, establishing and releasing sessions
- Principal task: establish, manage, and terminate sessions
Presentation Layer:
- Function: data format conversion, encryption and decryption
- Principal task: convert formats, encrypt and decrypt, and compress and decompress data
Application Layer:
- Function: provides network application services to users
- Principal task: provide the various network application services
8. Briefly describe the similarities and differences between the OSI model and the TCP/IP model.
Approach
State the points of agreement first, then the differences along three axes — the number of layers, the balance between theory and practice, and the range of protocols supported — and finish with the layer-by-layer mapping.
Steps
- List the shared characteristics.
- Compare the number of layers.
- Compare theoretical rigour against practical value.
- Compare the protocol coverage.
- Map each OSI layer onto the TCP/IP layer that covers it.
Answer
Similarities:
- Both use a layered structure
- Both define standards for network communication
- Both support many network protocols
Differences:
Number of layers:
- OSI model: seven layers, divided in fine detail
- TCP/IP model: four layers, divided simply
Theoretical rigour:
- OSI model: stronger on theory, highly standardised
- TCP/IP model: stronger on practice, widely deployed
Protocol support:
- OSI model: supports many network protocols
- TCP/IP model: mainly supports the TCP/IP protocol family
Layer correspondence:
- The physical and data link layers of OSI ≈ the network access layer of TCP/IP
- The network layer of OSI ≈ the internet layer of TCP/IP
- The transport layer of OSI ≈ the transport layer of TCP/IP
- The session, presentation, and application layers of OSI ≈ the application layer of TCP/IP
9. Briefly describe the four layers of the TCP/IP model and the function of each.
Approach
Describe the four layers from the bottom up. For each one, state its function, the protocols that belong to it, and its principal task.
Steps
- Start with the network access layer, which carries data over the physical medium.
- Move up to the internet layer, which handles addressing and routing.
- Move up to the transport layer, which provides end-to-end data transfer.
- Finish with the application layer, which provides the application services.
- Check that the protocols listed under each layer belong to it.
Answer
The four layers of the TCP/IP model and their functions:
Network Access Layer:
- Function: physical transmission and framing
- Protocols: Ethernet, WiFi, PPP, ARP, and so on
- Principal task: transfer data over a physical transmission medium
Internet Layer:
- Function: IP addressing, route selection, packet forwarding
- Protocols: IP, ICMP, IGMP, OSPF, and so on
- Principal task: transfer packets between different networks
Transport Layer:
- Function: end-to-end transfer, reliable transfer, flow control
- Protocols: TCP, UDP
- Principal task: provide a data transfer service between end systems
Application Layer:
- Function: provides the various network application services to users
- Protocols: HTTP, FTP, SMTP, DNS, and so on
- Principal task: provide network application services
10. Compare the characteristics of TCP and UDP.
Approach
Compare the two protocols on the same six axes: connection model, reliability, flow control, congestion control, transmission efficiency, and typical use.
Steps
- State how each protocol sets up or avoids a connection.
- Compare the reliability guarantees.
- Compare the presence of flow control and congestion control.
- Compare the transmission efficiency.
- List the applications that suit each protocol.
Answer
TCP (Transmission Control Protocol):
- Connection model: connection-oriented
- Reliability: reliable transfer
- Flow control: has flow control
- Congestion control: has congestion control
- Transmission efficiency: relatively lower
- Typical use: HTTP, FTP, SMTP, and so on
UDP (User Datagram Protocol):
- Connection model: connectionless
- Reliability: unreliable transfer
- Flow control: no flow control
- Congestion control: no congestion control
- Transmission efficiency: relatively higher
- Typical use: DNS, DHCP, streaming media, and so on
11. Briefly describe where the various network devices sit in the OSI model and what they do.
Approach
Group the devices by the layer they work at, and for each device give a one-line summary of its function and its usual role.
Steps
- List the physical layer devices and their functions.
- List the data link layer devices and their functions.
- List the network layer devices and their functions.
- List the multi-layer devices and their functions.
Answer
Physical layer devices:
- Repeater: amplifies and regenerates signals, extending the distance of the network
- Hub: multi-port signal broadcast, used to build star topologies
Data link layer devices:
- Bridge: frame forwarding and filtering, connects different segments
- Switch: intelligent frame forwarding, the core device of a LAN
Network layer devices:
- Router: packet routing and forwarding, connects different networks
Multi-layer devices:
- Gateway: protocol and format conversion, connects heterogeneous networks
12. Compare the functional differences between a switch and a router.
Approach
Compare the two devices along five axes: the layer they work at, their main functions, the address they forward on, the scope in which they are used, and their performance profile.
Steps
- State the operating layer of each device.
- State the main functions of each device.
- State the address each device forwards on.
- State the scope of use.
- State the performance characteristic of each.
Answer
Switch:
- Operating layer: data link layer
- Main functions: frame forwarding, MAC address learning, VLAN support
- Forwarding basis: the MAC address
- Scope of use: inside a local area network
- Performance characteristic: fast forwarding, low latency
Router:
- Operating layer: network layer
- Main functions: packet routing, network interconnection, protocol conversion
- Forwarding basis: the IP address
- Scope of use: between different networks
- Performance characteristic: intelligent routing, network isolation
13. Design a simple network topology containing a router, a switch, and hosts, and describe how a packet travels through it.
Approach
Draw the topology first, then trace a packet from host A to host B layer by layer: what the sender encapsulates, what each switch does, what the router does, and what the receiver strips off.
Steps
- Lay out the path: host A → switch 1 → router → switch 2 → host B.
- At the sender, describe the encapsulation performed by each layer.
- At switch 1, describe learning the source MAC address and forwarding on the destination MAC address.
- At the router, describe looking up the routing table, choosing the outgoing interface, and forwarding.
- At switch 2, describe learning and forwarding to host B.
- At the receiver, describe the decapsulation performed by each layer.
Answer
Topology design:
Data passes through: Host A → Switch 1 → Router → Switch 2 → Host B
Packet transfer process:
-
Host A sends the data:
- Application layer: produces the application data
- Transport layer: adds the TCP/UDP header
- Network layer: adds the IP header
- Data link layer: adds the Ethernet header
-
Switch 1 processes the frame:
- Receives the frame
- Learns the source MAC address
- Forwards it to the router based on the destination MAC address
-
The router processes the packet:
- Receives the IP packet
- Looks up the routing table
- Selects the outgoing interface
- Forwards it to switch 2
-
Switch 2 processes the frame:
- Receives the frame
- Learns the source MAC address
- Forwards it to host B based on the destination MAC address
-
Host B receives the data:
- Data link layer: removes the Ethernet header
- Network layer: removes the IP header
- Transport layer: removes the TCP/UDP header
- Application layer: handles the application data
14. Analyse a network performance problem and propose optimisation measures.
Approach
Take each reported symptom, trace it back to its most likely cause, and then group the remedies into hardware, network design, protocol, and management measures.
Steps
- List the symptoms.
- For each symptom, name the likely causes.
- Group the remedies into four categories.
- Check that every symptom is addressed by at least one remedy.
Answer
Problem statement: an enterprise network shows the following symptoms:
- High network delay
- Slow data transfer
- Frequent network congestion
Problem analysis:
- High network delay: likely caused by insufficient network device performance, long transmission distances, or network congestion
- Slow data transfer: likely caused by insufficient bandwidth, limited device processing capacity, or low protocol efficiency
- Network congestion: likely caused by excessive network load, insufficient device processing capacity, or an unsound network design
Optimisation measures:
Hardware upgrades:
- Upgrade the network devices to raise their processing capacity
- Increase the network bandwidth
- Use faster transmission media
Network optimisation:
- Optimise the network topology
- Implement load balancing
- Configure QoS policies
Protocol optimisation:
- Use more efficient network protocols
- Tune the TCP parameters
- Implement traffic shaping
Management optimisation:
- Strengthen network monitoring
- Maintain the network devices regularly
- Define a network usage policy
15. Write a simple network performance test program.
Approach
Collect the measurements that matter for a link — round-trip time, packet loss, and the size and count of the packets sent — and print them in a readable report.
Steps
- Define a structure that holds the target host, the port, the packet parameters, and the measured results.
- Write a function that fills in the structure for a given host, port, size, and count.
- Write a function that prints the results, including the minimum, maximum, and average round-trip time and the packet loss rate.
- Call the two functions from
mainwith a concrete target.
Answer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
// Network performance test structure
typedef struct {
char target_host[256];
int port;
int packet_size;
int packet_count;
double min_rtt;
double max_rtt;
double avg_rtt;
double packet_loss;
} NetworkTest;
// Run the network performance test
NetworkTest perform_network_test(const char* host, int port, int size, int count) {
NetworkTest test;
strcpy(test.target_host, host);
test.port = port;
test.packet_size = size;
test.packet_count = count;
// Simulated test result
test.min_rtt = 10.0; // milliseconds
test.max_rtt = 50.0;
test.avg_rtt = 25.0;
test.packet_loss = 0.1; // 0.1%
return test;
}
// Print the test results
void print_test_results(const NetworkTest* test) {
printf("Network performance test results:\n");
printf("Target host: %s\n", test->target_host);
printf("Port: %d\n", test->port);
printf("Packet size: %d bytes\n", test->packet_size);
printf("Packet count: %d\n", test->packet_count);
printf("Minimum round-trip time: %.2f ms\n", test->min_rtt);
printf("Maximum round-trip time: %.2f ms\n", test->max_rtt);
printf("Average round-trip time: %.2f ms\n", test->avg_rtt);
printf("Packet loss rate: %.2f%%\n", test->packet_loss);
}
int main() {
// Run the network performance test
NetworkTest test = perform_network_test("192.168.1.1", 80, 1024, 100);
// Print the test results
print_test_results(&test);
return 0;
}