[go: up one dir, main page]

0% found this document useful (0 votes)
19 views38 pages

Networking and Data

The document provides an overview of Digital Subscriber Line (DSL) technology as an access network, explaining its function in connecting subscribers to service providers using existing copper telephone lines. It details how DSL operates through frequency division multiplexing, DSL modems, and DSLAMs, contrasting it with cable networks that utilize hybrid fiber-coaxial systems. Additionally, it outlines the structure of home networks and the layers of the TCP/IP model, emphasizing the role of HTTP in web communication.

Uploaded by

Rashed Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views38 pages

Networking and Data

The document provides an overview of Digital Subscriber Line (DSL) technology as an access network, explaining its function in connecting subscribers to service providers using existing copper telephone lines. It details how DSL operates through frequency division multiplexing, DSL modems, and DSLAMs, contrasting it with cable networks that utilize hybrid fiber-coaxial systems. Additionally, it outlines the structure of home networks and the layers of the TCP/IP model, emphasizing the role of HTTP in web communication.

Uploaded by

Rashed Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Digital Subscriber Line (DSL) as an Access Network

What is an Access Network?

First, let's briefly define an access network. An access network is the part of a
telecommunications network that connects subscribers (like you, at home or in your office) to
their immediate service provider. It's the "last mile" or "local loop" that brings the internet, phone,
or TV service to your premises.

What is DSL?

DSL (Digital Subscriber Line) is a technology that provides internet access by transmitting digital
data over the standard copper telephone lines that already exist in most homes and businesses.
It's a way of getting broadband internet using the same wires your landline phone uses, but
without interfering with your phone calls.

Key Concepts and How it Works:

1.​ Utilizing Existing Infrastructure: The most significant advantage and defining
characteristic of DSL is its use of the Public Switched Telephone Network (PSTN)'s
existing copper twisted-pair wiring. This means no new cabling needs to be laid to your
home, which made it a popular and relatively inexpensive option for broadband
deployment.
2.​ Frequency Division Multiplexing (FDM): This is crucial to how DSL works. DSL uses
different frequency bands for different purposes on the same copper wire:
○​ Voice (POTS - Plain Old Telephone Service): Uses a very low frequency band
(typically 0-4 kHz).
○​ Upstream Data: Uses a higher frequency band for data going from your home to
the internet (e.g., uploading files, sending emails).
○​ Downstream Data: Uses an even higher frequency band for data coming from
the internet to your home (e.g., Browse websites, streaming videos).
○​ Because these frequencies don't overlap, you can use your phone and the
internet simultaneously without interference.
3.​ DSL Modem: At your home, you need a DSL modem. This device modulates and
demodulates the digital signals so they can travel over the analog copper lines and then
be converted back into digital signals for your computer.
4.​ DSLAM (Digital Subscriber Line Access Multiplexer): At the other end, typically at
the telephone company's central office (CO) or a local exchange, there's a DSLAM. The
DSLAM aggregates the DSL lines from many subscribers and separates the voice traffic
from the data traffic. The data traffic is then routed to the internet service provider's (ISP)
network, while voice traffic goes to the PSTN.

Access Network: Cable Network


Key Concepts and How it Works:

1.​ Hybrid Fiber-Coaxial (HFC) Network: This is the most important concept to understand
about modern cable networks. They are not purely coaxial cable.
○​ Fiber Optic Backbone: From the Internet Service Provider's (ISP) core network,
high-capacity fiber optic cables run to neighborhood distribution hubs called
Optical Nodes. These fiber segments provide very high bandwidth and reliability.
○​ Coaxial Cable Last Mile: From the Optical Node, coaxial cables branch out to
individual homes and businesses. This "last mile" is typically coaxial, which is
why it's called "cable internet."
2.​ Shared Access Network: This is a critical distinction from DSL.
○​ Homes Share the Coaxial Segment: Unlike DSL, where each subscriber
typically has a dedicated copper pair back to the central office (or DSLAM), in a
cable network, a single coaxial cable segment is shared by a group of homes in a
neighborhood.
○​ Bandwidth Sharing: This means that the total bandwidth available on that
coaxial segment is shared among all active users in that segment. If many users
are actively downloading or uploading at the same time, the available bandwidth
per user can decrease, leading to slower speeds during peak usage hours. This
is often referred to as a "contention ratio."
3.​ Cable Headend:
○​ This is the central facility of the cable operator. It's where the signals for TV
channels, internet data, and phone services originate, are processed, and then
sent out over the HFC network.
○​ The headend contains crucial equipment like the CMTS (Cable Modem
Termination System).
4.​ CMTS (Cable Modem Termination System):
○​ This is the equivalent of a DSLAM for cable networks.
○​ Located at the cable headend (or sometimes distributed closer to the optical
nodes), the CMTS is responsible for communicating with all the cable modems in
subscribers' homes.
○​ It modulates and demodulates data signals, manages bandwidth allocation, and
routes internet traffic between the subscribers' cable modems and the ISP's core
network.
5.​ Cable Modem:
○​ At the subscriber's home, a cable modem (like your DSL modem) is required.
This device converts the digital signals from your computer into signals suitable
for transmission over the coaxial cable and vice-versa.
6.​ Frequency Division Multiplexing (FDM):
○​ Similar to DSL, cable networks also use FDM to carry different types of services
(TV, internet, phone) over the same coaxial cable by assigning them different
frequency bands.
○​ They also use different frequency ranges for upstream (upload) and downstream
(download) data. Typically, downstream speeds are much higher than upstream
speeds (asymmetric).

Key Differences from DSL (as highlighted in your prompt):

●​ Infrastructure:
○​ Cable: Uses a Hybrid Fiber-Coaxial (HFC) network. Fiber to the optical node,
then coaxial to the home.
○​ DSL: Uses the existing copper twisted-pair telephone lines directly from the
central office/DSLAM to the home.
●​ Sharing Model:
○​ Cable: Homes share the access network (specifically, the coaxial segment)
back to the cable headend/CMTS. This means bandwidth is shared among
neighbors.
○​ DSL: Each home generally has a dedicated copper pair (local loop) to the
central office/DSLAM. While the DSLAM itself is shared, the physical access line
to your home is not shared with a neighbor in the same way as cable's coaxial
segment.
●​ Headend vs. Central Office:
○​ Cable: Connects to a Cable Headend (where the CMTS resides).
○​ DSL: Connects to a Central Office (CO) or remote terminal (where the DSLAM
resides).
●​ Performance and Distance:
○​ Cable: Less susceptible to distance degradation over the coaxial segment
compared to DSL's copper pair, especially due to the fiber-optic backhaul.
However, performance can be affected by the number of active users on a
shared segment.
○​ DSL: Highly sensitive to distance from the DSLAM.

Access Network: Home Network

What is a Home Network?

A home network is a local area network (LAN) set up within a residential property to connect
various electronic devices, such as computers, smartphones, tablets, smart TVs, gaming
consoles, smart home devices, and network printers. The primary purpose of a home network is
to allow these devices to:

●​ Share a single internet connection: This is its most common and crucial function in the
context of an access network.
●​ Share files and resources: E.g., sharing documents, photos, or printers among family
members.
●​ Communicate with each other: E.g., casting content from a phone to a smart TV,
controlling smart home devices.

Key Components of a Typical Home Network:

1.​ Modem (DSL Modem, Cable Modem, Fiber ONT):


○​ This is the device that connects your home network to the ISP's access network
(DSL, Cable, Fiber).
○​ It's responsible for modulating/demodulating signals to send/receive data over
the external network.
○​ Examples: DSL modem, Cable modem, Optical Network Terminal (ONT) for fiber.
2.​ Router (Wireless Router):
○​ This is the central device of most modern home networks.
○​ Main Functions:
■​ Routing: Directs internet traffic between your home network and the
ISP's network. It manages IP addresses within your home (using DHCP)
and translates private IP addresses to public ones (using NAT) for internet
access.
■​ Switching (Built-in): Most home routers include a built-in Ethernet
switch, allowing you to connect devices via wired Ethernet cables.
■​ Wireless Access Point (WAP): Most home routers also include Wi-Fi
capabilities, allowing devices to connect wirelessly.
3.​ Switch (Optional/Built-in):
○​ If you have many wired devices, you might use a separate Ethernet switch to
expand the number of available wired ports beyond what the router provides. As
mentioned, most routers have a small switch built-in.
4.​ Wireless Access Points (WAPs) / Mesh Wi-Fi Systems (Optional):
○​ For larger homes or areas with Wi-Fi dead spots, additional WAPs or a mesh
Wi-Fi system can extend wireless coverage.

1. Application Layer

●​ Function: This is the layer that interacts directly with user applications. It provides
services to the applications that need to communicate over the network. It handles the
details of how specific applications exchange data.

●​ Key Services/Protocols:
○​ FTP (File Transfer Protocol): Used for transferring files between a client and a
server. (e.g., uploading a webpage to a web server).
○​ SMTP (Simple Mail Transfer Protocol): Used for sending and receiving email
messages. (e.g., when you click "send" in your email client).
○​ HTTP (Hypertext Transfer Protocol): The foundation of data communication for
the World Wide Web. Used for accessing web pages. (e.g., when your browser
requests a webpage).
○​ DNS (Domain Name System): Translates human-readable domain names (like
https://www.google.com/search?q=google.com) into numerical IP addresses.
○​ SSH (Secure Shell): Secure remote login and file transfer.

2. Transport Layer

●​ Function: Provides end-to-end (or process-to-process) data transfer between


applications running on different hosts. It handles segmentation of data from the
application layer into smaller units, adds headers for control, and ensures that data
arrives correctly at the destination application.

●​ Key Services/Protocols:
○​ TCP (Transmission Control Protocol):
■​ Connection-Oriented: Establishes a connection before data transfer
begins and terminates it afterwards.
■​ Reliable: Guarantees delivery of data, retransmits lost packets, and
provides error checking.
■​ Flow Control: Prevents a fast sender from overwhelming a slow receiver.
■​ Congestion Control: Manages traffic to prevent network overload.
■​ Used for: Web Browse (HTTP), email (SMTP), file transfer (FTP), secure
shell (SSH), etc., where reliability is paramount.
○​ UDP (User Datagram Protocol):
■​ Connectionless: Does not establish a connection beforehand.
■​ Unreliable: Does not guarantee delivery; no retransmissions or error
checking (beyond basic checksum).
■​ Faster: Less overhead than TCP.
■​ Used for: Real-time applications like streaming video/audio, online
gaming, DNS queries, where speed is more important than absolute
reliability (as retransmitting would cause unacceptable delays).

3. Network Layer (or Internet Layer)

●​ Function: Responsible for routing datagrams (packets) from the source host to the
destination host across multiple interconnected networks. It determines the best path for
data to travel.
●​ Key Services/Protocols:
○​ IP (Internet Protocol):
■​ The core protocol of the internet. It defines the addressing scheme (IP
addresses) and how packets are structured and forwarded.
■​ Connectionless and Unreliable: IP itself does not guarantee delivery;
reliability is left to higher layers (like TCP).
■​ IPv4 and IPv6: The two primary versions of IP addresses.
○​ Routing Protocols:
■​ RIP (Routing Information Protocol), OSPF (Open Shortest Path
First), BGP (Border Gateway Protocol): These protocols are used by
routers to exchange routing information with each other to build and
maintain routing tables, which dictate the best paths for packets.

4. Link Layer (or Data Link Layer / Network Interface Layer)

●​ Function: Transfers data between neighboring network elements (directly connected


devices) within the same local network segment. It handles framing, physical addressing
(MAC addresses), error detection (within the link), and media access control.
●​ Key Services/Protocols:
○​ Ethernet: The dominant wired LAN technology. Defines how data is transmitted
over wired connections (e.g., copper cables, fiber optics) within a local network.
○​ 802.11 (Wi-Fi): The standard for wireless local area networks (WLANs). Defines
how data is transmitted wirelessly (over radio waves).
○​ PPP (Point-to-Point Protocol): Used for establishing direct connections
between two nodes, often used over dial-up or some DSL connections.
○​ MAC Addresses: Physical addresses (48-bit) unique to each network interface
card (NIC), used for addressing within a local segment.

5. Physical Layer

●​ Function: Deals with the physical characteristics of the transmission medium and the
actual transmission of raw bits (0s and 1s) over that medium. It defines voltage levels,
cable specifications, connector types, data rates, etc.

●​ Key Aspects:
○​ Cabling: Copper wires (Ethernet cables), fiber optic cables.
○​ Wireless Signals: Radio waves (for Wi-Fi).
○​ Connectors: RJ-45, fiber optic connectors.
○​ Voltage levels, light pulses, radio frequencies: How bits are physically
represented and transmitted.

How they work together (Encapsulation and Decapsulation):

When data is sent, it goes down the stack. At each layer, the previous layer's data is
encapsulated (wrapped) with a new header specific to that layer.
●​ Application data (e.g., an HTTP request)
●​ Transport header (e.g., TCP header) + Application data = Segment/Datagram
●​ Network header (e.g., IP header) + Segment/Datagram = Packet/Datagram
●​ Link header + Link trailer (e.g., Ethernet header/trailer) + Packet/Datagram = Frame
●​ Physical layer converts the Frame into bits to be sent over the wire/air.

When data is received, it goes up the stack, and each layer decapsulates (unwraps) its
respective header, passing the payload up to the next higher layer until the original application
data is delivered.

HTTP: Hypertext Transfer Protocol Overview

HTTP (Hypertext Transfer Protocol) is the foundation of data communication for the World
Wide Web. It's an application layer protocol (as you correctly noted in the Internet Protocol
Stack), meaning it sits at the top of the TCP/IP stack and interacts directly with web browsers
and web servers.

1. Web's Application Layer Protocol:

●​ Role: HTTP defines the rules and methods for how web clients (like your browser) and
web servers communicate with each other to exchange web content.
●​ What it transfers: Primarily "Hypertext" (HTML documents), but also images, videos,
stylesheets, scripts, and any other type of file that makes up a web page or web
application.
●​ How it relates to the stack: HTTP relies on the Transport Layer (specifically TCP) to
provide reliable, connection-oriented data transfer. This means when your browser
makes an HTTP request, TCP ensures that the request reaches the server completely
and correctly, and that the server's response reaches your browser completely and
correctly.

2. Client/Server Model:

HTTP operates strictly on a client/server model. This is a fundamental architectural style for
distributed applications.

●​ Client (The Browser):


○​ Role: The client is typically your web browser (e.g., Chrome, Firefox, Safari,
Edge). It initiates communication by making requests to the server.
○​ Actions:
■​ Requests: When you type a URL, click a link, or submit a form, your
browser (the HTTP client) formulates an HTTP Request message. This
message asks the server for a specific web object (e.g., an HTML file, an
image, a video).
■​ Receives: It listens for and receives the HTTP Response message from
the server.
■​ Displays: Once the browser receives the web objects, it "displays" them
by rendering the HTML, images, and other elements to present the
webpage to the user.
○​ Using HTTP Protocol: The browser constructs its requests and interprets the
server's responses according to the HTTP rules.
●​ Server (The Web Server):
○​ Role: A web server (e.g., Apache HTTP Server, Nginx, Microsoft IIS) is a
program that runs on a computer connected to the internet. Its job is to "serve"
web content.
○​ Actions:
■​ Receives Requests: It constantly "listens" for incoming HTTP Request
messages from clients.
■​ Processes Requests: When a request arrives, the server retrieves the
requested object (e.g., a specific HTML file from its storage, or
dynamically generates content).
■​ Sends Responses: It then constructs an HTTP Response message
containing the requested object (or an error message if the object can't be
found) and sends it back to the requesting client.
○​ Using HTTP Protocol: The server receives and responds to requests according
to the HTTP rules.

Key Characteristics of HTTP:

●​ Stateless: This is a very important characteristic. Each HTTP request and response pair
is independent of all other requests and responses. The server does not store any
information about previous client requests.
○​ Implication: If you need to maintain "state" (e.g., items in a shopping cart, user
login status), mechanisms like cookies, session IDs, or URL rewriting are used
on top of HTTP to achieve this.
●​ Uses Port 80 (default): HTTP communication typically occurs over TCP port 80.
●​ HTTPS (HTTP Secure): This is the secure version of HTTP. It's HTTP layered on top of
TLS/SSL (Transport Layer Security/Secure Sockets Layer) for encryption and
authentication. HTTPS typically uses TCP port 443.

Example Scenario:

1.​ You type www.example.com into your browser.


2.​ DNS Lookup: Your browser first uses DNS (Application Layer) to translate
www.example.com into an IP address (e.g., 192.0.2.10).
3.​ TCP Connection: Your browser (client) opens a TCP connection (Transport Layer) to
the web server at 192.0.2.10 on port 80 (or 443 for HTTPS).
4.​ HTTP Request: Your browser sends an HTTP GET request message over the TCP
connection, asking for the default page (e.g., /index.html).
5.​ Server Processes: The web server receives the GET request, finds index.html, and
creates an HTTP Response message.
6.​ HTTP Response: The server sends the HTTP Response message (containing the
HTML content of index.html) back to your browser over the same TCP connection.
7.​ Browser Renders: Your browser receives the HTML, reads it, and then likely makes
further HTTP requests for images, stylesheets, and scripts referenced within the HTML
file.
8.​ Display: Once all objects are received, your browser renders and displays the complete
webpage.

General Categories of HTTP Status Codes:

The first digit of the status code indicates the general class of response:

●​ 1xx: Informational
○​ The request was received, continuing process. (Less common in everyday
Browse)
●​ 2xx: Success
○​ The action was successfully received, understood, and accepted.
●​ 3xx: Redirection
○​ Further action needs to be taken by the user agent (browser) to fulfill the request.
●​ 4xx: Client Error
○​ The request contains bad syntax or cannot be fulfilled. (The client made a
mistake)
●​ 5xx: Server Error
○​ The server failed to fulfill an apparently valid request. (The server encountered a
problem)

DNS: Domain Name System

The Problem: Why DNS is Needed

You've perfectly articulated the core problem:

●​ Humans use "names": We remember www.yahoo.com or google.com much more


easily.
●​ Computers use "numbers": Internet hosts and routers rely on IP addresses (32-bit for
IPv4, 128-bit for IPv6) to identify and address datagrams (packets) for routing.

The Solution: Domain Name System (DNS)

DNS is essentially the "phonebook of the Internet." It's a distributed database system that
translates human-readable domain names into machine-readable IP addresses, and vice-versa.

●​ Key Function: To translate (resolve) a hostname to an IP address.


●​ "Name Server": These are the specialized servers that store parts of the DNS database
and perform the resolution.
●​ Application-Layer Protocol: As you noted, DNS is an application-layer protocol. This
means it runs on top of the transport layer (primarily UDP, but sometimes TCP) and
provides a service directly to applications (like your web browser).
○​ Execution: The process of a host (your computer) querying a name server to
resolve a name-to-IP address translation is handled by the DNS protocol.
○​ Starting Point: Your host typically starts a DNS query at a local DNS server
(often provided by your ISP or configured manually, like Google's 8.8.8.8). This
local server acts as a proxy or caching server for your queries.

DNS Domain Hierarchy

DNS is organized hierarchically, like an inverted tree, with the root at the top. This distributed
nature is what makes it so scalable and resilient.

●​ The Root (.):


○​ The very top of the DNS hierarchy.
○​ It's logically represented as a single dot (.).
○​ All domain names implicitly end with a dot (e.g., www.example.com. is the fully
qualified domain name).
●​ Top-Level Domain (TLD):
○​ Immediately below the Root.
○​ These are the generic (gTLDs) and country-code (ccTLDs) domains.
○​ Examples:
■​ .com (commercial)
■​ .org (organization)
■​ .net (network)
■​ .edu (education)
■​ .gov (government)
■​ .ca (Canada)
■​ .uk (United Kingdom)
■​ .fr (France)
○​ In www.example.com, .com is the TLD.
●​ Second-Level Domain (SLD):
○​ Below the TLDs. These are the names registered by individuals or organizations.
○​ Examples:
■​ example in www.example.com
■​ uwindsor in uwindsor.ca
■​ google in google.com
○​ These are assigned to specific entities.
●​ Subdomains (Third Level and Beyond):
○​ Further levels can be created by the owner of a second-level domain.
○​ Examples:
■​ www in www.example.com (often denotes a web server)
■​ mail in mail.google.com (might denote an email server)
■​ cs in cs.uwindsor.ca (might denote a computer science department
server)

Authoritative Name Servers

●​ Definition: An authoritative name server for a specific hostname (or domain) is the DNS
server that stores the definitive and official records for that name. It's the ultimate
source of truth for a particular part of the DNS namespace.
●​ Function: When a DNS query reaches an authoritative name server, it can certainly
provide the answer to that query because it directly manages the records for that
domain. It doesn't need to ask another server for that specific information.
●​ Example: As you mentioned, uwindsor.ca's DNS servers are the authoritative name
servers for www.uwindsor.ca, cs.uwindsor.ca, etc. They hold the actual IP
addresses for these hosts.

DNS ROOT Servers

●​ The Root Zone (.): The very top of the DNS hierarchy, containing pointers to all the
TLD servers.
●​ Number: There are 13 logical root name servers. (It's important to note that these are
logical servers. In reality, each of these 13 logical servers is replicated globally using
anycast IP addresses, meaning there are hundreds of physical root server instances
around the world, providing redundancy and reducing latency).
●​ Function: Their primary role is to provide the nameserver information about all
Top-Level Domains (TLDs). They don't know the IP address for www.example.com,
but they know which TLD servers (e.g., .com servers) to ask next.
●​ Starting Point of DNS Queries: When a local DNS server cannot resolve a query from
its cache, it often starts the resolution process by querying a root DNS server. The root
server then directs it to the appropriate TLD server, and the process continues down the
hierarchy until an authoritative server is reached.
●​ Resource: The https://www.internic.net/domain/root.zone link is excellent!
It contains the actual list of root server names and their IP addresses.

How a DNS Query Works (in brief for context):

1.​ User enters www.example.com in browser.


2.​ Browser checks its cache. If found, uses it.
3.​ Local DNS Server Query: If not in browser cache, the browser asks the local DNS
server (e.g., your ISP's DNS server).
4.​ Local DNS Server Check:
○​ If the local DNS server has the IP in its cache, it returns it.
○​ If not, it becomes a recursive query and begins a iterative query process:
■​ It queries a Root DNS Server.
■​ The Root server tells the local DNS server, "I don't know
www.example.com, but the .com TLD servers can help. Here are their
IPs."
■​ The local DNS server then queries a .com TLD server.
■​ The .com TLD server tells the local DNS server, "I don't know
www.example.com, but example.com's authoritative name servers can
help. Here are their IPs."
■​ The local DNS server then queries an example.com authoritative name
server.
■​ The example.com authoritative name server finally returns the IP
address for www.example.com.
5.​ Local DNS Server Responds: The local DNS server sends the IP address back to the
browser.
6.​ Browser Connects: The browser uses the IP address to establish a TCP connection to
the web server and retrieves the webpage using HTTP.
Internet Transport-Layer Protocols
The Transport Layer sits above the Network Layer (IP) and below the Application Layer. Its
primary responsibility is to provide process-to-process data delivery. This means it ensures
that data not only gets from one host to another (which is the Network Layer's job with IP) but
specifically from a process (application) on the source host to a process (application) on the
destination host.

There are two fundamental transport layer protocols in the Internet Protocol Suite: TCP and
UDP.

1. TCP (Transmission Control Protocol)

●​ Reliable, In-Order Delivery: This is TCP's defining characteristic. It guarantees that:


○​ Data arrives: Lost segments are detected and retransmitted.
○​ Data arrives in order: Segments are reassembled in the correct sequence at the
receiver, even if they arrived out of order.
○​ No duplicate data: Duplicate segments are discarded.
●​ Connection-Oriented: Before data transfer begins, TCP establishes a logical
connection between the two processes using a "three-way handshake." This setup
ensures both sides are ready to communicate.
●​ Key Features (as listed):
○​ Congestion Control: TCP mechanisms (like slow start, congestion avoidance,
fast retransmit/recovery) work to prevent the network from becoming overloaded.
If the network experiences congestion, TCP reduces its sending rate to alleviate
the problem, thus protecting the network from collapse.
○​ Flow Control: Prevents a fast sender from overwhelming a slower receiver. The
receiver advertises its available buffer space, and the sender adjusts its
transmission rate to avoid overflowing the receiver's buffer.
○​ Connection Setup: The "three-way handshake" (SYN, SYN-ACK, ACK) ensures
both sender and receiver are ready and synchronized before data transfer.
There's also a connection teardown (FIN, FIN-ACK, ACK).
●​ When to Use TCP: Applications that require high reliability and precise ordering of data,
such as:
○​ Web Browse (HTTP, HTTPS)
○​ Email (SMTP, POP3, IMAP)
○​ File transfer (FTP)
○​ Secure Shell (SSH)

2. UDP (User Datagram Protocol)

●​ Unreliable, Unordered Delivery: This is UDP's defining characteristic. It provides a


minimal, best-effort service:
○​ No guarantee of delivery: Segments might be lost and are not retransmitted by
UDP.
○​ No guarantee of order: Segments might arrive out of sequence.
○​ No duplicate protection: Duplicate segments are not detected or discarded by
UDP.
●​ No-Frills Extension of "Best-Effort" IP: UDP simply adds port numbers for
process-to-process delivery on top of IP's host-to-host delivery. It doesn't add reliability,
flow control, or congestion control mechanisms.
●​ Connectionless: UDP does not establish a connection before sending data. Each UDP
segment is an independent unit.
●​ When to Use UDP: Applications where speed and low overhead are more important
than absolute reliability, or where the application itself handles error recovery, such as:
○​ Streaming media (video, audio) where occasional dropped packets are
acceptable for real-time experience.
○​ Online gaming (small delays for retransmission are worse than a dropped frame).
○​ DNS (Domain Name System) queries (small, quick requests where re-sending is
easier than establishing a connection).
○​ VoIP (Voice over IP).
Sockets

●​ The Interface: As you stated, "Application processes sends messages to (or receives
messages from) transport layer through socket." A socket is a software endpoint for
network communication. It's the interface between the application layer and the transport
layer.
●​ Socket Programming: "Socket programming is for this purpose: socket.send(M)
and M=socket.recv()." Programmers use socket APIs (Application Programming
Interfaces) in languages like Python, Java, or C/C++ to create and manage these
endpoints.
○​ socket.send(M): The application passes a message M to the transport layer
via the socket.
○​ M=socket.recv(): The application retrieves a message M that the transport
layer has delivered from the network via the socket.
●​ Purpose: Sockets abstract away the complexities of the underlying network protocols,
allowing applications to simply "send" or "receive" data without needing to know the
low-level details of how TCP or UDP operate.

Multiplexing/Demultiplexing in TCP/UDP

This is the core mechanism by which the transport layer provides process-to-process delivery
using port numbers.

●​ Multiplexing (at the Sender):


○​ Multiple application processes on the sending host want to send data over the
network.
○​ Each process's data is associated with a specific source port number.
○​ The transport layer (TCP or UDP) takes segments from different
sockets/processes, adds the appropriate port numbers (and other header info),
and passes them down to the network layer (IP).
○​ Think of it as different applications sharing the single IP address of the host to
send their data out. The transport layer combines these different streams into a
single outgoing stream of IP datagrams, each with its specific port number.
●​ Demultiplexing (at the Receiver):
○​ When an IP datagram arrives at the receiving host, the IP layer delivers it to the
transport layer.
○​ The transport layer (TCP or UDP) examines the destination port number in the
segment header.
○​ Based on this destination port number, it directs (demultiplexes) the segment to
the correct receiving socket (and thus to the correct application process) that is
"listening" on that port.
○​ Think of it as the transport layer separating the incoming stream of IP datagrams
and delivering each segment to the correct application process based on its
destination port.

TCP Socket Identification (4-Tuple):

For TCP, a connection (and thus a unique socket on each end) is uniquely identified by a
4-tuple:

●​ Source IP Address: The IP address of the sending host.


●​ Source Port Number: The port number used by the sending application process.
●​ Destination IP Address: The IP address of the receiving host.
●​ Destination Port Number: The port number used by the receiving application process.

This 4-tuple ensures that when a segment arrives, the receiving host knows exactly which
specific TCP connection (and thus which specific socket and application process) it belongs to,
even if multiple applications are communicating with the same remote host or different
applications on the same host are using the same port (e.g., multiple web browsers connecting
to different web servers).

UDP Socket Identification:

While TCP uses the full 4-tuple for demultiplexing, UDP typically uses just the destination IP
address and destination port number to demultiplex incoming datagrams to the correct
socket. The source IP and source port are still present in the UDP header but are not strictly
part of the "socket ID" for basic demultiplexing. This is because UDP is connectionless; it just
delivers datagrams to a specific port on a specific IP, without needing to track a full "connection."

The Three way handshake:


1.​ Client sends SYN (Synchronize Segment):
○​ The client initiates the connection by sending a TCP segment with the SYN flag
set to 1.
○​ It includes an initial sequence number (ISN), let's call it x (chosen randomly by
the client). This x is the sequence number for the first byte of data the client
intends to send if it were sending data.
○​ Client State: SYNSENT
2.​ Server sends SYN-ACK (Synchronize-Acknowledgment Segment):
○​ Upon receiving the SYN, the server transitions to SYN RCVD.
○​ The server responds with a segment that has:
■​ SYN flag set to 1 (to synchronize its own sequence number with the
client).
■​ ACK flag set to 1 (to acknowledge the client's SYN).
■​ Its own initial sequence number (ISN), let's call it y (chosen randomly
by the server).
■​ An acknowledgment number equal to x+1. This acknowledges receipt
of the client's SYN segment (which conceptually consumed 1 byte of
sequence number space, even though it carried no application data) and
indicates that the server is ready to receive the next byte from the client
starting with sequence number x+1.
○​ Server State: SYN RCVD
3.​ Client sends ACK (Acknowledgment Segment):
○​ Upon receiving the SYN-ACK, the client transitions to ESTAB.
○​ The client sends a segment with the ACK flag set to 1.
○​ It includes an acknowledgment number equal to y+1. This acknowledges
receipt of the server's SYN segment (which also conceptually consumed 1 byte
of sequence number space) and indicates it's ready to receive data from the
server starting with sequence number y+1.
○​ Its own sequence number will be x+1 (the sequence number for its first data byte
if it were to send data immediately).
○​ Client State: ESTAB
○​ Server State: Upon receiving this final ACK, the server also transitions to ESTAB.

At this point, a full-duplex TCP connection is established, and both the client and server can
now send and receive application data.

Sequence Numbers:

●​ Initial Sequence Number (ISN): As seen in the handshake, the initial sequence number
chosen by each side (x and y) can be any random number. This randomness helps
prevent "old" segments from a previous connection (that might still be lingering in the
network) from being misinterpreted as part of a new connection.
●​ Purpose: A sequence number identifies the first byte of data carried in a TCP segment.
●​ Calculation:
○​ Seq # (current packet): The sequence number of the very first byte of
data in the current segment.
○​ Seq # (next packet) = Seq # (current packet) + #databytes
(current packet): If a segment carries N bytes of application data, the
sequence number for the next segment that the sender will transmit should start
N bytes after the current segment's sequence number.
○​ Next seq # > current seq #: Sequence numbers are always increasing
(wrapping around eventually, but conceptually increasing) to track the flow of
data.
●​ Packet Order Recovery: If segments arrive out of order at the receiver, the sequence
numbers allow the receiver to buffer them and reassemble them into the correct order
before passing the data to the application.

Simple Telnet Scenario (for understanding Seq/ACK flow)

Let's trace a simplified example, like the "User types 'C'" scenario:

Assume:

●​ Client's ISN = x
●​ Server's ISN = y
1.​ Connection Setup (3-way handshake):
○​ Client -> Server: SYN, Seq=x
○​ Server -> Client: SYN, Seq=y, ACK=x+1
○​ Client -> Server: ACK=y+1, Seq=x+1 (Now connection ESTABLISHED)
2.​ User types 'C' (Client sends data to Server):
○​ Client sends a segment with data 'C'.
○​ Client -> Server: PUSH, ACK=y+1, Seq=x+1, Data='C' (assuming
'C' is 1 byte, so it consumes 1 sequence number)
○​ Client's next expected seq for its own data: x+2
○​ Client's current ack for server data: y+1
3.​ Host ACKs receipt of 'C' (Server acknowledges data):
○​ Server receives 'C' (which was seq x+1).
○​ Server acknowledges receipt of 'C'.
○​ Server -> Client: ACK=x+2, Seq=y+1 (Server's own sequence number,
not consuming data if just an ACK)
○​ Server's current ack for client data: x+2 (expects next byte 'x+2')
○​ Server's next expected seq for its own data: y+1
4.​ Host ACKs receipt of 'C', echoes back 'C' (Client receives ACK, Server sends
echoed 'C'):
○​ The "host ACKs receipt of 'C'" likely refers to the client processing the server's
ACK for 'C'.
○​ The "echoes back 'C'" means the server is now sending 'C' back to the client.
○​ Server -> Client: PUSH, ACK=x+2, Seq=y+1, Data='C' (Server
sends its 'C' back)
○​ Server's current ack for client data: x+2
○​ Server's next expected seq for its own data: y+2
5.​ Client ACKs receipt of echoed 'C':
○​ Client receives the echoed 'C' (which was seq y+1).
○​ Client -> Server: ACK=y+2, Seq=x+2 (Client acknowledges receipt of
server's echoed 'C')
○​ Client's current ack for server data: y+2
○​ Client's next expected seq for its own data: x+2

This continuous exchange of sequence and acknowledgment numbers is how TCP ensures
reliability, confirming that data has been received and indicating what data is expected next.

Lost ACK Scenario, Premature Timeout, Cumulative ACK

These concepts relate to how TCP handles errors and inefficiencies.

●​ Lost ACK Scenario:


○​ If a sender transmits data, but the corresponding ACK from the receiver gets lost
in the network.
○​ The sender, without receiving an ACK for that data within a certain time frame (its
timeout interval), will assume the data (or the ACK) was lost.
○​ It will then retransmit the data segment.
○​ If the original data segment did arrive but only the ACK was lost, the receiver will
get a duplicate data segment. Thanks to sequence numbers, the receiver will
recognize it as a duplicate and discard it, then re-send the ACK for the data it is
still expecting (or the largest sequence number it has received correctly so far).
●​ Premature Timeout:
○​ This occurs when the sender's timeout interval is set too short.
○​ The sender retransmits a segment even though the original segment (or its ACK)
is still in transit and will likely arrive shortly.
○​ This leads to unnecessary retransmissions, increased network traffic, and
potential duplicate segments at the receiver, which wastes bandwidth.
○​ TCP uses sophisticated algorithms (like Round Trip Time - RTT estimation) to
dynamically adjust the timeout interval to avoid this.
●​ Cumulative ACK:
○​ This is what we discussed earlier: An ACK number indicates that the receiver has
successfully received all bytes up to (but not including) the stated
acknowledgment number.
○​ Advantage: If multiple data segments are received in order, the receiver doesn't
need to send an ACK for each individual segment. A single ACK can
acknowledge a whole range of previously received bytes.
○​ Example:
■​ Sender sends Segment 1 (bytes 0-99), then Segment 2 (bytes 100-199).
■​ Receiver receives Segment 1.
■​ Receiver receives Segment 2.
■​ Receiver can then send one ACK, say ACK=200, indicating it has
received all bytes up to 199.
○​ This significantly reduces the number of ACK segments needed, improving
efficiency.

These mechanisms (sequence numbers, cumulative ACKs, retransmissions based on timeouts)


are what make TCP the reliable protocol it is, ensuring that data gets from one application
process to another completely and correctly.

You're touching upon a core concept in IP routing: Longest Prefix Matching (also known as
Longest Match Routing or Classless Inter-Domain Routing - CIDR). This is crucial for how
routers make forwarding decisions.

Let's break down your statement and example.

Longest Prefix Matching

Concept: When a router receives an IP packet, it needs to decide which outgoing interface to
send that packet on to get it closer to its destination. It does this by looking at the destination IP
address (DA) in the packet's header.

Routers maintain a forwarding table (also called a routing table). This table contains entries
that map network prefixes to outgoing interfaces (and sometimes next-hop IP addresses).

The rule of longest prefix matching states:

When looking for a forwarding table entry for a given destination address, use
the entry that has the longest address prefix that matches the destination
address.

Why Longest Prefix Matching?


●​ Specificity: It prioritizes the most specific route. If a router has a general route for an
entire large network (e.g., 10.0.0.0/8) but also a more specific route for a subnet
within that network (e.g., 10.1.2.0/24), the specific route is preferred for packets
destined for that subnet.
●​ Flexibility: It allows for efficient routing in hierarchical networks and for situations where
some parts of a larger network are routed differently (e.g., a specific subnet might have a
dedicated high-speed link, while the rest of the network uses a slower, more general
path).
●​ CIDR (Classless Inter-Domain Routing): Longest prefix matching is fundamental to
CIDR, which revolutionized IP addressing by allowing network prefixes of arbitrary
lengths, moving away from the rigid class-based system (Class A, B, C).

Example Analysis

DA: 11001000 00010111 00010110 10100001 (This is a 32-bit IPv4 address in binary) In
dotted decimal, this is: 200.23.22.161

Let's imagine a simplified forwarding table on a router:

Prefix (Network Address / Prefix Length) Outgoing Interface

11001000 00010111 00010110 Interface A


00000000 /24

11001000 00010111 00010000 Interface B


00000000 /20

11001000 00010111 00000000 Interface C


00000000 /16

11001000 00000000 00000000 Interface D


00000000 /8
00000000 00000000 00000000 Interface E (Default
00000000 /0 Route)

Export to Sheets

Now, let's compare the Destination Address (DA: 11001000 00010111 00010110
10100001) against each prefix in the table:

1.​ Prefix 1: 11001000 00010111 00010110 00000000 /24


○​ Prefix Part: 11001000 00010111 00010110 (first 24 bits)
○​ DA Match: 11001000 00010111 00010110
○​ Match? YES. The first 24 bits of the DA exactly match the 24-bit prefix.
2.​ Prefix 2: 11001000 00010111 00010000 00000000 /20
○​ Prefix Part: 11001000 00010111 0001 (first 20 bits)
○​ DA Match: 11001000 00010111 0001
○​ Match? YES. The first 20 bits of the DA exactly match the 20-bit prefix. (Note:
The 0110 in the DA's 21-24 bits still falls within the broader range covered by this
/20 prefix).
3.​ Prefix 3: 11001000 00010111 00000000 00000000 /16
○​ Prefix Part: 11001000 00010111 (first 16 bits)
○​ DA Match: 11001000 00010111
○​ Match? YES. The first 16 bits of the DA exactly match the 16-bit prefix.
4.​ Prefix 4: 11001000 00000000 00000000 00000000 /8
○​ Prefix Part: 11001000 (first 8 bits)
○​ DA Match: 11001000
○​ Match? YES. The first 8 bits of the DA exactly match the 8-bit prefix.
5.​ Prefix 5: 00000000 00000000 00000000 00000000 /0
○​ Prefix Part: (No bits, matches everything)
○​ DA Match: (Any 0 bits)
○​ Match? YES. This is the default route which matches all destination addresses
if no more specific match is found.

Which Interface?

Based on the Longest Prefix Matching rule:

●​ All listed prefixes match the Destination Address.


●​ We must choose the one with the longest prefix length.
●​ The longest prefix length among the matching entries is /24.
Therefore, the packet for DA: 11001000 00010111 00010110 10100001 would be
forwarded out of Interface A.

Which Part is the Prefix?

In an IP address and its associated prefix length (e.g., 192.168.1.0/24):

●​ The prefix is the leftmost part of the IP address that is significant for identifying the
network.
●​ The prefix length (e.g., /24) tells you how many bits from the left of the IP address
constitute the network prefix.

For your example DA: 11001000 00010111 00010110 10100001

If we consider the matching prefix 11001000 00010111 00010110 00000000 /24:

●​ The prefix is the first 24 bits: 11001000 00010111 00010110


●​ The remaining bits (the last 8 bits) 10100001 represent the host part of the address
within that specific network.

Subnet (Subnetwork)
A subnet (short for subnetwork) is a logical division of an IP network. It's a smaller,
manageable segment of a larger network.

Key Characteristics and Purpose:

1.​ Logical Division of an IP Network:


○​ An IP network is defined by a network address and a network mask/prefix length
(e.g., 192.168.1.0/24).
○​ Subnetting takes that single large network and divides it into multiple, smaller,
interconnected networks (subnets).
2.​ Device Interfaces with the Same Subnet Part of IP Address:
○​ This is the crucial identifying factor. All devices (or, more accurately, their network
interfaces) that belong to the same subnet will have IP addresses where the
network portion (including the subnet part) is identical.
○​ The subnet mask (or CIDR prefix length) is used to determine which part of an
IP address is the network/subnet portion and which part is the host portion.
○​ Example:
■​ If a device has an IP address 192.168.1.10 and a subnet mask of
255.255.255.0 (which is /24 in CIDR notation), the first 24 bits
(192.168.1) represent the network/subnet part.
■​ Any other device with an IP address like 192.168.1.50 and the same
subnet mask is on the same subnet.
■​ A device with 192.168.2.10 (and the same /24 mask) is on a different
subnet.
3.​ Can Physically Reach Each Other Without an Intervening Router:
○​ This is the fundamental operational aspect of a subnet.
○​ Devices within the same subnet can communicate directly with each other at the
Link Layer (Layer 2) without needing to involve a router to forward packets
between them. They can use ARP (Address Resolution Protocol) to find each
other's MAC addresses and send frames directly over the local network segment
(e.g., an Ethernet switch).
○​ If a device wants to send data to another device on a different subnet, it must
send the packet to its default gateway (which is a router). The router then
forwards the packet to the destination subnet.

Why Subnet? (Benefits of Subnetting)

●​ Reduce Network Congestion/Broadcast Domains: When a network is one large


broadcast domain, broadcast traffic (like ARP requests) reaches every device,
consuming bandwidth and processing power. Subnetting creates smaller broadcast
domains, limiting the reach of broadcast traffic and reducing congestion.
●​ Improve Security: By segmenting a network into subnets, you can implement stricter
security policies and access controls between different segments. For example, you can
use firewalls to control traffic flow between subnets.
●​ Better Management and Organization: It makes a large network easier to manage,
troubleshoot, and organize. Different departments or functions can have their own
subnets.
●​ Efficient IP Address Utilization: In the days of classful addressing, subnetting allowed
administrators to break down large, predefined networks (like a Class B network) into
smaller, usable chunks, preventing the waste of IP addresses. While CIDR has made
this less critical for address conservation, it still applies within an organization's assigned
IP space.

How Subnetting Works (Briefly):

Subnetting involves borrowing bits from the host portion of an IP address to create a new
subnet portion. The subnet mask defines where the network/subnet bits end and the host bits
begin.

●​ Original Network Example: 192.168.1.0/24


○​ 11000000.10101000.00000001.00000000 (Network portion is 24 bits, Host
portion is 8 bits)
○​ This network can have 2^8 - 2 = 254 usable host IP addresses.
●​ Subnetted Example: Subnetting 192.168.1.0/24 into smaller /26 subnets:
○​ You borrow 2 bits from the host portion.
○​ New prefix length is 24 + 2 = 26 bits.
○​ Subnet mask 255.255.255.192
○​ This creates 4 subnets from the original network (2^2 = 4).
○​ Each new subnet (e.g., 192.168.1.0/26, 192.168.1.64/26,
192.168.1.128/26, 192.168.1.192/26) can now have 2^6 - 2 = 62
usable host IP addresses.

MCQs on TCP Sequence Numbers and Acknowledgments

Questions:

1.​ What is the purpose of the Initial Sequence Number (ISN) in TCP?​
a) To identify the destination port​
b) To prevent old segments from being misinterpreted in new connections​
c) To determine the checksum value​
d) To set the window size
2.​ If a TCP segment carries 100 bytes of data and has a sequence number of 5000,
what will be the sequence number of the next segment?​
a) 5000​
b) 5001​
c) 5100​
d) 4900
3.​ During the TCP three-way handshake, what does the server send in response to
the client’s SYN (Seq=x)?​
a) SYN, Seq=y, ACK=x​
b) SYN, Seq=y, ACK=x+1​
c) SYN, Seq=x+1, ACK=y​
d) ACK=x+1, Seq=y
4.​ If a client sends a TCP segment with Seq=2000 and 50 bytes of data, what
should be the acknowledgment number in the server’s response?​
a) 2000​
b) 2001​
c) 2050​
d) 2051
5.​ In a TCP connection, if a segment arrives out of order, how does the receiver
handle it?​
a) Discards it immediately​
b) Uses sequence numbers to buffer and reorder segments​
c) Sends an RST flag to terminate the connection​
d) Requests retransmission of all previous segments
6.​ After a successful three-way handshake (Client ISN=x, Server ISN=y), what is the
client’s next sequence number when sending data?​
a) x​
b) x+1​
c) y​
d) y+1
7.​ If a server receives a segment with Seq=3000 and 200 bytes of data, what should
it set as the acknowledgment number in its reply?​
a) 3000​
b) 3001​
c) 3200​
d) 3201
8.​ In TCP, sequence numbers are always:​
a) Decreasing​
b) Random​
c) Increasing (until wrap-around)​
d) Fixed for the entire connection
9.​ What happens if a TCP acknowledgment (ACK) is lost in transit?​
a) The sender retransmits the segment immediately​
b) The connection is terminated​
c) The sender continues sending new data​
d) The receiver sends a duplicate ACK
10.​During data transfer, if a client sends a segment with Seq=1500 and 30 bytes of
data, what is the next expected sequence number from the server’s perspective?​
a) 1500​
b) 1501​
c) 1530​
d) 1531

Answer Key:
1.​ b
2.​ c
3.​ b
4.​ d
5.​ b
6.​ b
7.​ c
8.​ c
9.​ a
10.​d

Routing Protocols

Routing Protocol Goal: As you stated, the primary goal of routing protocols is to determine
"good" paths (equivalently, routes) from a sending host to a receiving host, through a
network of interconnected routers.

●​ "Good" Defined: The definition of "good" can vary depending on the routing protocol
and network administrator's objectives, but common metrics include:
○​ Least "cost": This often refers to a metric assigned to a link (e.g., bandwidth,
delay, administrative preference). A lower cost is better.
○​ "Fastest": Implies minimizing propagation and transmission delay.
○​ "Least congested": Aims to avoid heavily utilized paths.
○​ Other metrics could include reliability, number of hops (simplest measure), or a
combination of these.

How Routing Protocols Work (General Idea):

1.​ Information Exchange: Routers use routing protocols to exchange network reachability
information with their neighboring routers. They tell each other about the networks they
can reach and the "cost" to reach them.
2.​ Routing Table Construction: Based on the information received from other routers
(and their own directly connected networks), each router builds and maintains a routing
table (or forwarding table). This table contains entries that map network destinations to
the next-hop router and outgoing interface required to reach that destination, along with
the "cost" of that path.
3.​ Path Selection: When a router receives an IP packet, it consults its routing table. It uses
the destination IP address of the packet to find the best matching entry (using longest
prefix matching, as we discussed earlier) and forwards the packet out the specified
interface to the next-hop router.

Types of Routing Protocols :


●​ Interior Gateway Protocols (IGPs): Used within an Autonomous System (AS) - a single
administrative domain, like an organization's network or an ISP's network. Examples:
OSPF, EIGRP, RIP.
●​ Exterior Gateway Protocols (EGPs): Used between Autonomous Systems. The
primary example is BGP (Border Gateway Protocol), which is the routing protocol of the
global Internet.

Link Layer (Data Link Layer)

The Link Layer (Layer 2 in the TCP/IP model or Data Link Layer in the OSI model) is
responsible for transferring data between physically connected neighboring network elements
(nodes) over a specific link.

Terminology:

●​ Hosts and Routers: Nodes


○​ In the context of the Link Layer, both end devices (hosts like your computer) and
intermediate devices (routers) are referred to as nodes. These are the devices
that send and receive data frames over a link.
●​ Links:
○​ The physical connection between two nodes. This is where the Link Layer
operates.
○​ Wired Links: Examples include Ethernet cables (copper twisted pair), fiber optic
cables.
○​ Wireless Links: Examples include Wi-Fi (802.11), Bluetooth, cellular (LTE, 5G).
●​ Layer-2 Packet: Frame
○​ At the Link Layer, the unit of data is called a frame.
○​ A frame encapsulates an IP datagram (which comes from the Network Layer).
This means the Link Layer adds its own header and trailer information around the
IP datagram.

Data-Link Layer's Core Function:

●​ Transfer frame from one node to physically connected neighbor over a link: The
Link Layer's scope is strictly local. It ensures that a frame successfully traverses a single
link segment from one direct neighbor to another. It does not deal with end-to-end
delivery across multiple links; that's the Network Layer's job.

Link Layer Services:

1.​ Framing, Link Access:


○​ Encapsulate Datagram into Frame: The Link Layer takes the IP datagram it
receives from the Network Layer, adds a header (containing source and
destination MAC addresses, type fields, etc.) and a trailer (containing error
checking information, like a CRC) to create a complete frame.
○​ Channel Access (if shared medium): If multiple nodes share the same physical
transmission medium (e.g., multiple devices on an old Ethernet hub, or all
devices sharing a Wi-Fi channel), the Link Layer needs a Media Access Control
(MAC) protocol. This protocol determines how nodes take turns transmitting to
avoid collisions and manage access to the shared channel (e.g., CSMA/CD for
Ethernet, CSMA/CA for Wi-Fi).
○​ MAC Addresses:
■​ These are physical addresses (also called hardware addresses or
Ethernet addresses).
■​ They are 48-bit (6-byte) unique identifiers burned into the network
interface card (NIC) by the manufacturer.
■​ Crucial Difference from IP Address:
■​ MAC addresses are used for local addressing within a single
link segment to identify neighboring nodes. They don't change as
a packet traverses the Internet.
■​ IP addresses are used for global addressing across the entire
internet, identifying source and destination hosts. The source and
destination IP addresses remain the same from the original sender
to the final receiver.
■​ Analogy: Think of an IP address as the destination city on a letter,
and the MAC address as the specific street number within the
current neighborhood the delivery truck is in. The city stays the
same, but the street number (the local delivery point) changes at
each hop.
2.​ Reliable Delivery Between Adjacent Nodes:
○​ "Different from Chapter 3!" (referring to Transport Layer reliability, often TCP):
This is an important distinction!
■​ TCP (Transport Layer): Provides end-to-end reliability from source
host process to destination host process across the entire network,
regardless of the number of links or routers in between. It handles
retransmissions if segments are lost anywhere along the path.
■​ Link Layer Reliability: Some (but not all) link-layer protocols provide
link-by-link reliability. This means they ensure that a frame is
transmitted correctly across one specific link between two adjacent
nodes. If a frame is corrupted or lost on that single link, the Link Layer
protocol might detect it and retransmit it over that specific link.
○​ Why is this needed?
■​ High Error Rate: This service is particularly useful on links prone to
errors, such as wireless links, where bit errors are much more common
than on wired links.
■​ Error Correction: It includes mechanisms for error detection (like CRC
checksums in the frame trailer) and sometimes error correction (though
retransmission is more common for error recovery). If an error is detected,
the receiver can request a retransmission from the sender on that link.
○​ Note: While TCP provides end-to-end reliability, having link-layer reliability can
improve overall network performance by preventing errors from propagating up
the stack unnecessarily, especially on noisy links. However, it's not strictly
necessary for every link layer (e.g., standard wired Ethernet typically doesn't
retransmit lost frames at the link layer, relying on TCP for end-to-end reliability).

MAC (or LAN or Physical or Ethernet) Address

●​ Function: Used to identify an interface


○​ A MAC address is a unique identifier assigned to a network interface controller
(NIC) or network adapter. It operates at the Link Layer (Layer 2) of the TCP/IP
model.
○​ Its primary function is to allow frames to be delivered to the correct device on a
local network segment.
●​ 48-bit MAC address
○​ MAC addresses are 48 bits long (6 bytes).
○​ They are typically represented in hexadecimal format, often grouped by pairs,
separated by hyphens or colons.
○​ Example: 1A-2F-BB-76-09-AD
○​ The first 24 bits usually represent the Organizationally Unique Identifier (OUI),
assigned to the manufacturer of the NIC. The last 24 bits are assigned by the
manufacturer to make the address unique.
●​ MAC address portable while IP not portable
○​ MAC Address Portability: A MAC address is generally fixed to the hardware
of the network interface. If you move your laptop from one network (e.g., your
home Wi-Fi) to another (e.g., a coffee shop Wi-Fi), its MAC address remains the
same. It's a hardware-level identifier.
○​ IP Address Non-Portability: An IP address, on the other hand, is a logical
address assigned at the Network Layer (Layer 3). When you move your laptop
from one network to another, its IP address usually changes to one that is
appropriate for the new network (e.g., a new IP from the coffee shop's DHCP
server). This is because IP addresses are designed for global routing, and they
are assigned based on the network segment a device is currently connected to.

ARP: Address Resolution Protocol

Question: How to obtain the MAC address of an IP address? Answer: ARP protocol
This is ARP's sole and critical purpose. The IP layer works with IP addresses, but the Link layer
needs MAC addresses to deliver frames on the local segment. ARP acts as the translator
between these two layers.

How ARP Works (Simplified):

1.​ A host (or router) wants to send an IP packet to another device on the same local
network segment.
2.​ It knows the destination's IP address, but it needs its MAC address to construct the
Link Layer frame.
3.​ The host broadcasts an ARP Request onto the local network segment. This request
basically says: "Who has IP address X.X.X.X? Tell me your MAC address."
4.​ The ARP Request is sent in a Link Layer frame with a special broadcast MAC address
(FF:FF:FF:FF:FF:FF), meaning all devices on the local segment will receive it.
5.​ Only the device that owns X.X.X.X will respond. It sends an ARP Reply directly back to
the requesting host, saying: "I have X.X.X.X, and my MAC address is
YY:YY:YY:YY:YY:YY."
6.​ The requesting host stores this IP-to-MAC mapping in its ARP cache for future use (for
a limited time).

Ethernet Frame Structure (More)

The Ethernet frame is the basic unit of data transferred over an Ethernet network. It
encapsulates the higher-layer packet (like an IP datagram) with its own header and trailer to
ensure reliable delivery on the local link.

Here's a breakdown of the fields you mentioned and their significance:

●​ Addresses: 6-byte Source, Destination MAC Addresses


○​ These are the most fundamental fields for local delivery.
○​ Destination MAC Address: This 6-byte field specifies the MAC address of the
intended recipient node on the local Ethernet segment.
○​ Source MAC Address: This 6-byte field specifies the MAC address of the
sending node on the local Ethernet segment.
○​ Adapter's Role:
■​ When an Ethernet network interface card (NIC) receives a frame, it first
checks the destination MAC address in the frame's header.
■​ If the destination MAC address matches its own MAC address: The
adapter accepts the frame, strips off the Ethernet header and trailer, and
passes the encapsulated data (the higher-layer packet, e.g., an IP
datagram) up to the appropriate higher-layer protocol (indicated by the
"Type" field).
■​ If the destination MAC address is the broadcast address
(FF:FF:FF:FF:FF:FF): The adapter also accepts the frame. Broadcast
frames are intended for all devices on the local segment (e.g., ARP
requests, DHCP requests). Again, the data is passed up.
■​ If the destination MAC address is a multicast address that the adapter
is configured to listen to, it also accepts the frame.
■​ Otherwise (if it's not its own MAC, not broadcast, and not a
subscribed multicast): The adapter discards the frame. This is crucial
for efficiency; devices only process frames explicitly addressed to them,
reducing CPU load.
●​ Type: Indicates Higher Layer Protocol
○​ This 2-byte field (also known as EtherType) tells the receiving NIC which
higher-layer protocol (Network Layer protocol) the encapsulated data belongs to.
○​ This is essential for demultiplexing at the receiver's data link layer. When the
Ethernet header/trailer are stripped, the "Type" field directs the payload to the
correct protocol handler above it.
○​ Examples:
■​ 0x0800 for IP (IPv4): Most common.
■​ 0x0806 for ARP (Address Resolution Protocol): Also very common.
■​ 0x86DD for IPv6.
■​ 0x8137 for Novell IPX.
■​ 0x809B for AppleTalk.
●​ CRC: Cyclic Redundancy Check at Receiver
○​ This is a 4-byte field located in the trailer of the Ethernet frame (often called the
Frame Check Sequence - FCS).
○​ Error Detection: The sending adapter performs a calculation on the entire
frame's data and puts the result in the CRC field. The receiving adapter performs
the same calculation on the received frame data.
○​ If Error Detected: If the calculated CRC at the receiver does not match the CRC
value in the frame's trailer, it indicates that bit errors occurred during transmission
over the physical link. In this case, the frame is dropped by the receiving
adapter.
○​ No Error Correction: Ethernet's CRC provides error detection, but not error
correction. If an error is detected, the frame is simply discarded. It's then up to
higher-layer protocols (like TCP) to detect the loss (via timeouts) and request
retransmission if reliability is needed.

Ethernet Switch Learning (Self-Learning)

Ethernet switches are intelligent devices that operate primarily at the Link Layer (Layer 2).
Unlike old hubs (which simply broadcast everything), switches efficiently forward frames only to
the specific interface where the destination device is connected. They achieve this through a
process called self-learning or forwarding table learning.
●​ Switch Table (MAC Address Table / CAM Table):
○​ A switch maintains a table (often called a MAC address table or Content
Addressable Memory - CAM table) that maps MAC addresses to the specific
physical port (interface) on the switch where that device is connected.
●​ How a Switch Learns:
○​ When an incoming frame arrives from a sending host:
■​ The switch examines the source MAC address of the incoming frame.
■​ It then notes which interface (port) that frame arrived on.
■​ The switch records (or updates) the (MAC address, interface) pair in
its switch table.
■​ Example: If a frame with Source MAC: AA arrives on Interface 1,
the switch adds or updates an entry: AA -> Interface 1.
○​ Purpose of Learning: By learning the source MAC address and its incoming
port for every frame it receives, the switch builds a dynamic map of where
devices are located on its network segments.
●​ How a Switch Forwards (using its table):
○​ When the switch receives a frame, it looks at the destination MAC address in
the frame's header.
○​ If the destination MAC address is found in its table: The switch forwards the
frame only out the specific interface associated with that destination MAC
address. This is called unicast forwarding.
○​ If the destination MAC address is not found in its table (or if it's a
broadcast/multicast address): The switch floods the frame. This means it
sends the frame out all interfaces except the one it came in on. This ensures the
frame reaches its intended recipient even if the switch hasn't learned its location
yet (or if it's a broadcast). Once the destination replies, the switch will learn its
MAC and port.

This self-learning process is what makes Ethernet switches so efficient and intelligent,
drastically reducing unnecessary traffic compared to hubs. It's a key reason why modern LANs
are built around switches.

MCQ questions (chap 1-3)


note: ans given at the bottom.

Access Networks (DSL, Cable, Home Network)

1.​ Which access network technology primarily utilizes existing copper telephone lines for
broadband internet?

A. Cable Network B. Fiber Optic C. Digital Subscriber Line (DSL) D. Satellite Internet

2.​ A key characteristic of a cable access network is that homes in a neighborhood typically:
A. Have a dedicated fiber optic line to the ISP router. B. Share the coaxial cable segment
back to the cable headend. C. Each have a dedicated copper pair to the central office. D.
Connect directly to the internet without a modem.

3.​ What is the primary function of a home network in relation to an ISP's access network?

A. To provide the "last mile" connection from the ISP to the home. B. To manage routing
between different cities. C. To connect devices within the home to each other and share
a single internet connection. D. To replace the need for a modem.

4.​ Which device is essential for connecting devices within a home network wirelessly?

A. DSLAM B. Cable Modem Termination System (CMTS) C. Wireless Router D. Switch


(without Wi-Fi capability)

Internet Protocol Stack

5.​ Which layer of the Internet Protocol stack is responsible for the routing of datagrams
from a source host to a destination host across multiple networks?

A. Application Layer B. Transport Layer C. Network Layer D. Link Layer

6.​ FTP, SMTP, and HTTP are examples of protocols at which layer of the Internet Protocol
stack?

A. Transport Layer B. Network Layer C. Link Layer D. Application Layer

7.​ Which layer of the Internet Protocol stack encapsulates datagrams into frames?

A. Physical Layer B. Data Link Layer (Link Layer) C. Network Layer D. Transport Layer

8.​ The "bits on the wire" are primarily the concern of which layer of the Internet Protocol
stack?

A. Transport Layer B. Network Layer C. Link Layer D. Physical Layer

HTTP Overview & Status Codes

9.​ HTTP operates on which model?

A. Peer-to-peer model B. Client/server model C. Hub-and-spoke model D. Broadcast


model

10.​Which HTTP status code indicates that the request succeeded and the requested object
is in the message body?

A. 301 B. 404 C. 200 D. 505


11.​If a web server responds with a 400 Bad Request status code, what does this typically
mean?

A. The server is currently unavailable. B. The requested document was not found. C.
The client's request message was not understood by the server. D. The server has
moved the requested object.

12.​Which HTTP status code suggests that the requested object has been permanently
relocated to a new URL?

A. 200 B. 404 C. 500 D. 301

DNS: Domain Name System

13.​The primary function of the Domain Name System (DNS) is to translate:

A. MAC addresses to IP addresses. B. Human-readable hostnames to IP addresses. C.


IP addresses to MAC addresses. D. Port numbers to application names.

14.​In the domain name www.example.com, what does .com represent?

A. A Second-Level Domain B. A Root Server C. A Top-Level Domain (TLD) D. A


Subdomain

15.​What is the role of an authoritative name server for a specific hostname?

A. It caches DNS queries for local users. B. It is the DNS server that definitively provides
the answer for that hostname. C. It directs queries to the root servers. D. It performs
MAC-to-IP address resolution.

16.​How many logical root DNS servers are there globally?

A. 1 B. 7 C. 13 D. Hundreds

Internet Transport-Layer Protocols (TCP/UDP, Sockets, Seq/ACK,


Multiplexing/Demultiplexing)

17.​Which transport layer protocol provides unreliable, unordered delivery?

A. TCP B. IP C. UDP D. HTTP

18.​TCP provides which of the following services?

A. Bandwidth guarantees B. Delay guarantees C. Congestion control D. Unordered


delivery

19.​A socket is an interface between which two layers of the Internet Protocol stack?
A. Physical and Link B. Network and Transport C. Transport and Application D.
Application and Physical

20.​When a TCP segment arrives at a receiving host, which unique identifier is primarily
used for demultiplexing it to the correct application process?

A. Source IP address B. Destination MAC address C. Destination Port Number D.


Sequence Number

21.​If a sender transmits a TCP segment with Sequence Number = 500 and the segment
contains 100 bytes of application data, what is the sequence number of the next byte the
sender will transmit?

A. 500 B. 501 C. 600 D. 601

22.​A TCP receiver sends an Acknowledgement (ACK) number of 750. What does this
indicate?

A. The receiver has received byte 750.


B. The receiver expects the next byte from the sender to be byte 750.
C. The receiver has sent 750 bytes of data.
D. The sender should retransmit byte 750.

23.​Which of the following is a characteristic of UDP demultiplexing? A. It relies on the


4-tuple (source IP, source port, dest IP, dest port). B. It primarily uses only the
destination port number. C. It guarantees in-order delivery to the application. D. It
performs retransmissions for lost datagrams.

IP Addressing & Routing (Longest Prefix Matching, Subnets)

24.​When a router needs to forward an IP packet, and multiple entries in its forwarding table
match the destination IP address, which rule does it follow? A. Randomly choose one
matching entry. B. Choose the entry with the shortest prefix match. C. Choose the entry
with the longest prefix match. D. Prioritize the default route.
25.​What is the primary characteristic of devices within the same subnet?

A. They are always in different physical locations. B. They can communicate directly
without an intervening router. C. They must have different network prefixes in their IP
addresses. D. They are connected only by wireless links.

Link Layer (MAC Addresses, ARP, Ethernet Switches)

26.​What is the length of a standard MAC address?

A. 32 bits B. 48 bits C. 64 bits D. 128 bits


27.​Which protocol is used to obtain the MAC address corresponding to a given IP address
on a local network segment?

A. DNS B. DHCP C. ARP D. ICMP

28.​In an Ethernet frame, the Type field indicates what?

A. The length of the frame. B. The priority of the frame. C. The higher layer protocol
encapsulated in the frame. D. The error checking result.

29.​If a Link Layer switch receives a frame with a destination MAC address not found in its
forwarding table, what will it do? A. Discard the frame immediately. B. Send an ARP
request to find the destination. C. Flood the frame out all interfaces except the one it
arrived on. D. Send an ICMP error message back to the source.
30.​Which of the following statements about MAC addresses is true? A. They change as a
packet travels from source to destination across multiple networks. B. They are logical
addresses configured by software. C. They are primarily used for global routing across
the Internet. D. They are fixed to the network interface hardware and remain the same
for a device regardless of the network it connects to.

Answers:

1.​ C
2.​ B
3.​ C
4.​ C
5.​ C
6.​ D
7.​ B
8.​ D
9.​ B
10.​C
11.​C
12.​D
13.​B
14.​C
15.​B
16.​C
17.​C
18.​C
19.​C
20.​C
21.​C
22.​B
23.​B
24.​C
25.​B
26.​B
27.​C
28.​C
29.​C
30.​D

You might also like