Computer - Networks - CS301 Notes
Computer - Networks - CS301 Notes
The Internet is a global network of computers that are connected to each other. It allows people to share
information and communicate over long distances.
Computer Networks
A group of interconnected device that share resources and communicate with each other.
Nodes
Devices connected to a network which are capable of sending/receiving data generated by other
devices/nodes in the network.
End Nodes
Intermediary Nodes
Devices like routers or switches that help route data between end nodes.
Communication Links
Physical or wireless connections that carry data between nodes.
Wired Links
Wireless Links
Characteristics of CN
Fault Tolerant
Scalability
Notes 1
Security
Important Terms in CN
Hosts/End Users - Devices that interact with the network, generating and receiving data.
Routers - Devices that forward data packets between networks, directing traffic efficiently.
Switches - Devices that connect multiple devices on a local network, forwarding data only to the intended
recipient.
Hub - A basic device that connects multiple Ethernet devices, broadcasting data to all connected devices.
Servers - Powerful computers that provide data or services to other computers (clients) over the network.
Switches - Connect devices within a local network and direct data to specific destinations.
Hub - Connects multiple devices and sends incoming data packets to all connected devices.
Packet Switches
Devices like that forward data packets between nodes to their destination.
Packed Data Units (PDUs) - A structured unit of data that is transmitted over a network.
Packet - A formatted unit of data carried by a packet-switched network, containing both header and
payload.
Frame - A data packet at the data link layer, encapsulating packets with additional header and trailer
information.
Segment - A unit of data at the transport layer, representing a portion of the data stream, often
associated with TCP.
Datagram - A basic transfer unit associated with the network layer, often used in connectionless
communication protocols like UDP.
Notes 2
Packet Switching vs Circuit Switching
1. Packet Switching - Data is broken into packets and each packet is sent independently through the
network. These packets may take different paths to the destination and are reassembled at the
destination.
Key Characteristics:
Efficiency: Better bandwidth utilization as resources are used only when data is transmitted.
2. Circuit Switching - A dedicated communication path or circuit is established between the sender and
receiver for the duration of the communication session.
Key Characteristics:
Fixed routing: A dedicated path is established and reserved for the entire communication session.
Exclusive use: The path remains reserved for the connection, even if no data is being transmitted.
Path Dynamic, packets may take different routes Fixed, dedicated path for the entire session
Half-Duplex
Two-way communication where data can flow in both directions, but not simultaneously.
Ex: Walkie-Talkies.
Duplex
Notes 3
Ex: Telecommunication.
Types of Network
1. Peer-to-Peer Network - A decentralized network where each device (peer) can act as both a client and a
server, allowing direct sharing of resources.
Each peer can share files, printers, and other resources directly.
Easy to set up and maintain, flexible and scalable for small networks, less/no dependency on a central
server.
Limited security and control, difficult to manage in larger networks as there is less
control/dependency on a central server.
2. Client-Server Network - A centralized network architecture where clients request resources and services
from a dedicated server.
Advantages
It has better organization and management and can be easily scaled to large-scale application.
Enhanced security and control over data and resources, easier to manage and maintain with
centralized administration.
Disadvantages
Requires more complex setup and administration and its expensive to setup & maintain.
Access Networks
The network that physically connects an end system to the first router
(also known as edge router) on a path from the end system to any other distant end system.
MAC Address
A MAC address is a unique identifier assigned to a device's network interface card (NIC).
It is used to facilitate communication at the Data Link Layer (Layer 2) of the OSI model.
Notes 4
It plays a crucial role in local network communication, ensuring that data packets are delivered to the
correct device within a network.
OUI (Organizationally Unique Identifier): The first 24 bits (or first 3 bytes) represent the OUI, which is
assigned by the IEEE to the manufacturer.
NIC-Specific: The last 24 bits (or last 3 bytes) are specific to the device and are assigned by the
manufacturer.
The LSB (Least Significant Bit) of the first byte of the MAC address determines whether it is unicast
or multicast:
This means the first byte's binary value must end with a 0 (even numbers in hexadecimal).
Example:
Hex: 00:1A:2B:3C:4D:5E
2. Multicast Address - Used to send data to multiple devices, often in a specific group, but not to all devices
on the network.
This means the first byte's binary value must end with a 1 (odd numbers in hexadecimal).
Example:
3. Broadcast Address
Purpose: Used to send data to all devices in the same network segment.
Special Format: The MAC address for broadcast communication is always FF:FF:FF:FF:FF:FF .
All bits of this address are set to 1 in binary, indicating it is intended for all devices on the network.
Example:
Hex: FF:FF:FF:FF:FF:FF
Notes 5
Binary: 11111111 11111111 11111111 11111111 11111111 11111111
Broadcast Address N/A (all bits 1) FF:FF:FF:FF:FF:FF Sends data to all devices in the network.
Switching: Switches, which operate at Layer 2, use MAC addresses to make forwarding decisions. They
maintain a MAC address table that maps each MAC address to the corresponding physical port.
Address Resolution Protocol (ARP): When a device wants to communicate with another device, it may
know the IP address but not the MAC address. The ARP protocol is used to map an IP address to a MAC
address by sending an ARP request.
Static MAC Address: This is the permanent, factory-assigned address programmed into the NIC. It is
globally unique and used for identification on a network.
Dynamic MAC Address: Sometimes a device can alter its MAC address through MAC address
spoofing. This is typically done for privacy purposes or to bypass MAC address filters in certain
networks.
Device Tracking: MAC addresses can be used to track devices on a network. Because MAC addresses
are unique to each device, they can serve as an identifier for monitoring network activity.
MAC Address Spoofing - The practice of altering the MAC address on a network interface to assume the
identity of another device. This is often done to bypass MAC-based access control measures.
Learning Process: When a switch receives a frame, it learns the source MAC address and the port it
arrived on, updating the table.
When it needs to forward a frame, the switch looks up the destination MAC in this table to determine
which port to send the frame to.
Aging: Entries in the MAC address table are typically temporary, with an aging timer that removes inactive
entries after a certain period.
IP Address
Notes 6
An IP address is a unique numerical identifier assigned to each device connected to a network that uses
the Internet Protocol (IP) for communication.
It operates at the Network Layer (Layer 3) of the OSI model and is essential for routing data packets
between different networks.
Format of IP Address
1. IPv4 Address
Structure
Host Address - Identifies the specific device (host) within that network.
2. IPv6 Address
Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 .
Interface Identifier: Identifies the specific interface (host) within the network.
Example: 2001:0db8::8a2e:0370:7334 .
IPv4 Examples:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
2. Public IP Address
Purpose: Globally unique, routable on the Internet, and assigned by the Internet Service Provider
(ISP).
Notes 7
1. Dynamic IP Address
2. Static IP Address
Permanent, often used for servers, printers, and devices requiring consistent addressing.
A unicast IP address is assigned to a single device, and data sent to this address is intended for that
specific device only.
Usage:
Used for one-to-one communication, where a source sends data directly to a single destination.
Address Range:
Example:
A user sending an email to another user, where the email is routed directly to the intended
recipient's device.
2. Multicast IP Address
A multicast IP address is used to send data to a group of devices that are interested in receiving the
information.
Data is sent to a specific group of devices without sending it to all devices on the network, which saves
bandwidth.
Usage
Common in one-to-many communication, especially in streaming video, real-time data updates, and
conferencing.
Only the devices that are part of the multicast group will process the data.
Notes 8
Address Range:
Example:
Streaming a live event to multiple viewers where the data is transmitted only to users subscribed to
that multicast group.
3. Broadcast IP Address
A broadcast IP address is used to send data to all devices within the same network segment or broadcast
domain.
It is used in scenarios where information needs to be shared with every device in a local network.
Usage - One-to-all communication where a message is sent to every device in the same local network.
Address Range:
IPv4: 255.255.255.255 is the broadcast address for all devices in a local network. In subnets, a more
specific broadcast address is used (e.g., 192.168.1.255 for the 192.168.1.0/24 subnet).
Example:
DHCP uses broadcast to discover and assign IP addresses to new devices joining a network.
IPv4 Limited Brodcast - 255.255.255.255 (broadcast to all devices, not forwarded by router).
Protocol
A set of rules and conventions for communication between network devices.
A protocol defines the format and the order of message exchanged between two or more communicating
entities, as well as the action taken on the transmission or reception of a message or other event
Elements of Protocol
Message Encoding - The process of converting data into a specific format for transmission.
Message Formatting and Encapsulation - Structuring the message and enclosing it with necessary
headers and trailers for proper interpretation.
Message Timing - The control of the timing of message transmission to ensure synchronization between
sender and receiver.
Message Size - Specifies the maximum size of a message to be transmitted over the network.
Notes 9
Unicast - One-to-one communication
Functions: Mail services, directory services, file transfer and access management.
Devices/Tools:
2. Presentation Layer - Translates data between the application layer and the network. It handles data
formatting, encryption, and compression, making it the translation layer.
Functions: Translation (converting data into a common format), encryption (security purpose),
compression (compressing long-duration videos and high-resolution images).
3. Session Layer - Establishes, manages, and terminates sessions between applications. It is responsible for
authentication, security, dialog control, and synchronization.
Protocols: RPC (Remote Procedure Call), NetBIOS, PPTP, SAP (Session Announcement Protocol).
4. Transport Layer - Provides reliable data transfer and error recovery. It ensures complete data transfer,
manages flow control, and adds source and destination port numbers to the segmented data.
Functions: Port addressing, segmentation and reassembly, connection control, end-to-end flow
control, error control.
Protocols: TCP (connection-oriented, used for reliable data transmission), UDP (connectionless, used
for real-time traffic).
Notes 10
5. Network Layer - Responsible for routing and forwarding data packets between different networks. It
delivers data from the original source to the destination using IP addresses and takes care of packet
routing.
6. Data Link Layer - Provides node-to-node data transfer and error detection. It frames data packets for
transmission and is divided into Logical Link Control (LLC) and Media Access Control (MAC).
Functions: Framing, physical addressing, flow control, error control, access control.
Protocols: Ethernet, PPP, Frame Relay, HDLC, 802.11 (Wi-Fi), MAC address.
7. Physical Layer - Deals with the physical transmission of data over network media. It includes the
transmission of raw bitstreams and provides electrical and mechanical specifications.
Functions: Physical characteristics of the medium (wired or wireless), synchronization of bits, bit rate
control, physical topologies (star, bus, or mesh connection), transmission mode (duplex, half-duplex,
full-duplex).
Devices/Tools: Cables (e.g., Fiber Optic, Coaxial, Twisted Pair), Connectors (e.g., RJ-45, SC, LC),
Repeaters, Modems.
TCP/IP Protocol
1. Application Layer - Provides protocols for specific data communication services. It enables users to
access network resources and facilitates communication between applications over the network.
2. Transport Layer - Manages end-to-end communication and data delivery. It ensures that data is sent and
received correctly while providing reliable or unreliable delivery.
Functions: Segmentation and reassembly, flow control, error detection and correction.
Notes 11
3. Network/Internet Layer - Responsible for logical addressing and routing of data packets across
networks. It manages packet forwarding and routing through intermediate routers.
4. Data Link Layer - Manages node-to-node data transfer and facilitates communication within local
networks. It ensures error-free data transmission and regulates access to the physical medium.
Notes 12
Processing Delay (𝑑𝑝𝑟𝑜𝑐)
The time taken by a router or switch to process the packet header and determine where to forward the
packet.
High-speed routers usually experience processing delays on the order of microseconds or less.
The level of congestion at the router affects the queue length, thereby influencing the waiting time.
$$
\text{Traffic Intensity (TI)} = \frac{Length\;of\;Packet\;(in\; bits)\;\times
\;Av.\;Rate\;of\;Packet\;Arrival\;(in \;packets/sec)}{Transmission\;Rate\;(bits/sec)}
$$
$$
d_{prop} = \frac{d}{s}
$$
Processing Delay Time to process packet header and forwarding decision Microseconds
Queueing Delay Time waiting in queue before transmission Varies (depends on congestion)
Transmission Delay Time to push all bits of the packet onto the link Milliseconds to Microseconds
Propagation Delay Time for signal to travel to the next router Depends on distance and medium
Packet Loss
Notes 13
Packet loss refers to the failure of one or more transmitted packets to reach their destination. It is a
common issue in computer networks, particularly in those that rely on packet-switching technologies.
If the queue is full, then any new packet arriving at the router will be lost or dropped.
$$
\text{Packet Loss (\%)} = \left( \frac{\text{Number of Lost Packets}}{\text{Total Packets Sent}} \right) \times
100
$$
Data-Link Layer
Notes 14