Network Layer Comprehensive Exercises

Network Layer Comprehensive Exercises

Exercise 1: Fundamental Concepts

  1. Briefly describe the main functions of the network layer.
Network Layer FunctionsHeterogeneous InternetworkingPacket ForwardingCongestion Control

Approach: list the four functional areas of the network layer and what each one does.

Steps:

The main functions of the network layer include:

  1. Heterogeneous internetworking:

    • connects networks of different types (Ethernet, Token Ring, and so on)
    • unifies communication across different protocols
    • makes global network interconnection possible
  2. 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
  3. Congestion control:

    • monitors the load on the network
    • prevents network congestion
    • takes recovery measures when congestion occurs
  4. 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.

  1. What is the difference between the connectionless and the connection-oriented services of the network layer?
Connectionless ServiceVirtual CircuitReliabilityOrdering

Approach: compare the two services on five properties, then state the scenario each suits.

Steps:

The main differences are:

  1. Connection establishment:

    • Connectionless service: no connection has to be established in advance
    • Connection-oriented service: a connection has to be established first
  2. Data transfer:

    • Connectionless service: every packet is transmitted independently
    • Connection-oriented service: data is transmitted over the established connection
  3. Reliability:

    • Connectionless service: reliable transfer is not guaranteed
    • Connection-oriented service: reliable transfer is guaranteed
  4. Ordering:

    • Connectionless service: packet order is not guaranteed
    • Connection-oriented service: packets are guaranteed to arrive in order
  5. 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

  1. What is the difference between distance vector and link state routing algorithms?
Distance VectorLink StateBellman FordDijkstraConvergence

Approach: compare the two on the six axes that differ in practice.

Steps:

The main differences are:

  1. Information exchange:

    • Distance vector: exchanges only distance information with neighbours
    • Link state: exchanges link state information with the whole network
  2. Topology information:

    • Distance vector: knows only the neighbours’ information
    • Link state: knows the topology of the whole network
  3. Computation:

    • Distance vector: distributed computation with the Bellman-Ford algorithm
    • Link state: centralized computation with the Dijkstra algorithm
  4. Convergence speed:

    • Distance vector: converges slowly
    • Link state: converges quickly
  5. Applicable scale:

    • Distance vector: suitable for small networks
    • Link state: suitable for large networks
  6. 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.

  1. What are the advantages and disadvantages of static routing and of dynamic routing?
Static RoutingDynamic RoutingTrade-offsConvergence

Approach: list the four advantages and four disadvantages of each, then summarize the trade-off.

Steps:

Advantages of static routing:

  1. Simple to configure and easy to understand
  2. Stable in operation, and it does not produce routing loops
  3. Uses no network bandwidth
  4. Good security, since it is not easy to attack

Disadvantages of static routing:

  1. Cannot adapt to network changes
  2. Requires a large configuration effort
  3. Prone to configuration errors
  4. Not suitable for large networks

Advantages of dynamic routing:

  1. Adapts to network changes automatically
  2. Requires little configuration effort
  3. Supports large networks
  4. Strong fault tolerance

Disadvantages of dynamic routing:

  1. Complex to implement
  2. May produce routing loops
  3. Consumes network bandwidth
  4. 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

  1. What are the differences between IPv4 addresses and IPv6 addresses?
IPv4IPv6Address SpaceHeaderSLAAC

Approach: compare the two on six properties, in order of practical impact.

Steps:

The main differences are:

  1. Address length:

    • IPv4: 32-bit addresses
    • IPv6: 128-bit addresses
  2. Address space:

    • IPv4: about 4.3 billion addresses
    • IPv6: about 340 trillion addresses
  3. Address notation:

    • IPv4: dotted decimal (192.168.1.1)
    • IPv6: colon-separated hexadecimal (2001:db8::1)
  4. Header structure:

    • IPv4: complex, with an options field
    • IPv6: simplified, a fixed 40 bytes
  5. Functional characteristics:

    • IPv4: requires NAT, and security is weaker
    • IPv6: security and mobility are built in
  6. 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.

  1. What is CIDR, and what are its advantages?
CIDRClassless RoutingAddress AggregationSupernetting

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:

  1. High address utilization:

    • avoids wasting addresses
    • allocates addresses according to actual need
  2. Fewer routing table entries:

    • address aggregation reduces the number of routing entries
    • improves routing lookup efficiency
  3. Simpler management:

    • flexible address allocation
    • easier network planning
  4. Supports supernetting:

    • combines several small networks into one large network
    • reduces the size of the routing table
  5. 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

  1. Briefly describe the basic principles of RIP and OSPF.
RIPOSPFDistance VectorLink StateConvergence

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:

  1. The router initializes its routing table
  2. It exchanges routing tables with its neighbours at regular intervals
  3. It updates the routing table using the distance vector algorithm
  4. 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:

  1. Discover the neighbouring routers
  2. Measure the link costs
  3. Build the link state database
  4. Compute the shortest path with the Dijkstra algorithm
  5. 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.

  1. What is the main role of a router?
RouterPacket ForwardingRouting TableACLNetwork Management

Approach: group the six roles by function, and describe what each one actually does.

Steps:

The main roles of a router include:

  1. Packet forwarding:

    • forwards packets according to the routing table
    • chooses the best transmission path
    • makes internetworking possible
  2. Routing table maintenance:

    • maintains information about the network topology
    • updates routing entries
    • handles routing changes
  3. Internetworking:

    • connects different networks
    • makes heterogeneous internetworking possible
    • supports conversion between different protocols
  4. Traffic control:

    • controls the flow of packets
    • implements load balancing
    • avoids network congestion
  5. Security control:

    • access control lists (ACLs)
    • firewall functions
    • enforcement of security policies
  6. 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

  1. Why is hierarchical routing needed in a large network?
Hierarchical RoutingAutonomous SystemScalabilityBGP

Approach: state the four problems that force hierarchy, then the four advantages hierarchy delivers.

Steps:

The necessity of hierarchical routing:

  1. The scalability problem:

    • the routing tables of a large network become too large
    • routing updates become extremely expensive
    • route computation becomes complex
  2. The management complexity:

    • a single administrative domain is hard to manage
    • routing policies are hard to unify
    • fault isolation is difficult
  3. The performance problem:

    • convergence takes a long time
    • network delay increases
    • resource consumption is high
  4. 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:

  1. Scalability:

    • supports large-scale networks
    • reduces the size of the routing tables
    • improves routing efficiency
  2. Simple management:

    • hierarchical management with clear responsibilities
    • fault isolation
    • independent policies
  3. Security:

    • inter-domain security policies
    • access control
    • fault isolation
  4. 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.

  1. What improvements does IPv6 bring over IPv4?
IPv6IPv4Address SpaceIPsecMobilityQoS

Approach: go through the eight improvement areas, contrasting IPv4 with IPv6 in each.

Steps:

The main improvements of IPv6:

  1. Address space:

    • IPv4: 32 bits, about 4.3 billion addresses
    • IPv6: 128 bits, about 340 trillion addresses
    • the address exhaustion problem is solved
  2. Simplified header:

    • IPv4: complex, with an options field
    • IPv6: simplified, a fixed 40 bytes
    • processing efficiency improves
  3. Security:

    • IPv4: requires additional security protocols
    • IPv6: IPsec is built in
    • end-to-end security is provided
  4. Mobility:

    • IPv4: requires the Mobile IP extension
    • IPv6: mobility support is built in
    • better support for mobile communication
  5. Automatic configuration:

    • IPv4: requires DHCP
    • IPv6: stateless address autoconfiguration
    • network management is simplified
  6. Quality of service:

    • IPv4: limited support
    • IPv6: better QoS support
    • a flow label field
  7. Multicast support:

    • IPv4: limited multicast capability
    • IPv6: enhanced multicast support
    • better support for multimedia applications
  8. 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.

Found an issue with this content?

Tell us what could be improved.