Network + : Part 1

Hello, I'm Sheheryar Altaf, a BSCS student at COMSATS University Islamabad. Passionate about computer science, I'm dedicated to mastering Object-Oriented Programming (OOP), Data Structures and Algorithms (DSA), and databases.
I have practical experience in projects like the Voting Management System database, where I've applied these skills hands-on.
I'm eager to tackle new challenges and continuously expand my knowledge and skills in computer science. Here's to excelling in my studies and embracing endless possibilities!
Network Topologies:
Hybrid Topology
A combination of different topologies.
Example: Star-Bus (a star topology connected by a bus).
Star-Ring (a star topology connected by a ring).
Star Topology
Central location = Access Point.
Clients connect to the server instead of each other.
Each device connects to a central hub or switch.
Bus Topology
Not used today
All devices connected to a single cable.
Devices share the same communication line.
Peer-to-Peer (P2P) Topology
Each client can communicate directly with every other client.
No central server; resources are shared among peers.
Point-to-Point
- Direct connection using a single cable between two hosts.
Point-to-Multipoint
A central wireless base station, known as an access point, connects to multiple clients.
Clients do not communicate with each other directly.
Client-server: Clients connect to the server rather than to each other, and data can be called when needed.
Network Components
Connectors:
RJ11: Used for telephone connections. Small in size
Modems with computers.
RJ45: Commonly used to connect LAN.
Twisted pair cables.
NIC to Hubs/Switches:
Connectors and Cabling
RJ-48c Connector:
- Similar to RJ-45, it uses twisted pair cable.
UTP Coupler:
Used for connecting UTP cables with RJ-45 connectors.
Provides a simple way to extend cable lengths.
Fiber Optic Coupler:
Joins two fiber optic cables together.
Connectors: ST, SC connectors.
FireWire Connector:
- A D-shaped connector typically used for peripherals like digital cameras and printers.
UPC vs. APC Connectors
UPC (Ultra Physical Contact):
Flat polished end face.
Some light reflection; good for general use.
APC (Angled Physical Contact):
Angled end face (8 degrees).
Significantly reduces light reflection; ideal for high-performance applications.
Fiber Optic Converter:
Converts signals between fiber optic and other types of media.
Can be latched for secure connections and has push-pull functionality.
Applications:
Single Mode Fiber: Designed for long-distance transmission; uses APC connectors to minimize signal loss.
Multi-Mode Fiber: Often used in building networks, can utilize various types of connectors.
Cable Standards
Plenum Space:
Area in a building with open air circulation, often between the drop ceiling and the structural ceiling.
Plenum-rated cables are used here because they are fire-resistant and emit fewer toxic fumes.
Cable Standards:
Various standards dictate speed and performance.
Examples include:
100Base-T: 100 Mbps, baseband transmission, standard for Ethernet networking.
Fiber/SR: Short-range fiber connections.
Firewalls
Types of Firewalls:
Host-Based Firewalls: Software firewalls installed on individual devices.
Network-Based Firewalls: Hardware or software solutions that protect the entire network.
Firewalls control and protect network traffic.
They inspect incoming and outgoing traffic to enforce security policies.
Traffic Control:
Firewalls can allow or block specific types of traffic based on rules defined in ACLs (Access Control Lists).
They play a critical role in preventing unauthorized access to the network.
Combination Solutions:
- Some setups may use a combination of hardware and software firewalls for enhanced security.
Access Control Lists (ACLs)
Definition:
ACLs define rules for what IP addresses can access the network.
Can either allow or deny traffic based on specified criteria.
Implicit Deny:
- By default, all traffic is blocked. Specific rules must be added to allow traffic.
Rules:
ACLs are set up to allow certain IPs and deny all others.
Must be configured to manage network traffic effectively.
Ethernet over networking: Adds networking capability to HDMI cables (e.g., HDMI 1.4).
Stateful Firewalls
Functionality:
Stateful firewalls monitor all connections and data streams passing through the network.
They maintain a state table to keep track of active connections and their status.
Uses connection information coming from applications.
Protects the network dynamically.
Stateless Firewalls
Work on ACLs.
Do not inspect data packets thoroughly; they only look into the header.
Do not keep a record of previous data packets.
Intrusion Detection and Prevention Systems (IDS/IPS)
IDS monitors traffic and alerts administrators about suspicious activities.
IPS actively prevents attacks by analyzing data packets and identifying threats.
Content Filtering
Email Filtering:
Filters are based on content to identify and block spam or malicious emails.
Can detect known virus behaviors and patterns to prevent malware.
Wiring Standards
TIA Wiring Standards:
568A/568B: Standards developed by the Telecommunications Industry Association (TIA) that define how twisted cables should be wired.
RJ-45 Connectors: Common connectors used for Ethernet cables.
Cable Types:
Straight-Through Cables: Wired according to TIA standards, typically used to connect different devices like switches to computers. Both ends are wired using the same standard.
Crossover Cables: Ends are wired using different standards, used to connect similar devices directly (e.g., switch to switch).
straight-through cables connect different devices, while crossover cables connect similar devices.
Signature Identification:
Detect viruses by well-known behavior.
Helps detect and manage known virus patterns through programmed behavior recognition.
If spotted, it takes action to block it.
Networking Components
Cable Types:
Crossover Cable: Wiring is configured differently at each end. Connects similar devices.
Rollover Cables
What They Are: Cables where one end is a mirror image of the other.
Wiring Example: If pin 1 connects to pin 8 on one end, pin 8 connects to pin 1 on the other.
Main Use: Connect a computer to a router or switch for configuration and management.
Media Converter:
Converts between different media types (e.g., fiber to Ethernet).
Useful for connecting various devices like routers and switches.
Loopback Testing:
- Tests network connections by routing signals back to the source (127.0.0.1).
Cable Standards:
UTP (Unshielded Twisted Pair): Most common type; consists of 4 pairs of unshielded wires.
STP (Shielded Twisted Pair): Similar to UTP but includes shielding for better protection against interference.
Coaxial Cables:
RG-6: Used for networking/TV; suitable for longer distances.
RG-59: Used for HD/HQ video; suitable for shorter distances.
DOCSIS (Data Over Cable Service Interface Specification):
- Standard for broadband modems to handle audio, video, and voice signals.
Hub: Multiple ports, accepts Ethernet connections from multiple devices.
Active Devices:
- Require power to operate.
Passive Devices:
- Do not require power; typically used for simple connections.
Switches
Types of Switches:
Regular Switch (Layer 2): Operates at the data link layer; stores MAC addresses in a table.
Layer 3 Switch: Interprets Layer 3 data (network layer) similar to routers.
Functionality:
Switches manage and direct data traffic within the network.
They are crucial for efficient data transfer and connectivity.
SMF (Single Mode Fiber): Long distance; single angle.
MMF (Multi-Mode Fiber): Short distance; multiple angles.
Media Converter
Converts different media types in a network, like fiber to Ethernet or coaxial.
SMF to MMF.
Network Concepts
Load Balancing / Advanced Filtering:
- Distributes traffic evenly across multiple devices to prevent overload and ensure efficient use of resources.
Power over Ethernet (PoE):
- Allows devices to receive power through Ethernet cables, eliminating the need for separate power plugs.
Bridges:
- Divide a network into separate collision domains, reducing unnecessary traffic. Based on MAC address. Bridge contains MAC addresses of NICs connected to it.
Spanning Tree Protocol (STP)
Problem:
- Multiple paths between devices can slow down the network.
Solution:
Function: STP is a fault-tolerant protocol that prevents broadcast traffic loops.
How It Works: It identifies and disables redundant paths in the network.
Key Benefits:
Single Active Path: Ensures only one active path exists between two devices, avoiding traffic loops and congestion.
Switch Communication: Allows switches to communicate and resolve loops if they occur in the network.
Collision Domain: A network segment where data packets can collide; bridges help isolate these domains.
Broadcast Traffic: Network traffic sent to all devices within a network segment; must be managed to avoid unnecessary congestion.
Routers:
Route traffic based on IP addresses.
If data is intended for its own network, the router keeps it; otherwise, it sends the data to the appropriate destination.
Networking Components
Router:
Filters and directs incoming data to the appropriate location.
Acts as a gateway, connecting different networks and translating data formats when necessary.
Gateway:
A device that connects two networks and also connects networks with different or incompatible communication protocols.
Changes the format of the data without changing the data itself.
Wireless Access Point (WAP):
A wireless hub that connects wireless devices to a wired network.
Acts as a bridge, relaying data between wired and wireless devices.
CSU/DSU (Channel Service Unit/Data Service Unit):
Converts data from a LAN format to a WAN format, allowing communication over LAN and WAN as they use different formats.
Connects computers to transmit data over incompatible communication protocols (e.g., from LAN to WAN).
Converts data formats for transmission.
Modem: Converts digital data (computer) to analog data (telephone line).
Wireless Technology
Standards: IEEE: International organization for the advancement of technology.
802.11: Refers to wireless networking standards (e.g., A, B, G, N, AC) used for different Wi-Fi technologies.
IR (Infrared): Uses infrared light waves for short-range communication, requiring a direct line of sight. Means below red. Uses rays of light other than radio waves.
Network Interface Card (NIC):
A circuit board with a network adapter installed on your computer.
Each NIC has a unique MAC address assigned by the manufacturer.
IRDA (Infrared Data Association):
- Standard for wireless communication using infrared light, typically in devices like remote controls.
Transceivers
Definition: Devices designed to transmit and receive data efficiently.
Purpose: Optimized for wireless communication (e.g., Wi-Fi, Bluetooth).
Functionality: Convert signals and ensure reliable communication.
Wireless Communication:
- Involves radio waves for data transmission, allowing devices to communicate without physical connections.
MAC address: Assigned by the manufacturer, contains numbers and alphabets (A-F).
OSI Model
Application Layer:
Purpose: Facilitates communication between applications.
Protocols: HTTP, FTP, etc.
Function: Data is presented in a format that users can read.
Presentation Layer:
Function: Converts data formats and performs data encryption/decryption , compression.
Processes:
Data encoding (e.g., ASCII, JPEG).
Compression and decompression of data.
Ensures data is readable by the application layer.
Session Layer:
Function: Establishes, manages, and terminates connections between applications.
Example: Remote Procedure Call (RPC) for communication.
Transport Layer:
Function: Responsible for the transport of data between systems.
Protocols: TCP (reliable) and UDP (unreliable).
Processes: flow control , error control , reliability
Segments data into packets.
Ensures packets are reassembled correctly and retransmits if necessary.
Network Layer:
Function: Manages the delivery of packets based on IP addresses.
Protocols: ARP, ICMP, IP.
Process: Determines the best path for data to travel to its destination.
Data Link Layer:
Function: Prepares data for transmission over the physical layer.
Processes:
Framing: Creates frames for data packets.
Error detection and correction.
Uses MAC address.
Data packets decoded into bits.
Flow control and synchronization.
Direct communication between devices on the same network.
Examples: Wi-Fi, Ethernet.
Physical Layer:
Function: Transmits raw bits over the physical medium.
Processes:
Converts data into electrical, optical, or radio signals.
Manages the physical connection between devices.
Additional Concepts
MAC Address: A unique identifier assigned to network interfaces for communications on the physical network.
Example: 00-44-5A-63-A1-66.
First 3 bytes: Manufacturer (e.g., Netgear).
Last 3 bytes: Unique number from the manufacturer.
Network Traffic Management: Involves controlling and optimizing data flow across the network to prevent congestion.
IP Addressing and Network Standards
IP Address:
Every device on a network must have a unique IP address.
IPv4: Consists of 32 bits, typically represented in four octets (e.g., 192.168.1.1).
The number range is from 0 to 255.
Classful IP Addressing:
Class A:
Range: 1.0.0.0 to 126.0.0.0.
Default Subnet Mask: 255.0.0.0.
Supports 16 million hosts.
Class B:
Range: 128.0.0.0 to 191.255.0.0.
Default Subnet Mask: 255.255.0.0.
Supports 65,000 hosts.
Class C:
Range: 192.0.0.0 to 223.255.255.0.
Default Subnet Mask: 255.255.255.0.
Supports 254 hosts.
Loopback Address: 127.0.0.1 is used for loopback testing.
Subnet Masks:
Define the network and host portions of an IP address.
Examples of subnet masks:
Class A: 255.0.0.0.
Class B: 255.255.0.0.
Class C: 255.255.255.0.
IPv6 Addressing:
Uses 128 bits, represented in eight groups (16 bits each).
Supports a vastly larger number of addresses (340 undecillion).
Example Format: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
IP Address Distribution:
IANA: Internet Assigned Numbers Authority manages global IP address distribution.
RIRs: Regional Internet Registries allocate IP addresses to ISPs of region.
Binary Representation:
The subnet mask is represented in binary, where a "1" indicates the network portion.
For example, the subnet mask for Class C (255.255.255.0) in binary is 11111111.11111111.11111111.00000000.
Private IP Ranges
Class A: 10.0.0.0 to 10.255.255.255.
Class B: 172.16.0.0 to 172.31.255.255.
Class C: 192.168.0.0 to 192.168.255.255.
Subnetting
Purpose: Divides a large network into smaller, more manageable sub-networks (subnets).
Benefit: Reduces excessive broadcast traffic and makes it easier to pinpoint network issues.
Subnetting Example
Class B IP Address: Supports approximately 65,000 hosts.
If a network has 3,000 devices, subnetting can help manage the network more efficiently.
How Subnetting Works
Borrowing Bits
To create subnets, you change the default subnet mask by borrowing bits from the host portion. These borrowed bits are used to create the subnets.
Formula: (2^n - 2), where (n) is the number of bits borrowed from the host portion.
Example: Suppose you want to divide a network into 3 subnets. You need at least 3 subnets, so you set (n = 3). This gives you (2^3 - 2 = 6) subnets, which is sufficient.
Custom Subnet Mask
If the original subnet mask is 255.255.0.0 (Class B):
11111111 11111111 00000000 00000000Borrow bits from the host portion to create a custom subnet mask. For example, if you borrow 3 bits, the new subnet mask could be 255.255.224.0 (binary: 11111111.11111111.11100000.00000000).
Calculating Hosts
Remaining bits for hosts in the customized subnet mask:
Total bits (32) - network bits (19) = host bits (13)Number of hosts per subnet:
2^13 - 2 = 8190 hosts per subnetDHCP and IP Addressing
Dynamic Host Configuration Protocol (DHCP)
Automatically assigns IP addresses to devices on a network.
Static IP: IP addresses change only if the user decides to change them.
Self-Assigned IP Addresses
If a device cannot reach the DHCP server, it assigns itself an IP address in the range of 169.254.0.0 to 169.254.255.255, known as Automatic Private IP Addressing (APIPA). This allows the device to connect to others on the same network. When the DHCP server becomes available again, the device will update its IP address accordingly.
DHCP Relay
If the DHCP server is on a different subnet, DHCP relay is enabled on the router. The relay agent receives DHCP broadcast messages and forwards them to the DHCP server, allowing devices on different subnets to receive IP addresses from the DHCP server.
Scope of DHCP
The range of IP addresses that the DHCP server can assign.
Reservations: Specific IP addresses reserved for particular devices (e.g., printers, servers) that require the same IP address consistently. Reservations are given with the help of MAC addresses.
DHCP Lease
An IP address is leased to a device for a specified duration (e.g., days or hours). The lease duration can vary based on network settings and requirements.
Subnetting
Helps organize a large network into smaller, manageable segments. Without subnetting, excessive broadcast traffic can occur, complicating network management.
Protocols
TCP (Transmission Control Protocol)
Connection-oriented protocol.
Ensures reliable data transmission through acknowledgment (ACK) packets.
Guarantees that data is delivered correctly.
UDP (User Datagram Protocol)
Connectionless protocol.
Known as "fire and forget," it does not guarantee delivery or order.
Often used for applications where speed is more critical than reliability (e.g., streaming).
Network Protocols
FTP (File Transfer Protocol)
Uses TCP for reliable file transfer.
Allows users to upload and download files over a network.
TFTP (Trivial File Transfer Protocol)
Uses UDP.
Designed for simple file transfers within a local network.
Less secure than FTP; no authentication.
SFTP (Secure File Transfer Protocol)
An extension of FTP that uses SSH for secure data transfer.
Ensures data is encrypted and not sent in clear text.
Telnet
Allows remote access to servers via command-line interface.
Transmits data in clear text, making it less secure.
Mainly used within local networks.
SMTP (Simple Mail Transfer Protocol)
Used for sending emails.
Connection-oriented; if an email fails to send, a non-delivery message is returned.
POP3 (Post Office Protocol v3)
Used to retrieve emails from a server.
Downloads emails and usually deletes them from the server after retrieval.
No synchronization across devices.
IMAP (Internet Message Access Protocol)
Allows users to manage emails directly on the server.
Keeps emails synchronized across multiple devices.
ARP (Address Resolution Protocol)
Resolves IP addresses to MAC addresses.
Used when a device on a network needs to communicate with another device.
Sends a broadcast message to find the MAC address associated with an IP address.
Steps:
Internal look for ARP cache to find MAC address.
Broadcast message on the network to find which device has that IP address.
The device with the IP address responds.
The original device requests the MAC address, and once received, communication takes place and the address is saved in the cache.
RARP (Reverse ARP)
The opposite of ARP.
Resolves a MAC address to its corresponding IP address.
HTTP
- Used for viewing web pages.
Network Ports
Ports are logical connections used by programs to exchange information, identified by unique numbers ranging from 0 to 65535.
Well-Known Ports (0-1023)
- HTTP: Port 80 (used for web traffic)
Registered Ports (1024-49151)
- MySQL: Port 3306 (used for MySQL database connections)
Dynamic or Private Ports (49152-65535)
- Ephemeral Ports: Port 49152 (often used for temporary client-side connections)
Commonly used ports include:
FTP: 20, 21
SSH: 22
Telnet: 23
SMTP: 25
DHCP: 67 (server), 68 (client)
POP3: 110
IMAP: 143
SNMP: 161
NTP: 123 (Network Time Protocol)
Network Time Protocol (NTP)
Synchronizes the clocks of devices across a network. Uses time servers (often maintained by organizations like the U.S. Naval Observatory, universities, big companies) to ensure all devices show the same time. Devices connect to an NTP server regularly (every few hours or days) to maintain accurate time.
Additional Protocols
SSH (Secure Shell)
Provides a secure channel over an unsecured network to transfer data.
SCP (Secure Copy Protocol)
Utilizes SSH to securely transfer files between devices.
SNMP (Simple Network Management Protocol)
Monitors and manages devices on a network, allowing for data collection from various devices.
Network Address Translation (NAT)
PAT (Port Address Translation)
A form of NAT that maps multiple private IP addresses to a single public IP address using different ports. This helps conserve IP addresses and enhances security.
Unique Port Numbers and IP Addresses
Each device on a network is also issued a unique port number along with its IP address. This helps external data packets know which device they want to communicate with.
Port Address Translation (PAT)
Definition: A special type of NAT (Network Address Translation).
Purpose: Allows multiple devices to share a single public IP address.
How it Works:
PAT uses unique port numbers to direct traffic to the correct devices.
This enables efficient communication while conserving IP addresses.
PAT usually lies on the router and is commonly used in home offices.
Static Network Address Translation (SNAT)
Definition: Links a public IP address to a private IP address permanently.
Use Case: Typically used in larger organizations for managing IP address assignments.
Benefits:
- Efficiency: PAT and SNAT improve IP address management and enhance network security.
Proxy Services
Function: Similar to a web browser, when you visit a website, your browser stores its own cache to retrieve it faster next time. This is stored on a proxy web server.
Benefit: Speed and bandwidth savings.
Process:
When you visit a website, your browser sends a request to the proxy.
The proxy finds the webpage and returns it to your browser.
Frequently accessed web pages are stored in the proxy's cache for quicker retrieval.
Broadcasting and Unicast
Broadcasting: A single transmitter sends data to all devices in the network.
Unicast: Data is sent to a specific device.
Multicast: Data is sent to multiple destinations simultaneously.
Collision Management
CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
Used in wired networks to manage data transmission and avoid collisions. Devices listen for traffic before sending data. If the wire is idle, only then does it send data to avoid collision. If two devices send data at the same time, a collision occurs.
CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)
Used in wireless networks to avoid collisions by sensing the channel before transmitting. If a device wants to send data, it will send a small data packet to ensure the channel is clear before sending the main data.
Routing Protocols
Routing Table: A set of rules that shows the path data packets take to reach their destination. When a device wants to send data, it sends a small data packet first. The router checks its routing table to find the best path to the destination. If the channel is clear, it then sends the main data packet.
Loopback Interface
Definition: A virtual interface created on a router. Assigned an IP address to test and manage network configurations. Helps avoid collisions and enables testing without physical hardware.
Router Functions
Routing Table: Contains the IP addresses of destinations and determines the best path for data packets.
Gateway: The point through which data is forwarded to another network. The gateway tells the router which IP to forward to.
Interface: The outgoing IP of the device that is sending the IP address.
Hop: The IP address to which the data is forwarded.
Metric: A value used to determine the best route; can be based on distance (number of hops) or other factors.

