Skip to main content

Computer Network Notes

By ยท ยท 4 min read

Computer Network Notes

๐Ÿ“ฅ assignment

๐Ÿ“ฅ assignment 1

๐Ÿ“ฅ UNIT 4

๐Ÿ“ฅ UNIT 3

๐Ÿ“ฅ UNIT 1

Understanding Computer Networks

A computer network is a collection of interconnected computers that share resources and communicate with each other. Networks are essential infrastructure for modern computing, from local office networks to the global internet.

Network Goals:

  • Share resources (files, printers, internet)
  • Enable communication (email, video calls, messaging)
  • Provide computing power through distributed systems
  • Ensure reliability and redundancy

Network Models

OSI Model (7 Layers)

Layer 7: Application Layer
โ”œโ”€ Protocols: HTTP, HTTPS, FTP, SMTP, POP3, DNS
โ”œโ”€ Services: Email, web browsing, file transfer

Layer 6: Presentation Layer
โ”œโ”€ Data encryption, compression, translation
โ”œโ”€ Formats: SSL/TLS encryption

Layer 5: Session Layer
โ”œโ”€ Manages connections between applications
โ”œโ”€ Example: Login sessions, call setup

Layer 4: Transport Layer (TCP/UDP)
โ”œโ”€ Protocols: TCP (reliable), UDP (fast)
โ”œโ”€ Concepts: Ports (80, 443, 22), connections

Layer 3: Network Layer (Routing)
โ”œโ”€ Protocols: IP (IPv4, IPv6)
โ”œโ”€ Devices: Routers
โ”œโ”€ Concepts: IP addressing, routing tables

Layer 2: Data Link Layer
โ”œโ”€ Protocols: Ethernet, Wi-Fi
โ”œโ”€ Devices: Switches, bridges
โ”œโ”€ Concepts: MAC addresses, frames

Layer 1: Physical Layer
โ”œโ”€ Hardware: Cables (fiber, copper), wireless
โ”œโ”€ Concepts: Voltage, wireless frequencies

TCP/IP Model (Simplified - 4 Layers):

  1. Application (HTTP, SMTP, DNS)
  2. Transport (TCP, UDP)
  3. Internet (IP routing)
  4. Link (Ethernet, Wi-Fi)

Network Protocols

TCP vs UDP

TCP (Transmission Control Protocol) - Reliable

Characteristics:
- Connection-oriented (establish before sending)
- Guaranteed delivery (no data loss)
- Ordered delivery (arrives in order)
- Slower (extra overhead for reliability)
- Used for: Email, file transfer, web browsing

Example:
Client connects to server
Data sent reliably
Client disconnects

UDP (User Datagram Protocol) - Fast

Characteristics:
- Connectionless (no setup)
- No delivery guarantee
- Fast (minimal overhead)
- Used for: Video streaming, online gaming, DNS

Example:
Send packet without connection
Fire and forget

Common Protocols

HTTP/HTTPS (Web):

Port: 80 (HTTP), 443 (HTTPS)
Purpose: Transfer web pages
Method: GET (retrieve), POST (submit)
Status codes: 200 (OK), 404 (Not Found), 500 (Error)

DNS (Domain Name System):

Purpose: Translate domain names to IP addresses
Query: What's the IP of google.com?
Response: 142.251.174.102

SMTP/POP3 (Email):

SMTP: Send mail (port 25, 587)
POP3: Receive mail (port 110)
IMAP: Advanced mail (port 143)

FTP (File Transfer):

Purpose: Transfer files between computers
Port: 21
Example: Upload website files to server

IP Addressing

IPv4 (32-bit address)

Notation: 192.168.1.1

Binary: 11000000 . 10101000 . 00000001 . 00000001
         11000000    10101000      00000001    00000001
              64  +       168   +        1  +         1

Address Classes:
Class A: 1.0.0.0 to 126.255.255.255     (Large networks)
Class B: 128.0.0.0 to 191.255.255.255   (Medium networks)
Class C: 192.0.0.0 to 223.255.255.255   (Small networks)

Private IP ranges (can't reach internet):
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

Subnetting

Network: 192.168.1.0/24
         192.168.1.0 - 192.168.1.255 (256 addresses)
         
Subnet mask: 255.255.255.0 (first 24 bits = network)

Example breakdown:
192.168.1.0   = Network address
192.168.1.1   = Router (gateway)
192.168.1.2-254 = Usable hosts
192.168.1.255 = Broadcast address

IPv6 (128-bit address)

Format: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Advantages over IPv4:
- Larger address space (340 undecillion addresses)
- Better security (IPSec built-in)
- Auto-configuration
- Simplified header

Network Devices

Router

Purpose: Directs packets between networks
Function: Reads IP addresses, forwards packets
Example: Home WiFi router connects your devices to ISP

Switch

Purpose: Connects devices within same network
Function: Forwards frames based on MAC addresses
Faster than router (local network only)

Gateway

Purpose: Connects two different network types
Example: Convert from Ethernet to WiFi

Firewall

Purpose: Security - blocks unwanted traffic
Function: Inspects packets, applies rules
Rules: Allow/deny based on IP, port, protocol

Network Architectures

LAN (Local Area Network)

Distance: Single building or campus
Speed: 100 Mbps - 1 Gbps
Example: Office network connected via Ethernet
Devices: Computers, printers, servers in building

WAN (Wide Area Network)

Distance: Multiple cities/countries
Speed: 1 Mbps - 100 Mbps
Example: Internet, branch offices connected
Technology: Leased lines, MPLS, VPN

Wireless Networks

Wi-Fi (802.11):

Standards: 802.11a, 802.11b, 802.11g, 802.11n, 802.11ac
Frequencies: 2.4 GHz, 5 GHz
Range: 30-100 meters
Speed: 11 Mbps to 1+ Gbps
Security: WEP, WPA, WPA2, WPA3

Cellular (4G/5G):

4G LTE: 100 Mbps download
5G: 1+ Gbps download
Used by: Mobile phones, IoT devices

Network Layering & Addressing

Complete path from Application to Physical:

Application
  (HTTP request to google.com)
           โ†“
DNS lookup: google.com โ†’ 142.251.174.102
           โ†“
Transport Layer: TCP port 443
           โ†“
Network Layer: Add IP header with destination 142.251.174.102
           โ†“
Data Link: Add MAC address header
           โ†“
Physical: Convert to electrical signals
           โ†“
Cable/WiFi transmission
           โ†“
(Reverse at destination)

Network Security

Threats

Malware:

  • Virus: Replicating code attached to programs
  • Worm: Standalone replicating code
  • Trojan: Looks benign but contains malicious code

Attacks:

DDoS (Distributed Denial of Service):
- Flood server with requests
- Server can't respond to legitimate users

Man-in-the-Middle:
- Intercept communication between two parties
- Read or modify data in transit

Phishing:
- Trick users into revealing credentials
- Fake login pages, emails

Security Solutions

Encryption:

HTTPS (SSL/TLS):
- Encrypts data in transit
- Ports 443 (web)
- Protects against eavesdropping

Firewall:

Rules: Allow port 80, 443 (web)
       Block port 23 (telnet)
       Block suspicious IPs

VPN (Virtual Private Network):

Purpose: Encrypt all traffic through VPN server
Anonymous: Hide your IP address
Secure: Protect on public Wi-Fi

Troubleshooting Network Issues

Check Connectivity:

ping google.com              # Test if host is reachable
tracert google.com          # See route packets take
ipconfig /all               # Check IP configuration
netstat -an                 # Show active connections

Common Issues:

No Internet:
1. Check router is on
2. Check cables/Wi-Fi connected
3. Run ipconfig to verify IP
4. Ping gateway (usually 192.168.1.1)
5. Ping DNS server (8.8.8.8)

Slow Network:
1. Run speed test (speedtest.net)
2. Check if many devices connected
3. Check Wi-Fi signal strength
4. Restart router
5. Check for malware

DNS Issues:
1. Can't reach by domain (google.com)
2. But can reach by IP (8.8.8.8)
3. Solution: Change DNS to 8.8.8.8 or 1.1.1.1

Key Network Concepts Summary

Concept Definition Example
IP Address Unique computer identifier 192.168.1.1
MAC Address Physical device identifier 00:1A:2B:3C:4D:5E
Port Application endpoint 80 (HTTP), 443 (HTTPS)
Protocol Communication rules TCP, UDP, HTTP
Bandwidth Data transfer capacity 100 Mbps
Latency Time for data to travel 20 ms
Throughput Actual data transfer rate 80 Mbps (in practice)