Computer Networks
Syllabus
UNIT I: Introduction
Types of Computer Networks, Reference Models- The OSI Reference Model, The TCP/IP Reference Model, A Critique of the OSI Model and Protocols, A Critique of the TCP/IP Reference Model. Network Devices.
UNIT II: The Data Link Layer
Transmission Media- Guided and Un-guided media, Data Link Layer Design Issues, Services Provided to the Network Layer, Error detecting and Error Correcting codes, Elementary Data Link Protocols, Sliding Window Protocols, HDLC, PPP. Multiple Access Protocols: Wired LAN – Ethernet, Fast Ethernet, Gigabit Ethernet.
UNIT III: The Network Layer
Network Layer Design Issues, Routing Algorithms, Congestion, Congestion control algorithms. The Network Layer in the Internet, IPv6, The IPv4 Protocol, IP Addresses- Classful, CIDR, NAT, IP Version 6 Protocol, Transition from IPV4 to IPV6.
UNIT IV: The Transport Layer
The Transport Layer Services, Transport Layer Protocols: UDP, TCP and SCTP
UNIT V: The Application Layer
The World Wide Web, HTTP, Domain Name Space, Remote Login, Electronic Mail and File Transfer
LAB Syllabus:
1. Study of Network devices in detail and connect the computers in Local Area Network.
2. Write a Program to implement the data link layer framing methods such as
i) Character stuffing ii) Bit stuffing.
3. Write a Program to implement data link layer framing method checksum.
4. Write a program for Hamming Code generation for error detection and correction.
5. Write a Program to implement on a data set of characters the three CRC polynomials – CRC 12, CRC 16 and CRC CCIP.
6. Write a Program to implement Sliding window protocol for Goback N.
7. Write a Program to implement Sliding window protocol for Selective repeat.
8. Write a Program to implement Stop and Wait Protocol.
9. Write a program for congestion control using leaky bucket algorithm
10. Write a Program to implement Dijkstra‘s algorithm to compute the Shortest path through a graph.
11. Write a Program to implement Distance vector routing algorithm by obtaining routing table at each node (Take an example subnet graph with weights indicating delay between nodes).
12. Write a Program to implement Broadcast tree by taking subnet of hosts.
13. Wireshark
i. Packet Capture Using Wireshark
ii. Starting Wireshark
iii. Viewing Captured Traffic
iv. Analysis and Statistics & Filters.
14. How to run Nmap scan
15. Operating System Detection using Nmap
16. Do the following using NS2 Simulator
i. NS2 Simulator – Introduction
ii. Simulate to Find the Number of Packets Dropped
iii. Simulate to Find the Number of Packets Dropped by TCP/UDP
iv. Simulate to Find the Number of Packets Dropped due to Congestion
v. Simulate to Compare Data Rate & Throughput.
Syllabus: Overview
Unit-I Material:
I. Types of Computer Networks
II. Reference Models- The OSI Reference Model, The TCP/IP Reference Model
III. A Critique of the OSI Model and Protocols
IV. A Critique of the TCP/IP Reference Model
V. Internet History
- Developed by ISO for standardizing protocols (Open Systems Interconnection)
- Seven layers, each with a specific function
- Physical Layer: Transmits raw bits, handles signals, timing, connectors
- Data Link Layer: Ensures error-free transmission via frames, acknowledgments
- Data Link includes Medium Access Control (MAC) for shared channels
- Network Layer: Manages packet routing, congestion, heterogeneous network interconnects
- Transport Layer: End-to-end delivery, splits data, ensures correct arrival
- Session Layer: Manages sessions, dialog control, token management, synchronization
- Presentation Layer: Handles data syntax/semantics, standard encoding
- Application Layer: Supports user applications (e.g., HTTP, FTP, SMTP)
- Developed for ARPANET, focuses on robust internetworking
- Four layers: Link, Internet, Transport, Application
- Link Layer: Interfaces hosts with transmission links (e.g., Ethernet)
- Internet Layer: Uses IP protocol for packet delivery across networks
- Internet Layer supports connectionless communication, routing, congestion
- Transport Layer: TCP (reliable, connection-oriented), UDP (unreliable, fast)
- TCP ensures error-free delivery; UDP prioritizes speed (e.g., video streaming)
- Application Layer: Includes protocols like HTTP, FTP, SMTP, DNS, RTP
- Designed to survive hardware failures for continuous communication
- No session or presentation layers, unlike OSI
- The OSI model appeared after the TCP/IP protocol suite.
- Most experts were at first excited and thought that the TCP/IP protocol would be fully replaced by the OSI
- model.
- (a) OSI was completed when TCP/IP was fully in place and a lot of time and money had been spent on the suite; changing it
- would cost a lot.
- (b) some layers in the OSI model were never fully defined. For example, although the services provided by the presentation and the session layers were listed in the document, actual protocols for these two layers were not fully defined, nor were they fully described, and the corresponding software was not fully developed.
- (c) OSI was implemented by an organization in a different application --> did not show high performance --> they switched back to TCP/IP
- Bad Timing: Standardized too late, after TCP/IP adoption in academia
- Bad Technology: Complex model/protocols, seven layers (some underutilized)
- Session and presentation layers have minimal functionality
- Data Link and Network layers overloaded with addressing, error control
- Bad Implementations: Initial OSI systems were slow, unwieldy
- Complexity caused poor performance, harming OSI’s reputation
- Bad Politics: Seen as government-driven, not researcher-friendly
- OSI protocols not widely adopted, though model remains useful
- Convergence sublayers added to fix mismatches with real networks
- Limited focus on internetworking, assumed single national networks
- Does not distinguish services, interfaces, and protocols clearly
- Model is TCP/IP-specific, not generalizable (e.g., unsuitable for Bluetooth)
- Link Layer: More an interface than a true layer, lacks detail
- Internet Layer: Effective for IP delivery, weak in congestion control
- Transport Layer: Offers TCP (reliable) or UDP (fast), unlike OSI’s single mode
- Model built after protocols, ensuring fit but limiting flexibility
- Lacks session/presentation layers, leaving functions to applications
- Strong in practice due to robust protocols (e.g., TCP, IP, HTTP)
- Benefited from high-quality Berkeley UNIX implementation
- Large user community drove improvements and adoption
* 1950s to 1960s --> Telephone and Telegraphs --> Circuit Switched
* Mid 1906s --> ARPANET (Advanced Research Projects Agency Network ) by US DoD (Department of Defense) developed specialized computer called IMP (interface message processor (IMP); Each IMP had to be able to communicate with other IMPs; Software called the Network Control Protocol (NCP) provided com
munication between the hosts;
Birth of Internet:
* a new version of NCP --> transmission control protocol (TCP)
* TCP into two protocols: Transmission Control Protocol (TCP) and Internet Protocol (IP).
* IP would handle datagram routing
* TCP would be responsible for higher level functions such as segmentation, reassembly, and error.
* ARPANET = ARPANET (non-military) + MILNET (Military Network)
* CSNET (Computer Science Network) by NSF (National Science Foundation); No Redundancy; Slower transmission rate;
* NSFNET(National Science Foundation Network)connected five supercomputer centers; ARPANET was replaced by NSFNET;
* ANSNET(Advanced Network Services Network) replaced the NSFNET (unable to handle high traffic); Three companies (IBM, Merit, and Verizon) = formed the non-profit organization called the ANSNET.
Internet Today:
World Wide Web (WWW) this added commercial applications, Multimedia, Peer-to-Peer applications
Unit-1 Imp Questions/ ClassTest-Q/ Model Quiz
Q1. Explain about the importance of Internet and its history.
Q2. Critique the OSI reference model
Q3. Compare the OSI and TCP/IP reference models
Q4. Critique the TCP/IP reference model
Q5. What is computer network? Explain about LAN, WAN, MAN and Internetwork.
Model Quiz Questions
Q1. Mention any three types of computer networks.
Q2. List out any two phylosophical points for each model. (TCP/IP reference model and OSI reference model)
Q3. Full form of TCP/IP
Q4. Full form of OSI in OSI reference model and its significance.
Q5. Full form of ARPANET and its significance.
Q6. What is peer-to-peer communication.
Unit-2 Imp Questions/ ClassTest-Q/ Model Quiz
Q1. Explain about Coaxial pair cable, Twisted pair cable and fiber optic cable and unguided media. Analyze the advantages ofone overthe other.
Q2. Describe the services provided by Data Link Layer.
Q3. Define PPP. Describe in detail with a neat diagram.
Q4. Explain the purpose of cladding in optical fiber.
Q6. Compare any three Multiple Access protocols
Q7.
CN Lab Programs
Bit Stuffing
# Experiment2b BitStuffing with user input and full-frame stuffing
def bit_stuffing(data):
stuffed = '01111110'
count = 0
for bit in data:
stuffed += bit
if bit == '1':
count += 1
if count == 5:
stuffed += '0' # Stuff a 0 after five 1s
count = 0
else:
count = 0
return stuffed+'01111110'
def bit_unstuffing(stuffed):
unstuffed = ''
count = 0
i = 8
while i < len(stuffed)-8:
bit = stuffed[i]
unstuffed += bit
if bit == '1':
count += 1
if count == 5:
i += 1 # Skip stuffed 0
count = 0
else:
count = 0
i += 1
return unstuffed
# --- Runtime input ---
data = input("Enter the binary data to be stuffed (including delimiters if any): ")
stuffed_bits = bit_stuffing(data)
unstuffed_bits = bit_unstuffing(stuffed_bits)
print("\nOriginal Bits: ", data)
print("Stuffed Bits: ", stuffed_bits)
print("Unstuffed Bits: ", unstuffed_bits)
Character Stuffing
def character_stuffing(data, flag='F', esc='E'):
stuffed_data = flag # Start with the flag
for char in data:
if char == flag or char == esc:
stuffed_data += esc # Insert escape BEFORE special char
stuffed_data += char
stuffed_data += flag # End with the flag
return stuffed_data
def character_unstuffing(stuffed_data, flag='F', esc='E'):
unstuffed_data = ''
i = 1 # Skip starting flag
while i < len(stuffed_data) - 1:
if stuffed_data[i] == esc:
i += 1 # Skip the escape character
unstuffed_data += stuffed_data[i]
i += 1
return unstuffed_data
# --- Runtime input ---
data = input("Enter the data to be stuffed: ")
flag = input("Enter the flag character (delimiter): ")
esc = input("Enter the escape character: ")
stuffed = character_stuffing(data, flag, esc)
unstuffed = character_unstuffing(stuffed, flag, esc)
print("\nOriginal Data: ", data)
print("Stuffed Data: ", stuffed)
print("Unstuffed Data: ", unstuffed)
Checksum
Hamming Code
CRC
Sliding Window Protocol for GO Back N
SWP for selective Repeat
Stop and Wait
ab
LeakyBucket Alg
ab
Dijkstras
ab
Distance Vector Routing
ab
Broadcast Tree
ab
Credits:
Andrew S. Tanenbaum - Computer Networks
Data-Communications-and-Network-5e- Behrouz-A.Forouzan