1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
|
# COMP-347: Computer Networks - Final Exam Study Notes
**Based on:** Computer Networking: A Top-Down Approach, 8th Edition
**Course Units:** 1-7 covering all major networking concepts
**Prepared for:** Final Examination
---
## Table of Contents
1. [Unit 1: Introduction to Computer Networks](#unit-1-introduction-to-computer-networks)
2. [Unit 2: Application Layer](#unit-2-application-layer)
3. [Unit 3: Transport Layer](#unit-3-transport-layer)
4. [Unit 4: Network Layer - Data Plane](#unit-4-network-layer---data-plane)
5. [Unit 5: Network Layer - Control Plane](#unit-5-network-layer---control-plane)
6. [Unit 6: Link Layer and LANs](#unit-6-link-layer-and-lans)
7. [Unit 7: Wireless and Mobile Networks](#unit-7-wireless-and-mobile-networks)
8. [Key Formulas and Calculations](#key-formulas-and-calculations)
9. [Protocol Comparison Tables](#protocol-comparison-tables)
10. [Common Exam Topics](#common-exam-topics)
---
## Unit 1: Introduction to Computer Networks
### 1.1 What is the Internet?
**Key Concepts:**
- **Internet**: Global network of interconnected computers using TCP/IP protocols
- **Network Edge**: End systems (hosts) that connect to the Internet
- **Network Core**: Routers and switches that forward data
- **ISP Hierarchy**: Tier-1, Regional, and Local ISPs
**Components:**
- **Hosts/End Systems**: Computers, smartphones, IoT devices
- **Communication Links**: Fiber, copper, radio, satellite
- **Packet Switches**: Routers and link-layer switches
- **Protocols**: Rules for communication (TCP, IP, HTTP, etc.)
### 1.2 Network Edge
**Access Technologies:**
- **DSL**: Digital Subscriber Line over telephone lines
- **Cable Internet**: Over cable TV infrastructure
- **FTTH**: Fiber to the Home
- **Ethernet**: Wired LAN connections
- **Wi-Fi**: Wireless LAN (802.11)
- **Cellular**: 3G, 4G/LTE, 5G mobile networks
**Physical Media:**
- **Guided Media**: Twisted pair, coaxial cable, fiber optic
- **Unguided Media**: Terrestrial radio, satellite, microwave
### 1.3 Network Core
**Switching Techniques:**
| Aspect | Circuit Switching | Packet Switching |
|--------|------------------|------------------|
| **Connection** | Dedicated path | Store-and-forward |
| **Resources** | Reserved for entire call | Shared dynamically |
| **Efficiency** | Poor for bursty data | Good for bursty data |
| **Delay** | Consistent | Variable |
| **Examples** | Traditional telephony | Internet |
**Packet Switching Concepts:**
- **Store-and-Forward**: Entire packet received before forwarding
- **Queuing Delay**: Waiting in output buffer
- **Packet Loss**: Buffer overflow causes dropped packets
### 1.4 Delay, Loss, and Throughput
**Types of Delay:**
1. **Processing Delay (d_proc)**: Router processing time
2. **Queuing Delay (d_queue)**: Waiting in output queue
3. **Transmission Delay (d_trans)**: Time to push packet onto link
- Formula: d_trans = L/R (L = packet length, R = transmission rate)
4. **Propagation Delay (d_prop)**: Time for signal to travel
- Formula: d_prop = d/s (d = distance, s = propagation speed)
**Total Nodal Delay:**
```
d_nodal = d_proc + d_queue + d_trans + d_prop
```
**Throughput:**
- **Instantaneous**: Rate at a given instant
- **Average**: Long-term average rate
- **Bottleneck Link**: Link with minimum transmission rate
**Traffic Intensity:**
- Formula: La/R (L = avg packet length, a = avg arrival rate, R = transmission rate)
- If La/R > 1: Queues grow without bound
- If La/R ≈ 1: Large delays
- If La/R << 1: Small delays
---
## Unit 2: Application Layer
### 2.1 Principles of Network Applications
**Application Architectures:**
1. **Client-Server Model**:
- Server: Always-on, permanent IP address
- Clients: Communicate with server, may be intermittently connected
2. **Peer-to-Peer (P2P)**:
- Minimal/no dedicated servers
- End systems communicate directly
- Self-scalability
**Transport Services:**
- **Reliable Data Transfer**: TCP provides, UDP does not
- **Throughput**: Minimum guaranteed vs best-effort
- **Timing**: Low-delay guarantees
- **Security**: Encryption, authentication
### 2.2 Web and HTTP
**HTTP (HyperText Transfer Protocol):**
- **Stateless**: Server maintains no client state
- **TCP-based**: Uses reliable transport
- **Methods**: GET, POST, HEAD, PUT, DELETE
**HTTP Connections:**
- **Non-persistent**: Separate TCP connection for each object
- **Persistent**: Multiple objects over single TCP connection
- Without pipelining: Wait for response before next request
- With pipelining: Send requests back-to-back
**Response Codes:**
- 200 OK: Request succeeded
- 301 Moved Permanently: Object moved
- 400 Bad Request: Request not understood
- 404 Not Found: Requested document not found
- 505 HTTP Version Not Supported
**Web Caching:**
- **Proxy Server**: Acts as intermediary
- **Benefits**: Reduced response time, reduced traffic
- **Conditional GET**: If-Modified-Since header
### 2.3 Electronic Mail
**Email System Components:**
- **User Agents**: Mail readers (Outlook, Gmail)
- **Mail Servers**: Store and forward messages
- **SMTP**: Simple Mail Transfer Protocol
**Email Protocols:**
| Protocol | Purpose | Port | Characteristics |
|----------|---------|------|-----------------|
| **SMTP** | Sending mail | 25 | Push protocol, ASCII-based |
| **POP3** | Retrieving mail | 110 | Download-and-delete |
| **IMAP** | Retrieving mail | 143 | Server-side storage |
**SMTP Process:**
1. Client establishes TCP connection to server port 25
2. Client sends commands, server responds with status codes
3. Transfer message using DATA command
4. Close connection
### 2.4 Domain Name System (DNS)
**DNS Functions:**
- **Hostname-to-IP translation**
- **Host aliasing** (canonical vs alias names)
- **Mail server aliasing**
- **Load distribution** (replicated web servers)
**DNS Hierarchy:**
- **Root DNS Servers**: Top level (13 logical servers worldwide)
- **TLD DNS Servers**: .com, .org, .net, country codes
- **Authoritative DNS Servers**: Organization's own servers
- **Local DNS Server**: ISP's default name server
**DNS Record Types:**
- **A**: Hostname to IPv4 address
- **AAAA**: Hostname to IPv6 address
- **CNAME**: Alias to canonical hostname
- **MX**: Mail exchange server
- **NS**: Authoritative name server
**DNS Queries:**
- **Recursive**: DNS server queries on behalf of client
- **Iterative**: DNS server returns next server to query
### 2.5 P2P File Distribution
**Scalability Comparison:**
**Client-Server File Distribution:**
- Distribution time: D_cs ≥ max{NF/u_s, F/d_min}
- Grows linearly with N (number of clients)
**P2P File Distribution:**
- Distribution time: D_P2P ≥ max{F/u_s, F/d_min, NF/(u_s + Σu_i)}
- Self-scaling: upload capacity increases with peers
**BitTorrent Protocol:**
- **Torrent**: Group of peers sharing same file
- **Tracker**: Infrastructure node tracking participating peers
- **Chunks**: File divided into 256KB pieces
- **Tit-for-tat**: Trade pieces with neighbors
---
## Unit 3: Transport Layer
### 3.1 Transport Layer Principles
**Transport vs Network Layer:**
- **Network Layer**: Logical communication between hosts
- **Transport Layer**: Logical communication between processes
**Multiplexing/Demultiplexing:**
- **Multiplexing**: Gathering data from multiple sockets
- **Demultiplexing**: Delivering received segments to correct socket
- **Socket Identification**: (source IP, source port, dest IP, dest port)
### 3.2 UDP (User Datagram Protocol)
**UDP Characteristics:**
- **Connectionless**: No handshaking
- **Unreliable**: No delivery guarantee
- **No congestion control**: Sends at desired rate
- **Small header**: 8 bytes only
**UDP Header:**
- Source port (16 bits)
- Destination port (16 bits)
- Length (16 bits)
- Checksum (16 bits)
**UDP Checksum:**
- **Purpose**: Error detection
- **Calculation**: 1's complement of 1's complement sum
- **Receiver**: Adds all 16-bit words including checksum
- No errors: Result = 1111111111111111
- Errors detected: Result ≠ 1111111111111111
### 3.3 TCP (Transmission Control Protocol)
**TCP Characteristics:**
- **Connection-oriented**: Three-way handshake
- **Reliable**: Guarantees delivery
- **Flow control**: Receiver controls sender rate
- **Congestion control**: Network-aware rate control
- **Full-duplex**: Bidirectional data flow
**TCP Segment Structure:**
- **Header Length**: 20-60 bytes (options)
- **Sequence Number**: Byte stream number
- **Acknowledgment Number**: Next expected sequence number
- **Window Size**: Flow control (bytes)
- **Flags**: SYN, FIN, RST, PSH, URG, ACK
**TCP Reliable Data Transfer:**
1. **Sequence Numbers**: Byte-stream numbers
2. **Acknowledgments**: Cumulative ACKs
3. **Retransmission Timer**: Single timer for oldest unACKed segment
4. **Fast Retransmit**: 3 duplicate ACKs trigger immediate retransmission
**TCP Connection Management:**
**Three-Way Handshake (Connection Establishment):**
1. Client sends SYN segment
2. Server responds with SYN-ACK
3. Client sends ACK
**Connection Termination:**
1. Client sends FIN
2. Server sends ACK and FIN
3. Client sends ACK
4. Connection closed
### 3.4 TCP Congestion Control
**Congestion Control Principles:**
- **End-to-end**: TCP infers congestion from loss/delay
- **Network-assisted**: Routers provide feedback
**TCP Congestion Control Algorithm:**
**Slow Start:**
- cwnd starts at 1 MSS
- cwnd doubles each RTT until loss or threshold
- Exponential growth
**Congestion Avoidance:**
- cwnd increases by 1 MSS per RTT
- Linear growth (additive increase)
**Fast Recovery:**
- On 3 duplicate ACKs: cwnd = ssthresh + 3
- Multiplicative decrease on timeout
**TCP Tahoe vs Reno:**
- **Tahoe**: Always goes to slow start on loss
- **Reno**: Fast recovery on 3 duplicate ACKs
**Congestion Window Evolution:**
- **Sawtooth Pattern**: Linear increase, multiplicative decrease
- **Average Throughput**: ~0.75 × W/RTT (W = max window size)
---
## Unit 4: Network Layer - Data Plane
### 4.1 Network Layer Overview
**Network Layer Functions:**
- **Forwarding**: Move packets from input to output port
- **Routing**: Determine path from source to destination
**Data Plane vs Control Plane:**
- **Data Plane**: Per-router forwarding function
- **Control Plane**: Network-wide routing logic
### 4.2 Router Architecture
**Router Components:**
- **Input Ports**: Physical layer, link layer, lookup/forwarding
- **Switching Fabric**: Transfer packets from input to output
- **Output Ports**: Store and forward packets
- **Routing Processor**: Control plane functions
**Input Port Processing:**
- **Line Termination**: Physical layer
- **Link Layer Protocol**: Data link layer
- **Lookup/Forwarding**: Destination-based forwarding
**Switching Fabric Types:**
- **Memory**: Via system bus (slowest)
- **Bus**: Via shared bus
- **Crossbar**: Interconnection network (fastest)
**Output Port Processing:**
- **Queuing**: When arrival rate > transmission rate
- **Packet Scheduler**: FIFO, priority, weighted fair queuing
### 4.3 Internet Protocol (IP)
**IPv4 Header Format:**
- **Version** (4 bits): IP version
- **Header Length** (4 bits): 32-bit words
- **Type of Service** (8 bits): Priority, delay, throughput
- **Total Length** (16 bits): Header + data
- **Identification** (16 bits): Fragmentation
- **Flags** (3 bits): Don't fragment, more fragments
- **Fragment Offset** (13 bits): Fragment position
- **Time to Live** (8 bits): Max hops
- **Protocol** (8 bits): Upper layer protocol
- **Header Checksum** (16 bits): Error detection
- **Source Address** (32 bits): Sender IP
- **Destination Address** (32 bits): Receiver IP
**IPv4 Addressing:**
**Classful Addressing (Historical):**
- **Class A**: 1.0.0.0 to 126.0.0.0 (/8)
- **Class B**: 128.0.0.0 to 191.255.0.0 (/16)
- **Class C**: 192.0.0.0 to 223.255.255.0 (/24)
**CIDR (Classless Inter-Domain Routing):**
- **Format**: a.b.c.d/x (x = number of network bits)
- **Subnet Mask**: Network portion identification
- **Longest Prefix Matching**: Most specific route wins
**Subnetting Example:**
- Network: 192.168.1.0/24
- Subnet 1: 192.168.1.0/26 (hosts .1-.62)
- Subnet 2: 192.168.1.64/26 (hosts .65-.126)
- Subnet 3: 192.168.1.128/26 (hosts .129-.190)
- Subnet 4: 192.168.1.192/26 (hosts .193-.254)
**Special IP Addresses:**
- **Loopback**: 127.0.0.0/8
- **Private**: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
- **Link-Local**: 169.254.0.0/16
- **Multicast**: 224.0.0.0/4
- **Broadcast**: 255.255.255.255
**NAT (Network Address Translation):**
- **Purpose**: Share single IP among multiple hosts
- **NAT Table**: (internal IP, port) ↔ (external IP, port)
- **Problems**: Violates end-to-end principle, complicates P2P
### 4.4 IPv6
**IPv6 Motivation:**
- **Address Space**: 128-bit addresses (vs 32-bit IPv4)
- **Header Simplification**: Fixed 40-byte header
- **Flow Labeling**: Quality of service
- **Built-in Security**: IPSec integration
**IPv6 Header:**
- **Version** (4 bits): IP version (6)
- **Traffic Class** (8 bits): QoS
- **Flow Label** (20 bits): Flow identification
- **Payload Length** (16 bits): Data length
- **Next Header** (8 bits): Protocol type
- **Hop Limit** (8 bits): TTL equivalent
- **Source Address** (128 bits)
- **Destination Address** (128 bits)
**IPv6 Address Types:**
- **Unicast**: Single interface
- **Multicast**: Group of interfaces
- **Anycast**: Nearest of group
**IPv4 to IPv6 Transition:**
- **Dual Stack**: Run both protocols
- **Tunneling**: Encapsulate IPv6 in IPv4
- **Translation**: Convert between protocols
### 4.5 Generalized Forwarding (SDN)
**Traditional Forwarding:**
- **Destination-based**: Forward based on destination IP
- **Fixed Function**: Hardware-based lookup
**Generalized Forwarding:**
- **Flow-based**: Forward based on header fields
- **Programmable**: Software-defined rules
**OpenFlow Protocol:**
- **Flow Table**: Match + Action + Stats
- **Match Fields**: 12-tuple (IPs, ports, protocol, etc.)
- **Actions**: Forward, drop, modify, send to controller
- **Controller**: Centralized control plane
**SDN Benefits:**
- **Centralized Control**: Global network view
- **Programmability**: Custom forwarding logic
- **Separation**: Control plane from data plane
- **Innovation**: Rapid protocol development
---
## Unit 5: Network Layer - Control Plane
### 5.1 Routing Algorithms
**Graph Abstraction:**
- **Nodes**: Routers
- **Edges**: Physical links
- **Edge Costs**: Delay, congestion, monetary cost
**Routing Algorithm Classification:**
- **Global vs Decentralized**: Complete topology knowledge
- **Static vs Dynamic**: Route changes over time
- **Load-sensitive vs Load-insensitive**: Cost reflects traffic load
### 5.2 Link State Routing (Dijkstra's Algorithm)
**Algorithm Steps:**
1. **Initialization**: Distance to source = 0, others = ∞
2. **Find minimum**: Select unvisited node with minimum distance
3. **Update neighbors**: Relax edge weights
4. **Repeat**: Until all nodes visited
**Dijkstra's Complexity:**
- **Time**: O(n²) with simple implementation, O(n log n) with heap
- **Space**: O(n) for distance and predecessor arrays
**Link State Protocol Features:**
- **Flooding**: Broadcast link state to all routers
- **LSDB**: Link State Database at each router
- **SPF**: Shortest Path First calculation
- **Convergence**: Fast when topology changes
### 5.3 Distance Vector Routing
**Bellman-Ford Equation:**
- d_x(y) = min_v{c(x,v) + d_v(y)}
- Distance from x to y = minimum over neighbors v
**Distance Vector Algorithm:**
1. **Initialize**: Distance vector at each node
2. **Periodic Updates**: Send DV to neighbors
3. **Update**: Recalculate using Bellman-Ford
4. **Notify**: Send updates if changes occur
**Problems:**
- **Count-to-Infinity**: Bad news travels slowly
- **Routing Loops**: Temporary loops during convergence
- **Solution**: Split horizon, poison reverse
### 5.4 OSPF (Open Shortest Path First)
**OSPF Characteristics:**
- **Link State Protocol**: Uses Dijkstra's algorithm
- **Area Concept**: Hierarchical routing
- **Authentication**: Secure routing updates
- **Load Balancing**: Multiple equal-cost paths
**OSPF Areas:**
- **Backbone Area**: Area 0, connects all other areas
- **Regular Areas**: Connected to backbone
- **Stub Areas**: No external routes
- **NSSA**: Not-So-Stubby Areas
**LSA Types:**
- **Type 1**: Router LSA
- **Type 2**: Network LSA
- **Type 3**: Summary LSA
- **Type 4**: ASBR Summary LSA
- **Type 5**: External LSA
### 5.5 BGP (Border Gateway Protocol)
**BGP Purpose:**
- **Inter-domain Routing**: Between autonomous systems
- **Policy-based**: Economic and political considerations
- **Path Vector Protocol**: Maintains entire AS path
**BGP Attributes:**
- **AS-PATH**: Sequence of ASs through which route passed
- **NEXT-HOP**: IP address of next-hop router
- **LOCAL-PREF**: Degree of preference (higher = better)
- **MED**: Multi-Exit Discriminator (lower = better)
**BGP Route Selection:**
1. **Highest LOCAL-PREF**
2. **Shortest AS-PATH**
3. **Closest NEXT-HOP** (hot potato routing)
4. **Additional tie-breakers**
**BGP Loop Prevention:**
- **AS-PATH Attribute**: Contains list of ASs
- **Loop Detection**: Reject routes containing own AS number
**BGP Policy Examples:**
- **Customer-Provider**: Provider advertises customer routes
- **Peer-Peer**: Peers exchange customer routes
- **Valley-Free**: No provider pays another provider
### 5.6 SDN Control Plane
**SDN Architecture:**
- **Data Plane**: Network switches
- **Control Plane**: SDN controller
- **Management Plane**: Network operating system
**OpenFlow Protocol:**
- **Southbound API**: Controller to switch
- **Flow Tables**: Match-action rules
- **Reactive vs Proactive**: On-demand vs pre-installed rules
**SDN Controller Functions:**
- **Topology Discovery**: Learn network topology
- **Routing Calculations**: Compute paths
- **Flow Installation**: Program switch flow tables
- **Load Balancing**: Distribute traffic
**Benefits:**
- **Centralized Control**: Global optimization
- **Programmability**: Custom applications
- **Vendor Independence**: Open standards
### 5.7 Network Management
**SNMP (Simple Network Management Protocol):**
- **Manager**: Monitoring system
- **Agent**: Managed device
- **MIB**: Management Information Base
- **Operations**: GET, SET, TRAP
**SNMP Messages:**
- **GetRequest**: Retrieve variable value
- **SetRequest**: Set variable value
- **GetResponse**: Response to Get/Set
- **Trap**: Asynchronous notification
**Why UDP for SNMP:**
- **Simplicity**: Minimal overhead
- **Reliability**: Application-level retransmission
- **Efficiency**: Small message sizes
- **Availability**: Works during network problems
---
## Unit 6: Link Layer and LANs
### 6.1 Link Layer Introduction
**Link Layer Services:**
- **Framing**: Encapsulate network layer packets
- **Link Access**: Coordinate access to shared medium
- **Reliable Delivery**: Error detection and correction
- **Flow Control**: Pace between sender and receiver
- **Error Detection**: Detect bit errors in frames
- **Error Correction**: Correct bit errors
- **Half-duplex/Full-duplex**: Bidirectional communication
**Where is Link Layer Implemented:**
- **Network Interface Card (NIC)**: Hardware + software
- **Network Adapter**: Ethernet card, Wi-Fi card
### 6.2 Error Detection and Correction
**Error Types:**
- **Single Bit Error**: One bit flipped
- **Burst Error**: Multiple consecutive bits flipped
**Detection vs Correction:**
- **Detection**: Identify presence of errors
- **Correction**: Fix errors without retransmission
### Parity Checking
**Single Bit Parity:**
- **Even Parity**: Even number of 1s (including parity bit)
- **Odd Parity**: Odd number of 1s (including parity bit)
- **Detection**: Single bit errors only
**Two-Dimensional Parity:**
- **Row and Column Parity**: Arrange bits in matrix
- **Detection**: Single bit errors
- **Correction**: Single bit errors (locate intersection)
### Checksums
**1's Complement Checksum:**
1. **Sum**: Add all 16-bit words
2. **Wraparound**: Add carry to result
3. **Complement**: Flip all bits
4. **Check**: Add all words + checksum = all 1s
**Internet Checksum Algorithm:**
- Used in IP, TCP, UDP headers
- Relatively weak error detection
- Fast computation in software
### Cyclic Redundancy Check (CRC)
**CRC Process:**
1. **Generator**: Agreed upon r+1 bit pattern G
2. **Remainder**: R = remainder of (D×2^r) ÷ G
3. **Transmitted**: D concatenated with R
4. **Check**: (D||R) divisible by G
**CRC Properties:**
- **Detection**: All single bit errors
- **Detection**: All double bit errors
- **Detection**: Odd number of bit errors (if G has factor (x+1))
- **Detection**: All burst errors of length ≤ r
**Common CRC Standards:**
- **CRC-8**: 8-bit remainder
- **CRC-16**: 16-bit remainder
- **CRC-32**: 32-bit remainder (Ethernet, Wi-Fi)
### 6.3 Multiple Access Protocols
**Multiple Access Problem:**
- **Shared Medium**: Single broadcast channel
- **Collision**: Two or more simultaneous transmissions
- **Goal**: Coordinate access to avoid/handle collisions
**Protocol Categories:**
1. **Channel Partitioning**: Divide channel
2. **Random Access**: Allow collisions, recover
3. **Taking Turns**: Pass token or poll
### Channel Partitioning Protocols
**TDMA (Time Division Multiple Access):**
- **Time Slots**: Each node gets fixed time slot
- **Advantages**: No collisions, fair
- **Disadvantages**: Unused slots wasted
**FDMA (Frequency Division Multiple Access):**
- **Frequency Bands**: Each node gets frequency band
- **Advantages**: No collisions
- **Disadvantages**: Limited frequency spectrum
**CDMA (Code Division Multiple Access):**
- **Unique Codes**: Each sender assigned unique code
- **Advantages**: Simultaneous transmission
- **Applications**: Cellular networks
### Random Access Protocols
**ALOHA:**
- **Pure ALOHA**: Transmit immediately
- **Efficiency**: 18.4% maximum
- **Slotted ALOHA**: Synchronize to time slots
- **Efficiency**: 36.8% maximum
**CSMA (Carrier Sense Multiple Access):**
- **Listen Before Talk**: Sense channel before transmit
- **Collisions Still Possible**: Propagation delay
- **1-Persistent**: Always transmit when idle
- **p-Persistent**: Transmit with probability p
**CSMA/CD (Collision Detection):**
- **Listen While Talk**: Detect collisions during transmission
- **Jam Signal**: Alert other stations of collision
- **Binary Exponential Backoff**: Exponentially increase backoff time
- **Minimum Frame Size**: Ensure collision detection
**CSMA/CD Algorithm:**
1. **Sense**: Is channel idle?
2. **Transmit**: If idle, start transmission
3. **Collision Detection**: Monitor for collisions
4. **Jam**: If collision, send jam signal
5. **Backoff**: Wait random time, go to step 1
**CSMA/CA (Collision Avoidance):**
- **Used in Wi-Fi**: Can't detect collisions reliably
- **RTS/CTS**: Request to Send / Clear to Send
- **ACK**: Explicit acknowledgments
- **Backoff**: Random backoff before each transmission
### 6.4 Ethernet
**Ethernet Evolution:**
| Standard | Year | Speed | Cable | Max Distance |
|----------|------|-------|-------|--------------|
| **10BASE-T** | 1990 | 10 Mbps | UTP Cat3 | 100m |
| **100BASE-TX** | 1995 | 100 Mbps | UTP Cat5 | 100m |
| **1000BASE-T** | 1999 | 1 Gbps | UTP Cat5e | 100m |
| **10GBASE-T** | 2006 | 10 Gbps | UTP Cat6a | 100m |
**Ethernet Frame Format:**
- **Preamble** (8 bytes): Synchronization (10101010...)
- **Destination Address** (6 bytes): MAC address
- **Source Address** (6 bytes): MAC address
- **Type** (2 bytes): Higher layer protocol
- **Data** (46-1500 bytes): Payload
- **CRC** (4 bytes): Error detection
**MAC Addresses:**
- **48-bit**: Unique identifier (e.g., 1A-2F-BB-76-09-AD)
- **OUI**: Organizationally Unique Identifier (first 24 bits)
- **NIC**: Network Interface Card specific (last 24 bits)
- **Broadcast**: FF-FF-FF-FF-FF-FF
- **Multicast**: First bit = 1
### 6.5 Link Layer Switches
**Switch Functions:**
- **Learning**: Build MAC address table
- **Flooding**: Forward to all ports if unknown destination
- **Filtering**: Drop frames destined for same segment
- **Forwarding**: Send to specific port
**Switch Learning Algorithm:**
1. **Record**: Source MAC and input port
2. **Age**: Remove old entries
3. **Lookup**: Check destination in table
4. **Forward**: Send to appropriate port or flood
**Spanning Tree Protocol (STP):**
- **Purpose**: Prevent loops in switched networks
- **Root Bridge**: Elected based on lowest bridge ID
- **Port States**: Blocking, listening, learning, forwarding
- **BPDU**: Bridge Protocol Data Units
**VLANs (Virtual LANs):**
- **Purpose**: Logically separate broadcast domains
- **Trunk Links**: Carry multiple VLAN traffic
- **802.1Q**: VLAN tagging standard
- **Benefits**: Security, traffic management, flexibility
---
## Unit 7: Wireless and Mobile Networks
### 7.1 Wireless Networking Fundamentals
**Wireless Challenges:**
- **Signal Strength**: Decreases with distance
- **Interference**: Other sources in same frequency
- **Multipath Propagation**: Signal reflection/scattering
- **Hidden Terminal**: Can't detect all collisions
**Wireless Network Elements:**
- **Wireless Hosts**: Laptops, smartphones
- **Base Station**: Access point, cell tower
- **Wireless Link**: Radio spectrum connection
### 7.2 Wi-Fi (802.11 Wireless LANs)
**802.11 Architecture:**
- **BSS (Basic Service Set)**: Wireless hosts + AP
- **ESS (Extended Service Set)**: Multiple interconnected BSSs
- **Ad Hoc Network**: No access point
**802.11 Standards:**
| Standard | Year | Frequency | Max Speed | Range |
|----------|------|-----------|-----------|-------|
| **802.11a** | 1999 | 5 GHz | 54 Mbps | ~35m |
| **802.11b** | 1999 | 2.4 GHz | 11 Mbps | ~100m |
| **802.11g** | 2003 | 2.4 GHz | 54 Mbps | ~100m |
| **802.11n** | 2009 | 2.4/5 GHz | 600 Mbps | ~70m |
| **802.11ac** | 2013 | 5 GHz | 6.93 Gbps | ~35m |
| **802.11ax** | 2019 | 2.4/5/6 GHz | 9.6 Gbps | ~35m |
**802.11 Frame Structure:**
- **Frame Control** (2 bytes): Frame type, flags
- **Duration** (2 bytes): Time to transmit frame
- **Address Fields**: Up to 4 MAC addresses
- **Sequence Control** (2 bytes): Fragment/sequence numbers
- **Data**: Payload (0-2312 bytes)
- **CRC** (4 bytes): Error detection
**802.11 MAC Protocol (CSMA/CA):**
1. **DIFS**: Distributed Inter-Frame Space wait
2. **Random Backoff**: If channel busy
3. **Transmission**: Send frame
4. **SIFS**: Short Inter-Frame Space
5. **ACK**: Acknowledgment frame
**RTS/CTS Protocol:**
- **Purpose**: Solve hidden terminal problem
- **RTS**: Request to Send (small frame)
- **CTS**: Clear to Send (broadcast response)
- **Collision Avoidance**: Reserves channel
**802.11 Power Management:**
- **Sleep Mode**: Node can sleep
- **Beacon Frames**: AP announces sleeping nodes
- **TIM**: Traffic Indication Map
### 7.3 Cellular Networks
**Cellular Concept:**
- **Cell**: Geographic area served by base station
- **Frequency Reuse**: Same frequencies in distant cells
- **Handoff**: Transfer between cells
- **Roaming**: Service outside home network
**1G Networks:**
- **Technology**: Analog, FDMA
- **Service**: Voice only
- **Example**: AMPS (Advanced Mobile Phone System)
**2G Networks:**
- **Technology**: Digital, TDMA/CDMA
- **Services**: Voice, SMS, low-speed data
- **Examples**: GSM, IS-95 CDMA
**3G Networks:**
- **Technology**: CDMA-based
- **Services**: Voice, data up to 2 Mbps
- **Examples**: UMTS/WCDMA, CDMA2000
**4G/LTE Networks:**
- **Technology**: OFDMA, all-IP
- **Services**: High-speed data (100+ Mbps)
- **Architecture**: Evolved Packet Core (EPC)
**5G Networks:**
- **Technology**: Massive MIMO, mmWave
- **Services**: Ultra-low latency, IoT, enhanced mobile broadband
- **Speeds**: Up to 20 Gbps
### 7.4 Mobility Management
**Mobility Challenges:**
- **Addressing**: How to find mobile user?
- **Routing**: How to route to mobile user?
- **Handoff**: Seamless connectivity during movement
**Mobile IP (IPv4):**
- **Home Network**: Permanent network
- **Foreign Network**: Visited network
- **Home Agent**: Router in home network
- **Foreign Agent**: Router in foreign network
- **Care-of-Address**: Temporary address in foreign network
**Mobile IP Process:**
1. **Registration**: Mobile node registers with foreign agent
2. **Tunneling**: Home agent tunnels packets to care-of-address
3. **Delivery**: Foreign agent delivers to mobile node
4. **Reverse**: Direct routing or via home agent
**GSM Mobility Management:**
- **HLR (Home Location Register)**: User's home database
- **VLR (Visitor Location Register)**: Current location database
- **MSC (Mobile Switching Center)**: Call switching
- **Authentication**: Challenge-response with shared secret
---
## Key Formulas and Calculations
### Delay Calculations
**Transmission Delay:**
```
d_trans = L / R
where: L = packet length (bits), R = transmission rate (bps)
```
**Propagation Delay:**
```
d_prop = d / s
where: d = distance (m), s = propagation speed (m/s)
```
**Total Delay:**
```
d_total = d_proc + d_queue + d_trans + d_prop
```
**Round-Trip Time (RTT):**
```
RTT = 2 × d_prop (assuming negligible other delays)
```
### Throughput Calculations
**Throughput:**
```
Throughput = min(R1, R2, ..., Rn) for bottleneck link
```
**File Transfer Time:**
```
Transfer Time = File Size / Throughput
```
### Queuing Theory
**Traffic Intensity:**
```
ρ = λa / μ = La / R
where: λ = arrival rate, a = avg packet size, μ = service rate, R = link capacity
```
**Average Queue Length (M/M/1):**
```
L = ρ / (1 - ρ)
```
**Average Waiting Time (M/M/1):**
```
W = ρ / (μ(1 - ρ))
```
### TCP Congestion Control
**TCP Throughput Approximation:**
```
Throughput ≈ (3/4) × (MSS / RTT) × (1 / √p)
where: MSS = maximum segment size, p = loss probability
```
**TCP Sawtooth Average:**
```
Average Window = (3/4) × W_max
where: W_max = maximum window size before loss
```
### Subnet Calculations
**Number of Subnets:**
```
Number of Subnets = 2^n
where: n = number of borrowed bits
```
**Number of Hosts per Subnet:**
```
Hosts per Subnet = 2^h - 2
where: h = number of host bits, -2 for network and broadcast
```
**Subnet Address Range:**
```
Network Address = IP & Subnet Mask
Broadcast Address = Network Address | (~Subnet Mask)
First Host = Network Address + 1
Last Host = Broadcast Address - 1
```
### Error Detection
**1's Complement Checksum:**
1. Sum all 16-bit words
2. Add carry to result
3. Take 1's complement
4. Append to data
**CRC Polynomial Division:**
```
Transmitted = Data || CRC
where: CRC = remainder of (Data × 2^r) ÷ Generator
```
### Wireless Calculations
**Path Loss (Free Space):**
```
Path Loss (dB) = 20 log10(d) + 20 log10(f) + 32.44
where: d = distance (km), f = frequency (MHz)
```
**Signal-to-Noise Ratio:**
```
SNR (dB) = 10 log10(Signal Power / Noise Power)
```
**Shannon Capacity:**
```
C = B log2(1 + SNR)
where: C = capacity (bps), B = bandwidth (Hz)
```
---
## Protocol Comparison Tables
### Transport Protocols
| Feature | TCP | UDP |
|---------|-----|-----|
| **Connection** | Connection-oriented | Connectionless |
| **Reliability** | Reliable, ordered delivery | Unreliable, no ordering |
| **Flow Control** | Yes (sliding window) | No |
| **Congestion Control** | Yes | No |
| **Header Size** | 20-60 bytes | 8 bytes |
| **Speed** | Slower (overhead) | Faster (minimal overhead) |
| **Applications** | HTTP, FTP, SMTP, SSH | DNS, DHCP, streaming, games |
### Routing Protocols
| Aspect | Link State (OSPF) | Distance Vector (RIP) | Path Vector (BGP) |
|--------|-------------------|----------------------|------------------|
| **Algorithm** | Dijkstra's | Bellman-Ford | Path vector |
| **Convergence** | Fast | Slow | Slow |
| **Scalability** | Good (areas) | Poor | Excellent |
| **Loop Prevention** | SPF tree | Split horizon | AS-PATH |
| **Metric** | Cost | Hop count | Policy-based |
| **Updates** | Event-triggered | Periodic | Incremental |
### Ethernet Standards
| Standard | Speed | Cable | Distance | Collision Domain |
|----------|-------|-------|-----------|-----------------|
| **10BASE-T** | 10 Mbps | Cat3 UTP | 100m | Per segment |
| **100BASE-TX** | 100 Mbps | Cat5 UTP | 100m | Per segment |
| **1000BASE-T** | 1 Gbps | Cat5e UTP | 100m | Per link |
| **10GBASE-T** | 10 Gbps | Cat6a UTP | 100m | Per link |
### Wi-Fi Standards
| Standard | Frequency | Max Speed | Range | MIMO |
|----------|-----------|-----------|-------|------|
| **802.11n** | 2.4/5 GHz | 600 Mbps | 70m | 4×4 |
| **802.11ac** | 5 GHz | 6.93 Gbps | 35m | 8×8 |
| **802.11ax** | 2.4/5/6 GHz | 9.6 Gbps | 35m | 8×8 |
### Multiple Access Protocols
| Protocol | Efficiency | Delay | Complexity | Use Case |
|----------|------------|-------|------------|----------|
| **TDMA** | High | Low | Medium | Cellular |
| **FDMA** | High | Low | Medium | Radio |
| **CSMA/CD** | Medium | Variable | Low | Ethernet |
| **CSMA/CA** | Low | High | Medium | Wi-Fi |
---
## Common Exam Topics
### Calculation Problems
1. **Delay and Throughput**
- Calculate transmission, propagation, and total delay
- Determine bottleneck links and end-to-end throughput
- File transfer time calculations
2. **Subnet Design**
- CIDR notation and subnet masks
- Number of subnets and hosts
- IP address ranges and broadcast addresses
3. **TCP Performance**
- Congestion window evolution
- Throughput estimation
- Connection establishment time
4. **Checksum Calculations**
- 1's complement arithmetic
- Error detection probability
- Two-dimensional parity
5. **Routing Algorithm Execution**
- Dijkstra's shortest path
- Distance vector updates
- BGP path selection
### Conceptual Questions
1. **Protocol Comparison**
- TCP vs UDP characteristics
- Circuit vs packet switching
- Link state vs distance vector routing
2. **Network Architecture**
- OSI vs Internet protocol stack
- Client-server vs P2P applications
- SDN vs traditional networking
3. **Error Control**
- Detection vs correction
- ARQ protocols (Stop-and-wait, Go-back-N, Selective Repeat)
- Forward error correction
4. **Multiple Access**
- Hidden and exposed terminal problems
- CSMA/CD vs CSMA/CA
- Random access vs controlled access
5. **Wireless Networking**
- Wi-Fi architecture and protocols
- Cellular network evolution
- Mobility management
### Design Problems
1. **Network Topology Design**
- Subnet planning and addressing
- Router placement and configuration
- QoS and traffic engineering
2. **Protocol Selection**
- Application requirements analysis
- Transport protocol choice
- Routing protocol selection
3. **Performance Optimization**
- Bottleneck identification
- Capacity planning
- Load balancing strategies
### Security Considerations
1. **Network Attacks**
- DoS and DDoS attacks
- Man-in-the-middle attacks
- Packet sniffing and spoofing
2. **Security Mechanisms**
- Encryption and authentication
- Firewalls and intrusion detection
- VPNs and secure tunneling
---
## Final Exam Preparation Tips
### Study Strategy
1. **Review assignments** - Your completed assignments cover key exam topics
2. **Practice calculations** - Master delay, throughput, and subnetting problems
3. **Understand protocols** - Know when and why different protocols are used
4. **Create comparison tables** - Organize similar technologies and protocols
5. **Draw diagrams** - Visualize network architectures and protocol operations
### Key Areas to Focus
1. **Fundamentals** (Unit 1): Delay calculations, throughput, switching
2. **Application Layer** (Unit 2): HTTP, DNS, P2P file sharing
3. **Transport Layer** (Unit 3): TCP reliability and congestion control
4. **Network Layer** (Units 4-5): IP addressing, routing algorithms
5. **Link Layer** (Unit 6): Error detection, Ethernet, switching
6. **Wireless** (Unit 7): Wi-Fi protocols, cellular networks
### Problem-Solving Approach
1. **Read carefully** - Identify what's given and what's asked
2. **Draw diagrams** - Visualize the network or protocol operation
3. **Show work** - Step-by-step calculations with units
4. **Check answers** - Verify reasonableness and units
5. **Explain reasoning** - Justify protocol choices and design decisions
**Good luck with your final exam!**
|