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.
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]
2080 ยท 5 marks
Explain link state routing protocol with an example [5]
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 answerHide answer
Link State Routing Protocol
Features of 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:
-
Complete Topology Knowledge: Every router maintains a complete map of the entire network (topology database), unlike distance vector where routers only know about neighbors.
-
Hello Packets: Each router discovers its neighbors by sending "Hello" packets to directly connected routers.
-
Link State Advertisements (LSAs): Each router broadcasts LSAs (containing its identity, neighbors, and link costs) to all routers in the network using flooding.
-
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.
-
Fast Convergence: Link state protocols converge much faster than distance vector protocols because topology changes are flooded immediately.
-
Loop-Free Routes: Since every router has the same topology map and runs SPF independently, routing loops are avoided.
-
Incremental Updates: Only changes in the network (not the full table) are advertised, reducing bandwidth usage after initial convergence.
-
Hierarchical Design Support: Supports areas (e.g., OSPF areas) to reduce LSA flooding scope and improve scalability.
-
Examples: OSPF (Open Shortest Path First), IS-IS (Intermediate System to Intermediate System).
How Link State Routing Finds the Shortest Path (Dijkstra's Algorithm)
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:
| Node | D(A) | D(B) | D(C) | D(D) | D(E) | D(F) |
|---|---|---|---|---|---|---|
| Init | 0 | 2 | 5 | inf | inf | inf |
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
| Step | N' | D(B) | D(C) | D(D) | D(E) | D(F) |
|---|---|---|---|---|---|---|
| 1 | {A,B} | 2 | 5 | 3 | inf | inf |
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
| Step | N' | D(C) | D(E) | D(F) |
|---|---|---|---|---|
| 2 | {A,B,D} | 5 | 5 | 9 |
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)
| Destination | Shortest Cost | Path |
|---|---|---|
| B | 2 | A โ B |
| C | 5 | A โ B โ C |
| D | 3 | A โ B โ D |
| E | 5 | A โ B โ D โ E |
| F | 6 | A โ 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.
Disadvantages of Link State Routing
| Disadvantage | Explanation |
|---|---|
| High memory requirement | Every router stores the complete topology of the area, not just the distance to each destination |
| High processing cost | Dijkstra's algorithm runs in O(n log n) with a heap and must be re-run on every topology change |
| Flooding overhead | Link state packets are flooded to every router in the area, and the traffic grows quickly with the number of routers |
| Complex configuration | Areas, router IDs, authentication and metric tuning make protocols such as OSPF harder to set up than RIP |
| Instability under flapping | A link that repeatedly goes up and down forces repeated flooding and repeated recomputation across the whole area |
| Scaling limit | A 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.
Link State vs Distance Vector routing
2081 ยท 5 marks
Make distinction between link state routing & Distance Vector Routing with example. [5]
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 answerHide 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, XOR1011=0110; drop next0โ1100 1100XOR1011=0111; drop next1โ11111111XOR1011=0100; drop next1โ10011001XOR1011=0010; drop next0โ01000100leading 0, no XOR; drop next1โ10011001XOR1011=0010; drop next1โ01010101leading 0, no XOR; drop next0โ10101010XOR1011=0001; drop next0โ00100010leading 0, no XOR; drop next0โ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
| Component | Value |
|---|---|
| Message | 1101011011 |
| Generator | 1011 |
| CRC remainder | 100 |
| Transmitted frame | 1101011011100 |
Verification: 1101011011100 รท 1011 should give remainder 000. Dividing confirms exact divisibility, so the frame is correct.
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 answerHide 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 bits | XOR with 1101 | Result |
|---|---|---|
| 1011 | 1101 | 0110 |
| bring 0 โ 1100 | 1101 | 0001 |
| bring 1 โ 0011 | - (0011<1101, q=0) | 0011 |
| bring 1 โ 0111 | - (0111<1101, q=0) | 0111 |
| bring 0 โ 1110 | 1101 | 0011 |
| 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
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 answerHide 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):
| Step | Working bits | Leading bit | XOR with | Result |
|---|---|---|---|---|
| 1 | 1100 | 1 | 1011 | 0111 |
| 2 | 1111 (bring 1) | 1 | 1011 | 0100 |
| 3 | 1000 (bring 0) | 1 | 1011 | 0011 |
| 4 | 0110 (bring 0) | 0 | 0000 | 0110 |
| 5 | 1100 (bring 0) | 1 | 1011 | 0111 |
| 6 | 1110 (bring 0) | 1 | 1011 | 0101 |
| 7 | 1010 (bring 0) | 1 | 1011 | 0001 |
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
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]
IGMP multicast group joining
2080.2 ยท 5 marks
How IGMP allows devices to join a multicast group? Explain [5]
ARP operation
Make Unit 7 stick
Practice BIT254 with flashcards & quizzes