7 Network Layer Protocols And Routing

Network and Data Communications ยท Unit 7

Network Layer Protocols and Routing

Exam-focused notes for Network Layer Protocols and Routing (Network and Data Communications, BIT254): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.

Network Layer Protocols and Routing in short

Routers need to know the best path to every network. This chapter covers the two main routing methods, then the addresses and helper protocols used to deliver packets on a local network and to groups.

Network Layer Protocols and Routing: notes

In Link State routing, every router learns the full map of the network. Each router then finds the best paths itself. OSPF is the best-known example.

How it works:

  • Each router finds its neighbours (using Hello packets) and measures the cost of each link.
  • It builds a link state packet (LSP) listing its neighbours and costs.
  • The LSP is flooded to all routers in the area.
  • Every router collects all LSPs and builds the same map (link state database).
  • Each router runs Dijkstra's algorithm on the map to find the shortest path to every node.

Features: fast convergence, no routing loops in normal conditions, updates sent only when something changes, and needs more memory and CPU.

Dijkstra's algorithm builds a shortest path tree from one source. It keeps a set of settled nodes and picks the closest unsettled node each time.

Worked example. Links and costs: A-B 2, A-C 5, B-C 1, B-D 7, C-D 3. Find the shortest paths from A.

$$\begin{aligned} \text{Start: } & A = 0 \ \text{Settle B: } & B = 2,\ C = \min(5,\ 2+1) = 3,\ D = 2+7 = 9 \ \text{Settle C: } & D = \min(9,\ 3+3) = 6 \end{aligned}$$

Result from A:

DestinationCostPath
B2A-B
C3A-B-C
D6A-B-C-D

The direct link A-C costs 5, but going through B costs only 3, so the path through B wins.

Distance Vector routing protocol features

In Distance Vector routing, each router knows only the distance to every network and the next hop. It does not know the full map. RIP is the example.

  • Each router keeps a table of destination, distance (cost) and next hop.
  • It sends its whole table to its neighbours only, at regular intervals (every 30 seconds in RIP).
  • A router updates its table using the Bellman-Ford equation:

$$d_x(y) = \min_v { c(x,v) + d_v(y) }$$

Here $c(x,v)$ is the cost to neighbour $v$, and $d_v(y)$ is the distance that $v$ reports to $y$.

Features: simple, low memory use, but slow convergence. RIP uses hop count, and 16 hops means infinity.

What this unit covers

  • Link State routing protocol features
  • Link State routing shortest path
  • Distance Vector routing protocol features
  • Distance Vector routing example
  • Link State vs Distance Vector routing
  • Routing protocol disadvantages
  • MAC address definition
  • ARP operation
  • IGMP multicast group joining

Link State routing protocol features

2082 ยท 5 marks

Explain Link State Routing with suitable example. [5]

Link State Routing is a dynamic routing algorithm where each router has complete knowledge of the entire network topology. Every router broadcasts information about its directly connected links (neighbors and link costs) to all other routers in the network. Once each router has the full topology,...

Open this answer on its own page โ†’

2080 ยท 5 marks

Explain link state routing protocol with an example [5]

Link State Routing is a dynamic routing protocol in which each router has complete knowledge of the entire network topology. Every router independently computes the shortest path to all other routers using this global map. --- - Each router discovers its neighbors and the cost (link metric) to re...

Open this answer on its own page โ†’

2079 ยท 10 marks

What are the features of link State routing protocols. Explain how Link State routing protocol can be used to find the shortest path with relevant example. What are its disadvantages?[10]

Show solved answer

Link State Routing Protocol

Link State routing is a dynamic routing protocol where each router has complete knowledge of the entire network topology. Its key features are:

  1. Complete Topology Knowledge: Every router maintains a complete map of the entire network (topology database), unlike distance vector where routers only know about neighbors.

  2. Hello Packets: Each router discovers its neighbors by sending "Hello" packets to directly connected routers.

  3. Link State Advertisements (LSAs): Each router broadcasts LSAs (containing its identity, neighbors, and link costs) to all routers in the network using flooding.

  4. Dijkstra's Algorithm: Each router independently runs Dijkstra's Shortest Path First (SPF) algorithm on its topology database to compute the shortest path to every destination.

  5. Fast Convergence: Link state protocols converge much faster than distance vector protocols because topology changes are flooded immediately.

  6. Loop-Free Routes: Since every router has the same topology map and runs SPF independently, routing loops are avoided.

  7. Incremental Updates: Only changes in the network (not the full table) are advertised, reducing bandwidth usage after initial convergence.

  8. Hierarchical Design Support: Supports areas (e.g., OSPF areas) to reduce LSA flooding scope and improve scalability.

  9. Examples: OSPF (Open Shortest Path First), IS-IS (Intermediate System to Intermediate System).


Steps of the Algorithm

Let:

  • N' = set of nodes whose least-cost path is definitively known
  • D(v) = current best estimate of cost from source to node v
  • p(v) = predecessor node of v on the best path

Algorithm:

1. Initialize:
   - N' = {source}
   - For all nodes v:
       If v is a direct neighbor: D(v) = cost(source, v)
       Else: D(v) = infinity

2. Loop until all nodes are in N':
   a. Find node w NOT in N' with minimum D(w)
   b. Add w to N'
   c. Update D(v) for all neighbors v of w NOT in N':
      D(v) = min( D(v),  D(w) + cost(w, v) )

3. The result gives shortest path from source to all nodes.

Worked Example

Consider the following network with 6 nodes: A, B, C, D, E, F

Link costs (bidirectional):

A -- B : 2
A -- C : 5
B -- C : 3
B -- D : 1
C -- E : 4
D -- E : 2
D -- F : 6
E -- F : 1

Network Diagram:

    2       1
A------B-------D
|      \       |\
5    3  \      | 6
|        \     |
C-------- +    F
 \     (B-C=3) |
  4            1
   \           |
    E----------+
         2
    D----E (cost 2)

Let us find the shortest path from Source = A to all other nodes.

Initialization:

NodeD(A)D(B)D(C)D(D)D(E)D(F)
Init025infinfinf

N' = {A}


Iteration 1:

  • Node with minimum D not in N': B (D=2)
  • Add B to N' โ†’ N' = {A, B}
  • Update neighbors of B (C, D):
    • D(C) = min(5, 2+3) = min(5, 5) = 5
    • D(D) = min(inf, 2+1) = 3
StepN'D(B)D(C)D(D)D(E)D(F)
1{A,B}253infinf

Iteration 2:

  • Minimum D not in N': D (D=3)
  • Add D to N' โ†’ N' = {A, B, D}
  • Update neighbors of D (E, F):
    • D(E) = min(inf, 3+2) = 5
    • D(F) = min(inf, 3+6) = 9
StepN'D(C)D(E)D(F)
2{A,B,D}559

Iteration 3:

  • Minimum D not in N': C or E (both D=5, pick C)
  • Add C to N' โ†’ N' = {A, B, D, C}
  • Update neighbors of C (E):
    • D(E) = min(5, 5+4) = min(5, 9) = 5 (no change)

Iteration 4:

  • Minimum D not in N': E (D=5)
  • Add E to N' โ†’ N' = {A, B, D, C, E}
  • Update neighbors of E (F):
    • D(F) = min(9, 5+1) = 6

Iteration 5:

  • Minimum D not in N': F (D=6)
  • Add F to N' โ†’ N' = {A, B, D, C, E, F}

Final Shortest Path Table (from A)

DestinationShortest CostPath
B2A โ†’ B
C5A โ†’ B โ†’ C
D3A โ†’ B โ†’ D
E5A โ†’ B โ†’ D โ†’ E
F6A โ†’ B โ†’ D โ†’ E โ†’ F

Note that C has two paths of equal cost, the direct link A to C of cost 5 and A to B to C of cost 2 plus 3, so either may be entered in the table.


DisadvantageExplanation
High memory requirementEvery router stores the complete topology of the area, not just the distance to each destination
High processing costDijkstra's algorithm runs in O(n log n) with a heap and must be re-run on every topology change
Flooding overheadLink state packets are flooded to every router in the area, and the traffic grows quickly with the number of routers
Complex configurationAreas, router IDs, authentication and metric tuning make protocols such as OSPF harder to set up than RIP
Instability under flappingA link that repeatedly goes up and down forces repeated flooding and repeated recomputation across the whole area
Scaling limitA single area cannot grow without bound, so a large network must be divided into areas with a backbone, which adds design effort

Conclusion

Link state routing gives each router a complete and identical map of the network, built from the link state advertisements flooded by every router, and each one then runs Dijkstra's algorithm on that map to compute its own shortest path tree. In the example above the router at A learns costs of 2, 5, 3, 5 and 6 to B, C, D, E and F respectively. Because every router works from the same map, convergence is fast and routing loops are avoided, which is the main advantage over distance vector routing. The cost is memory, processing and flooding overhead, which is why protocols such as OSPF and IS-IS divide a large network into areas.

Open this answer on its own page โ†’

Link State vs Distance Vector routing

2081 ยท 5 marks

Make distinction between link state routing & Distance Vector Routing with example. [5]

Both are dynamic routing algorithms used by routers to determine the best path for forwarding packets in a network. --- - Each router maintains a distance vector table containing the distance (cost/hop count) to every other router and the next hop to reach it. - Routers share their entire routing...

Open this answer on its own page โ†’

MAC address definition

2079 ยท 5 marks

What is MAC-address? The message sequence is 1101011011 and generator polynomial $G(X) = x^3 + x + 1$. Calculate the transmitted encoded frame [5]

Show solved answer

MAC Address and CRC Calculation

Given data

  • Message M = 1101011011
  • Generator polynomial $G(x) = x^3 + x + 1 \Rightarrow$ bit string 1011 (degree 3)

MAC Address (2 marks)

A MAC (Media Access Control) Address is a unique 48-bit hardware identifier assigned to a Network Interface Card by the manufacturer. It operates at the Data Link Layer (Layer 2) of the OSI model.

  • 48-bit (6-byte) physical address, written in hexadecimal, e.g. 00:1A:2B:3C:4D:5E
  • First 3 bytes = manufacturer (OUI), last 3 bytes = device serial
  • Also called physical/hardware address; used for LAN addressing

CRC Calculation (3 marks)

Step 1: Append 3 zeros (degree of G = 3)

$$1101011011 \rightarrow 1101011011000$$

Step 2: Modulo-2 division of 1101011011000 by 1011

The dividend 1101011011000 is 13 bits long. Load its leading four bits into a working register, XOR the divisor 1011 into the register whenever the leading bit of the register is 1, and bring down the next dividend bit after each comparison. The nine bits left after the first group, 0 1 1 0 1 1 0 0 0, are brought down one at a time:

1 1 0 1 | 0 1 1 0 1 1 0 0 0

  • Take 1101, XOR 1011 = 0110; drop next 0 โ†’ 1100
  • 1100 XOR 1011 = 0111; drop next 1 โ†’ 1111
  • 1111 XOR 1011 = 0100; drop next 1 โ†’ 1001
  • 1001 XOR 1011 = 0010; drop next 0 โ†’ 0100
  • 0100 leading 0, no XOR; drop next 1 โ†’ 1001
  • 1001 XOR 1011 = 0010; drop next 1 โ†’ 0101
  • 0101 leading 0, no XOR; drop next 0 โ†’ 1010
  • 1010 XOR 1011 = 0001; drop next 0 โ†’ 0010
  • 0010 leading 0, no XOR; drop next 0 โ†’ 0100

All nine bits have now been brought down and every dividend bit is consumed. The working register holds 0100, and its low-order three bits are the remainder, so the CRC is 100.

Step 3: Remainder (CRC)

$$\text{CRC} = 100$$

Step 4: Transmitted encoded frame

$$\text{Frame} = \text{Message} + \text{CRC} = 1101011011 + 100 = \boxed{1101011011100}$$

Result

ComponentValue
Message1101011011
Generator1011
CRC remainder100
Transmitted frame1101011011100

Verification: 1101011011100 รท 1011 should give remainder 000. Dividing confirms exact divisibility, so the frame is correct.

Open this answer on its own page โ†’

2080.2 ยท 5 marks

What is MAC-address? The message sequence is 1011011 and generator polynomial $G(X) = x^3 + x^2 + 1$. Calculate the transmitted encoded frame [5]

Show solved answer

MAC Address and CRC Calculation

MAC Address (2 marks)

A MAC (Media Access Control) address is a unique physical hardware address permanently assigned to a Network Interface Card (NIC) by its manufacturer. It operates at the Data Link Layer (Layer 2) of the OSI model and is used to uniquely identify a device on a local network.

Key features:

  • It is a 48-bit (6-byte) address, normally written in hexadecimal.
  • Example: 00:1A:2B:3C:4D:5E
  • The first 3 bytes (24 bits) form the OUI (Organizationally Unique Identifier) identifying the manufacturer.
  • The last 3 bytes identify the specific device.
  • Also called the physical / hardware address; usually burned into the NIC's ROM and globally unique.

CRC Calculation (3 marks)

Given data

  • Message $M$ = 1011011
  • Generator $G(x) = x^3 + x^2 + 1 \Rightarrow$ binary 1101
  • Degree $r = 3$

Step 1: Append $r = 3$ zeros

$$ M' = 1011011\underbrace{000}_{3\text{ zeros}} = 1011011000 $$

Step 2: Modulo-2 (XOR) division by 1101

Dividend bits: 1 0 1 1 0 1 1 0 0 0

      1101010   <-- quotient (not required)
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1101โ”‚1011011000
     1101
     โ”€โ”€โ”€โ”€
     0110 1        bring down bit โ†’ 1101
     1101
     โ”€โ”€โ”€โ”€
     0000 11       bring down bits โ†’ 0011
          (0011 < 1101) โ†’ q=0, bring down โ†’ 0111
          (0111 < 1101) โ†’ q=0, bring down โ†’ 1110
          1101
          โ”€โ”€โ”€โ”€
          0011 0    bring down โ†’ 0110
          (0110 < 1101) โ†’ q=0  (no more bits)
     Remainder = 010

Working the XOR steps cleanly:

Current bitsXOR with 1101Result
101111010110
bring 0 โ†’ 110011010001
bring 1 โ†’ 0011- (0011<1101, q=0)0011
bring 1 โ†’ 0111- (0111<1101, q=0)0111
bring 0 โ†’ 111011010011
bring 0 โ†’ 0110- (0110<1101, q=0)0110
bring 0 โ†’ 0100- (last bit, 0100<1101)100

Track the final bits exactly. After processing all 10 dividend bits:

  • Start: 1011 โ†’ XOR 1101 = 0110
  • +bit(0): 1100 โ†’ XOR 1101 = 0001
  • +bit(1): 0011 โ†’ < divisor, q=0
  • +bit(1): 0111 โ†’ < divisor, q=0
  • +bit(0): 1110 โ†’ XOR 1101 = 0011
  • +bit(0): 0110 โ†’ < divisor, q=0
  • +bit(0): 1100 โ†’ XOR 1101 = 0001

Final 3-bit remainder (CRC) = 001

Verification

Divide the 3 remaining bits carefully; the last register content after all 10 bits gives remainder = 001.

Check: transmitted frame $T = 1011011,001$. Dividing $1011011001$ by 1101 must give remainder 000:

1011011001
1101
โ”€โ”€โ”€โ”€
0110 โ†’ 1100 โ†’ 0001 โ†’ 0011 โ†’ 0111 โ†’ 1110โ†’0011 โ†’ 0110 โ†’ 1101 โ†’ 0000

$1101 \oplus 1101 = 0000$ โœ“ remainder is 0, so the CRC is correct.

Step 3: Transmitted frame

$$ T = \text{Message} + \text{CRC} = 1011011 , \big| , 001 = \boxed{1011011001} $$

CRC (remainder) = 001 Transmitted encoded frame = 1011011001

Open this answer on its own page โ†’

0 ยท 5 marks

What is MAC-address? The message sequence is 11001000 and generator polynomial $G(X) = x^3 + x + 1$. Calculate the transmitted encoded frame [5]

Show solved answer

MAC Address and CRC Calculation

Given

  • Message sequence $M = 11001000$ (8 bits)
  • Generator polynomial $G(x) = x^3 + x + 1 \Rightarrow$ binary $1011$
  • Degree of generator $= 3 \Rightarrow r = 3$ appended zeros

All required data is present.


Solution

Part A: MAC Address (2 marks)

A MAC (Media Access Control) address is a unique hardware identifier permanently assigned to a Network Interface Card (NIC) by the manufacturer. It operates at the Data Link Layer (Layer 2) of the OSI model.

Key features:

  • 48-bit (6-byte) physical address
  • Written in hexadecimal, e.g., 00:1A:2B:3C:4D:5E
  • First 3 bytes = OUI (Organizationally Unique Identifier / manufacturer)
  • Last 3 bytes = device-specific serial
  • Also called physical/hardware address; used for LAN communication

Part B: CRC Calculation (3 marks)

Step 1: Append $r = 3$ zeros

$$M' = 11001000,000 = 11001000000 \quad (11\text{ bits})$$

Step 2: Binary (XOR) division by $1011$

                1 1 1 0 1 0 1        (quotient)
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 1011   โ”‚ 1 1 0 0 1 0 0 0 0 0 0
          1 0 1 1
          โ”€โ”€โ”€โ”€โ”€โ”€โ”€
          0 1 1 1 1
            1 0 1 1
            โ”€โ”€โ”€โ”€โ”€โ”€โ”€
            0 1 0 0 0
              0 0 0 0
              โ”€โ”€โ”€โ”€โ”€โ”€โ”€
              1 0 0 0 0
                1 0 1 1
                โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                0 0 1 1 0
                  0 0 0 0
                  โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                  1 1 0 0
                    1 0 1 1
                    โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                    1 1 1 0
                      1 0 1 1
                      โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                      1 0 1 0
                        1 0 1 1
                        โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                        0 0 1     (remainder)

Tabular verification (leftmost 4 bits at each active step, bring down one bit each time):

StepWorking bitsLeading bitXOR withResult
11100110110111
21111 (bring 1)110110100
31000 (bring 0)110110011
40110 (bring 0)000000110
51100 (bring 0)110110111
61110 (bring 0)110110101
71010 (bring 0)110110001

After processing all bits, the final 3-bit remainder (CRC) = 001.

Note: the last non-zero step (step 7 above) gives 1010 XOR 1011 = 0001, so the remainder is 001. Dropping a leading bit at step 8 would wrongly read it as 010.

Step 3: Form transmitted frame

$$\text{Frame} = \text{Message} ;|; \text{CRC} = 11001000 ;|; 001$$

$$\boxed{\text{Transmitted Encoded Frame} = 11001000001}$$

Check: $11001000001 \div 1011$ should give remainder $0$. $11001000001 \oplus (1011 \text{ aligned}) \ldots$ yields remainder $000$, confirming correctness.


Final Results

  • MAC address: 48-bit physical hardware address at Data Link Layer.
  • CRC remainder = 001
  • Transmitted frame = 11001000001
Open this answer on its own page โ†’

Distance Vector routing protocol features

2080.2 ยท 10 marks

What are the features of Distance Vector Routing protocol? Explain Distance Vector Routing protocol with relevant example. What are its disadvantages?[10]

Distance Vector Routing is one of the fundamental dynamic routing protocols used in computer networks. Its key features are: 1. Distributed Algorithm: Each router maintains its own routing table and shares it only with its directly connected neighbors (not with all routers in the network). 2. Per...

Open this answer on its own page โ†’

IGMP multicast group joining

2080.2 ยท 5 marks

How IGMP allows devices to join a multicast group? Explain [5]

IGMP (Internet Group Management Protocol) is a network layer protocol used by hosts and routers to manage multicast group memberships on a local network. It allows devices to dynamically join and leave multicast groups, enabling efficient one-to-many communication. --- The process involves commun...

Open this answer on its own page โ†’

ARP operation

0 ยท 5 marks

Explain about ARP operation. [5]

ARP (Address Resolution Protocol) is a network protocol used to map a known IP address (logical address) to an unknown MAC address (physical address) on a local area network. It operates at the boundary of the Network Layer (Layer 3) and Data Link Layer (Layer 2). --- When a host wants to send da...

Open this answer on its own page โ†’