Network Layer Comprehensive Exercises
Exercise 1: Fundamental Concepts
- Briefly describe the main functions of the network layer.
Approach: list the four functional areas of the network layer and what each one does.
Steps:
The main functions of the network layer include:
-
Heterogeneous internetworking:
- connects networks of different types (Ethernet, Token Ring, and so on)
- unifies communication across different protocols
- makes global network interconnection possible
-
Routing and packet forwarding:
- chooses the best transmission path for a packet
- forwards the packet from the source node to the destination node
- maintains routing table information
-
Congestion control:
- monitors the load on the network
- prevents network congestion
- takes recovery measures when congestion occurs
-
Address management:
- assigns and manages IP addresses
- performs address resolution
- supports address translation
Answer: the network layer provides heterogeneous internetworking, routing and packet forwarding, congestion control, and address management.
- What is the difference between the connectionless and the connection-oriented services of the network layer?
Approach: compare the two services on five properties, then state the scenario each suits.
Steps:
The main differences are:
-
Connection establishment:
- Connectionless service: no connection has to be established in advance
- Connection-oriented service: a connection has to be established first
-
Data transfer:
- Connectionless service: every packet is transmitted independently
- Connection-oriented service: data is transmitted over the established connection
-
Reliability:
- Connectionless service: reliable transfer is not guaranteed
- Connection-oriented service: reliable transfer is guaranteed
-
Ordering:
- Connectionless service: packet order is not guaranteed
- Connection-oriented service: packets are guaranteed to arrive in order
-
Applicable scenarios:
- Connectionless service: real-time applications such as voice and video
- Connection-oriented service: applications such as file transfer
Answer: the connectionless service routes each packet on its own with no guarantee of order or reliability, which suits latency-sensitive traffic; the connection-oriented service establishes a path first and then guarantees ordered, reliable delivery, which suits data that must arrive intact.
Exercise 2: Routing Algorithms
- What is the difference between distance vector and link state routing algorithms?
Approach: compare the two on the six axes that differ in practice.
Steps:
The main differences are:
-
Information exchange:
- Distance vector: exchanges only distance information with neighbours
- Link state: exchanges link state information with the whole network
-
Topology information:
- Distance vector: knows only the neighbours’ information
- Link state: knows the topology of the whole network
-
Computation:
- Distance vector: distributed computation with the Bellman-Ford algorithm
- Link state: centralized computation with the Dijkstra algorithm
-
Convergence speed:
- Distance vector: converges slowly
- Link state: converges quickly
-
Applicable scale:
- Distance vector: suitable for small networks
- Link state: suitable for large networks
-
Resource consumption:
- Distance vector: low computational cost and low resource consumption
- Link state: high computational cost and high resource consumption
Answer: distance vector shares only distances with neighbours and computes paths locally with Bellman-Ford, which is cheap but converges slowly; link state gives every router the whole topology and computes paths with Dijkstra, which converges faster and scales better but costs more.
- What are the advantages and disadvantages of static routing and of dynamic routing?
Approach: list the four advantages and four disadvantages of each, then summarize the trade-off.
Steps:
Advantages of static routing:
- Simple to configure and easy to understand
- Stable in operation, and it does not produce routing loops
- Uses no network bandwidth
- Good security, since it is not easy to attack
Disadvantages of static routing:
- Cannot adapt to network changes
- Requires a large configuration effort
- Prone to configuration errors
- Not suitable for large networks
Advantages of dynamic routing:
- Adapts to network changes automatically
- Requires little configuration effort
- Supports large networks
- Strong fault tolerance
Disadvantages of dynamic routing:
- Complex to implement
- May produce routing loops
- Consumes network bandwidth
- Relatively weaker security
Answer: static routing is simple, stable, and quiet on the network but cannot adapt to change; dynamic routing adapts automatically and scales to large networks but is more complex, consumes bandwidth, and can create routing loops.
Exercise 3: The IPv4 Protocol
- What are the differences between IPv4 addresses and IPv6 addresses?
Approach: compare the two on six properties, in order of practical impact.
Steps:
The main differences are:
-
Address length:
- IPv4: 32-bit addresses
- IPv6: 128-bit addresses
-
Address space:
- IPv4: about 4.3 billion addresses
- IPv6: about 340 trillion addresses
-
Address notation:
- IPv4: dotted decimal (192.168.1.1)
- IPv6: colon-separated hexadecimal (2001:db8::1)
-
Header structure:
- IPv4: complex, with an options field
- IPv6: simplified, a fixed 40 bytes
-
Functional characteristics:
- IPv4: requires NAT, and security is weaker
- IPv6: security and mobility are built in
-
Address assignment:
- IPv4: manual or DHCP
- IPv6: automatic, using stateless address configuration
Answer: IPv6 doubles the address length to 128 bits, shrinks the header to a fixed 40 bytes, and adds built-in security, mobility, and stateless address configuration, which is what removes IPv4’s need for NAT and its address exhaustion problem.
- What is CIDR, and what are its advantages?
Approach: state the definition in three points, then list the five advantages.
Steps:
CIDR (Classless Inter-Domain Routing):
Definition:
- The address space is no longer divided into the traditional classes A, B, and C
- Networks are divided flexibly according to actual need
- Slash notation is used (for example 192.168.1.0/24)
Advantages:
-
High address utilization:
- avoids wasting addresses
- allocates addresses according to actual need
-
Fewer routing table entries:
- address aggregation reduces the number of routing entries
- improves routing lookup efficiency
-
Simpler management:
- flexible address allocation
- easier network planning
-
Supports supernetting:
- combines several small networks into one large network
- reduces the size of the routing table
-
Higher efficiency:
- fewer routing updates
- better network performance
Answer: CIDR replaces class-based addressing with variable-length prefixes, which raises address utilization, allows route aggregation to shrink the routing tables, and simplifies both address allocation and network planning.
Exercise 4: Routing Protocols
- Briefly describe the basic principles of RIP and OSPF.
Approach: state the principle and the working procedure of each protocol in turn.
Steps:
RIP (Routing Information Protocol):
Basic principle:
- a distance vector protocol
- each router exchanges routing information only with its neighbours
- the shortest path is computed with the Bellman-Ford algorithm
- the metric is hop count, with a maximum of 15 hops
How it works:
- The router initializes its routing table
- It exchanges routing tables with its neighbours at regular intervals
- It updates the routing table using the distance vector algorithm
- The process repeats until the network converges
OSPF (Open Shortest Path First):
Basic principle:
- a link state protocol
- every router collects link state information for the whole network
- the shortest path is computed with the Dijkstra algorithm
- the metric is link cost
How it works:
- Discover the neighbouring routers
- Measure the link costs
- Build the link state database
- Compute the shortest path with the Dijkstra algorithm
- Update the routing table
Answer: RIP is a distance vector protocol that exchanges hop counts with neighbours and computes paths with Bellman-Ford, which is simple but converges slowly; OSPF is a link state protocol that floods the topology to every router and computes paths with Dijkstra, which converges faster and scales better.
- What is the main role of a router?
Approach: group the six roles by function, and describe what each one actually does.
Steps:
The main roles of a router include:
-
Packet forwarding:
- forwards packets according to the routing table
- chooses the best transmission path
- makes internetworking possible
-
Routing table maintenance:
- maintains information about the network topology
- updates routing entries
- handles routing changes
-
Internetworking:
- connects different networks
- makes heterogeneous internetworking possible
- supports conversion between different protocols
-
Traffic control:
- controls the flow of packets
- implements load balancing
- avoids network congestion
-
Security control:
- access control lists (ACLs)
- firewall functions
- enforcement of security policies
-
Network management:
- network monitoring
- fault diagnosis
- performance optimization
Answer: a router forwards packets along the path chosen by its routing table, maintains that table as the topology changes, and interconnects different networks; it also handles traffic shaping, security filtering, and network management tasks.
Exercise 5: Comprehensive Application
- Why is hierarchical routing needed in a large network?
Approach: state the four problems that force hierarchy, then the four advantages hierarchy delivers.
Steps:
The necessity of hierarchical routing:
-
The scalability problem:
- the routing tables of a large network become too large
- routing updates become extremely expensive
- route computation becomes complex
-
The management complexity:
- a single administrative domain is hard to manage
- routing policies are hard to unify
- fault isolation is difficult
-
The performance problem:
- convergence takes a long time
- network delay increases
- resource consumption is high
-
Security considerations:
- different domains have different security policies
- inter-domain access control is required
- the scope of a fault must be contained
The advantages of hierarchical routing:
-
Scalability:
- supports large-scale networks
- reduces the size of the routing tables
- improves routing efficiency
-
Simple management:
- hierarchical management with clear responsibilities
- fault isolation
- independent policies
-
Security:
- inter-domain security policies
- access control
- fault isolation
-
Flexibility:
- different domains use different protocols
- independent routing policies
- flexible topology
Answer: hierarchy keeps routing tables and update overhead manageable in a large network by splitting it into autonomous systems, which also localizes faults and lets each domain enforce its own policy.
- What improvements does IPv6 bring over IPv4?
Approach: go through the eight improvement areas, contrasting IPv4 with IPv6 in each.
Steps:
The main improvements of IPv6:
-
Address space:
- IPv4: 32 bits, about 4.3 billion addresses
- IPv6: 128 bits, about 340 trillion addresses
- the address exhaustion problem is solved
-
Simplified header:
- IPv4: complex, with an options field
- IPv6: simplified, a fixed 40 bytes
- processing efficiency improves
-
Security:
- IPv4: requires additional security protocols
- IPv6: IPsec is built in
- end-to-end security is provided
-
Mobility:
- IPv4: requires the Mobile IP extension
- IPv6: mobility support is built in
- better support for mobile communication
-
Automatic configuration:
- IPv4: requires DHCP
- IPv6: stateless address autoconfiguration
- network management is simplified
-
Quality of service:
- IPv4: limited support
- IPv6: better QoS support
- a flow label field
-
Multicast support:
- IPv4: limited multicast capability
- IPv6: enhanced multicast support
- better support for multimedia applications
-
Extensibility:
- IPv4: poor extensibility
- IPv6: better extensibility
- future protocols are supported
Answer: IPv6 offers a vastly larger address space, a fixed and simpler 40-byte header, built-in IPsec and mobility, stateless address autoconfiguration, and better multicast and QoS support, which together remove IPv4’s address exhaustion, NAT dependency, and header complexity problems.
