Lecture-1
Introduction to Computer Networks &
Network Models
Core Topics:
● Definition and Goals of Networking
Types: LAN, WAN, PAN
● OSI and TCP/IP Models: Layer-wise Responsibilities
● Protocols Overview (IP, TCP, UDP, HTTP, FTP)
Computer Networks
Definition
A computer network is a collection of interconnected devices
(computers, servers, network devices) that communicate and
share resources.
Key Elements:
• Computers/Devices
• Communication links
• Network devices (routers, switches)
• Network protocols
Importance
Resource Sharing: Enables sharing of resources such as printers, files,
and internet connections.
Communication: Facilitates communication through emails, instant
messaging, and video conferencing.
Data Exchange: Allows for the exchange of data and information
between devices.
Goals of Networking
1. Resource Sharing:
Access shared hardware like printers, storage, or software.
2. Communication:
Exchange of information via email, messaging, video conferencing.
3. Remote Access:
Access resources and systems from different locations.
4. Scalability:
Easily add new devices or services.
5. Reliability and Redundancy:
Ensure continuous operation and data availability.
Benefits of Networking
• Cost efficiency
• Centralized data management
• Improved productivity and collaboration
• Data security and backup
Real-Life Applications
•Office and corporate networks
•Educational institutions
•Cloud computing
•E-commerce and online services
Applications
• E-mail
• Searchable Data (Web Sites)
• E-Commerce
• News Groups
• Internet Telephony (VoIP)
• Video Conferencing
• Chat Groups
• Instant Messengers
• Internet Radio
Computer Network
Computer Network
Computers: Clients and Servers
• In a client/server network arrangement, network services are located
in a dedicated computer whose only function is to respond to the
requests of clients.
• The server contains the file, print, application, security, and other
services in a central computer that is continuously available to
respond to client requests.
LAN, MAN, PAN and WAN
LAN
• LAN (Local Area Network) connects devices in a small area like a
home or office, MAN (Metropolitan Area Network) spans a city or
large campus, and WAN (Wide Area Network) covers broader
geographical areas like the Internet, connecting multiple MANs and
LANs.
• LAN (Local Area Network):
• Definition:
geographicalA area.
network that connects devices within a small
• Examples: Home network, office network, school network.
• Characteristics: Private, high speed, easy maintenance.
• Ownership: Typically private, owned by individuals or
organizations.
• Cost: Least expensive to implement.
• Speed: Fast, with transmission rates up to 800 to 1000 mbps.
MAN
• Definition: A network that connects devices within a metropolitan
area, such as a city or a large campus.
• Examples: City-wide telecommunications network, university campus
network.
• Characteristics: Larger than a LAN, smaller than a WAN.
• Ownership: Can be private or public.
• Cost: More expensive than LAN but less expensive than WAN.
• Speed: Moderate, with transmission rates up to 50 to 100 mbps.
WAN
• WAN (Wide Area Network):
• Definition: A network that connects devices across a large
geographical area, such as a country or continent.
• Examples: The Internet, a network connecting offices across different
countries.
• Characteristics: Global in scope, connects multiple MANs and LANs.
• Ownership: Can be private or public.
• Cost: Most expensive to implement.
• Speed: Slower than LAN and MAN, transmission rates typically
below 100 mbps.
PAN
PAN (Personal Area Network):
•Connects devices within a small radius, typically around 30 feet.
•Examples: Bluetooth, Wi-Fi for personal devices.
•Used for communication between devices within a person's immediate vicinity.
OSI Model
• This model is based on a proposal developed by the International
Standards Organization (ISO) as a first step toward international
standardization of the protocols used in the various layers.
• The model is called the Open Systems Interconnection (OSI)
Reference Model because it deals with connecting open systems. It
was first introduced in the late 1970s.
• An open system is a set of protocols that allows any two different
systems to communicate regardless of their underlying architecture.
• The purpose of the OSI model is to show how to facilitate
communication between different systems without requiring changes
to the logic of the underlying hardware and software.
• The OSI model is not a protocol; it is a model for understanding and
designing a network architecture that is flexible, robust, and
interoperable.
• The OSI model is a layered framework for the design of network
systems that allows communication between all types of computer
systems.
It consists of seven separate but related layers, each of
which defines a part of the process of moving information
across a network
• As the message travels from A to B, it may pass through many
intermediate nodes. These intermediate nodes usually involve only the
first three layers of the OSI model.
• Each layer defines a family of functions distinct from those of the
other layers.
• Within a single machine, each layer calls upon the services of the layer
just below it. Layer 3, for example, uses the services provided by layer
2 and provides services for layer 4.
Physical Layer
• The physical layer coordinates the functions required to carry a bit
stream over a physical medium.
• It deals with the mechanical and electrical specifications of the
interface and transmission media.
• It also defines the procedures and functions that physical devices and
interfaces have to perform for transmission to occur.
• Physical characteristics of interfaces and media.
• The physical layer defines the characteristics of the interface
between the devices and the transmission media.
• It also defines the type of transmission media.
• Representation of bits.
• To be transmitted, bits must be encoded into signals—
electrical or optical. The physical layer defines the type of
encoding (how 0s and 1s are changed to signals).
• Data rate.
• The transmission rate—the number of bits sent each second.
• Synchronization of bits -the sender and the receiver clocks must be
synchronized.
• Line configuration (point-to-point, multipoint).
• Physical topology (mesh, bus, star, ring)
• Transmission mode (simplex mode, half-duplex, full-duplex)
Data Link Layer
• The data link layer transforms the physical layer, a raw transmission
facility, to a reliable link. It makes the physical layer appear error-free
to the upper layer (network layer).
• Framing. -The data link layer divides the stream of bits received from
the network layer into manageable data units called frames.
• Physical addressing.
If frames are to be distributed to different systems on the network,
the data link layer adds a header to the frame to define the sender
and/or receiver of the frame. If the frame is intended for a system
outside the sender’s network, the receiver address is the address of
the connecting device that connects the network to the next one.
• Flow control.
• If the rate at which the data is absorbed by the receiver is less than
the rate produced at the sender, the data link layer imposes a flow
control mechanism to prevent overwhelming the receiver.
• Error control.
• The data link layer adds reliability to the physical layer by adding
mechanisms to detect and retransmit damaged or lost frames. It also
uses a mechanism to recognize duplicate frames. Error control is
normally achieved through a trailer added to the end of the frame.
• Access control.
• When two or more devices are connected to the same link, data link
layer protocols are necessary to determine which device has control
over the link at any given time.
Network Layer
• The network layer is responsible for the source-to-destination delivery
of a packet, possibly across multiple networks (links).
• Whereas the data link layer oversees the delivery of the packet between
two systems on the same network (link), the network layer ensures that
each packet gets from its point of origin to its final destination.
• If two systems are connected to the same link, there is usually no need
for a network layer. However, if the two systems are attached to
different networks (links) with connecting devices between the
networks (links), there is often a need for the network layer to
accomplish source-to-destination delivery.
Logical addressing.
• The physical addressing implemented by the data link layer handles
the addressing problem locally. If a packet passes the network
boundary, we need another addressing system to help distinguish the
source and destination systems. The network layer adds a header to the
packet coming from the upper layer that, among other things, includes
the logical addresses of the sender and receiver.
• Routing.
• When independent networks or links are connected together to create
internetworks (network of networks) or a large network, the connecting
devices (called routers or switches) route or switch the packets to their
final destination. One of the functions of the network layer is to
provide this mechanism.
Transport Layer
• The transport layer is responsible for process-to-process delivery of
the entire message. A process is an application program running on the
host.
• The transport layer, ensures that the whole message arrives intact and
in order.
• Service-point addressing.
• The transport layer header must add a type of address called a service-
point address (or port address). The network layer gets each packet to
the correct computer; the transport layer gets the entire message to the
correct process on that computer.
• Segmentation and reassembly.
• A message is divided into transmittable segments, with each segment
containing a sequence number. These numbers enable the transport layer
to reassemble the message correctly upon arriving at the destination and
to identify and replace packets that were lost in transmission.
• Connection control.
• The transport layer can be either connectionless or connection-oriented.
• Flow control.
• Like the data link layer, the transport layer is responsible for flow
control. However, flow control at this layer is performed end to end
rather than across a single link.
• Error control.
• Like the data link layer, the transport layer is responsible for error
control. However, error control at this layer is performed process-to-
process rather than across a single link. Error correction is usually
achieved through retransmission.
Session Layer
• The session layer is the network dialog controller. It establishes,
maintains, and synchronizes the interaction between communicating
systems.
• Dialog control.
• The session layer allows two systems to enter into a dialog. It allows
the communication between two processes to take place in either half-
duplex or full-duplex mode.
• Synchronization.
• The session layer allows a process to add checkpoints
(synchronization points) into a stream of data. For example, if a
system is sending a file of 2,000 pages, it is advisable to insert
checkpoints after every 100 pages to ensure that each 100-page unit is
received and acknowledged independently. In this case, if a crash
happens during the transmission of page 523, the only pages that need
to be resent after system recovery are pages 501 to 523. Pages
previous to 501 need not be resent.
Presentation Layer
• The presentation layer is concerned with the syntax and semantics of the
information exchanged between two systems.
• Translation.
• The presentation layer is responsible for interoperability between these
different encoding methods.
• The presentation layer at the sender changes the information from its sender-
dependent format into a common format. The presentation layer at the
receiving machine changes the common format into its receiver-dependent
format.
• Encryption.
• Compression.
Application Layer
• The application layer enables the user, whether human or software, to
access the network.
• It provides user interfaces and support for services such as electronic
mail, remote file access and transfer, shared database management,
and other types of distributed information services.
Summary of OSI Layers
TCP/IP PROTOCOL SUITE
• The first layered protocol model for internetwork communications was
created in the early 1970s and is referred to as the Internet model. It
defines four categories of functions that must occur for
communications to be successful. The architecture of the TCP/IP
protocol suite follows the structure of this model. Because of this, the
Internet model is commonly referred to as the TCP/IP model.
• The TCP/IP protocol suite was developed prior to the OSI model.
Therefore, the layers in the TCP/IP protocol suite do not match exactly
with those in the OSI model. The original TCP/IP protocol suite was
defined as four software layers built upon the hardware.
TCP/IP PROTOCOL SUITE
Today, TCP/IP is thought of as a five-layer model with the layers named
similarly to the ones in the OSI model.
Comparison between OSI and TCP/IP Protocol Suite
Layers in the TCP/IP Protocol Suite
• When we study the purpose of each layer, it is easier to think of a
private internet, instead of the global Internet. Such an internet is made
up of several small networks called links.
• A link is a network that allows a set of computers to communicate
with each other. A link can be a LAN or WAN.
• Our imaginary internet that is used to show the purpose of each layer
Physical Layer
• TCP/IP does not define any specific protocol for the physical layer. It
supports all of the standard and proprietary protocols.
• At this level, the communication is between two hops or nodes, either
a computer or router.
• The unit of communication is a single bit. When the connection is
established between the two nodes, a stream of bits is flowing between
them. The physical layer, however, treats each bit individually.
We are assuming that at this moment the two computers have
discovered that the most efficient way to communicate with each
other is via routers R1, R3, and R4.
Computer A sends each bit to router R1 in the format of the protocol used
by link 1. Router 1 sends each bit to router R3 in the format dictated by the
protocol used by link 3. And so on.
Data Link Layer
• TCP/IP does not define any specific protocol for the data link layer
either. It supports all of the standard and proprietary protocols.
• At this level, the communication is also between two hops or nodes.
The unit of communication however, is a packet called a frame.
• A frame is a packet that encapsulates the data received from the
network layer with an added header and sometimes a trailer.
• The head includes the source and destination of frame. The destination
address is needed to define the right recipient of the frame. The source
address is needed for possible response or acknowledgment as may be
required by some protocols.
• Note that the frame that is travelling between computer A and router
R1 may be different from the one travelling between router R1 and
R3.
• When the frame is received by router R1, this router passes the frame
to the data link layer protocol (left). The frame is opened, the data are
removed.
• The data are then passed to the data link layer protocol (right) to create
a new frame to be sent to the router R3
Network Layer
• At the network layer (or, more accurately, the internetwork layer),
TCP/IP supports the Internet Protocol (IP).
• The Internet Protocol (IP) is the transmission mechanism used by the
TCP/IP protocols.
• IP transports data in packets called Datagrams, each of which is
transported separately. Datagrams can travel along different routes and
can arrive out of sequence or be duplicated.
• IP does not keep track of the routes and has no facility for reordering
datagrams once they arrive at their destination.
• Note that there is a main difference between the communication at the
network layer and the communication at data link or physical layers:
• Communication at the network layer is end to end while the
communication at the other two layers are node to node.
• The datagram started at computer A is the one that reaches computer
B. The network layers of the routers can inspect (check) the source
and destination of the packet for finding the best route, but they are
not allowed to change the contents of the packet.
Transport Layer
• There is a main difference between the transport layer and the network
layer.Although all nodes in a network need to have the network layer,
only the two end computers need to have the transport layer.
• The network layer is responsible for sending individual datagrams from
computer A to computer B; the transport layer is responsible for
delivering the whole message, which is called a Segment, a user
datagram, or a packet, from A to B.
• A segment may consist of a few or tens of datagrams. The segments
need to be broken into datagrams and each datagram has to be
delivered to the network layer for transmission.
• Since the Internet defines a different route for each datagram, the
datagrams may arrive out of order and may be lost. The transport layer
at computer B needs to wait until all of these datagrams to arrive,
assemble them and make a segment out of them.
Traditionally, the transport layer was represented in the TCP/IP suite by
two protocols:
• Transmission Control Protocol (TCP): is a reliable connection-
oriented protocol that allows a byte stream originating on one
machine to be delivered without error on any other machine in the
internet. TCP also handles flow control to make sure a fast sender
cannot swamp a slow receiver with more messages than it can handle.
• User Datagram Protocol (UDP): UDP is an unreliable, connectionless
protocol for applications that do not want TCP’s sequencing or flow
control and wish to provide their own. It is also widely used for one-
shot, client-server-type request-reply queries and applications in
which prompt delivery is more important than accurate delivery, such
as transmitting speech or video. Its advantage low overhead.
Application Layer
• The application layer in TCP/IP is equivalent to the combined session,
presentation, and application layers in the OSI model. The application
layer allows a user to access the services of our private internet or the
global Internet. Many protocols are defined at this layer to provide
services such as electronic mail, file transfer, accessing the World
Wide Web, and so on.
• Note that the communication at the application layer, like the one at
the transport layer, is end to end. A message generated at computer A
is sent to computer B without being changed during the transmission.
Protocols Overview
IP
TCP
UDP
HTTP
FTP
Internet Protocol (IP)
• IP provides connectionless (datagram) service
• Each packet treated separately
• Network layer protocol common to all routers
• – which is the Internet Protocol (IP)
Example Internet Protocol Operation
Internet Protocol (IP) Version 4
Header + Data using IPv4
• An IPv4 address is 32 bits long
• The IPv4 addresses are unique and universal
• The address space of IPv4 is 232 or 4,294,967,296
• 32 bit address is divided into 4 octet ( also known as byte)
• To connect on internet each device requires a unique IP address
IPv4 Addressing
Eg:
– Change the following IPv4 addresses from binary notation to
dotted-decimal notation
– 10000001 00001011 00001011 11101111
Solution
– 129.11.11.239
Classful addressing
In classful addressing, the address space is
divided into five classes: A, B, C, D, and
E
Eg:
– Find the class of each address
– a. 00000001 00001011 00001011 11101111
– b. 11000001 10000011 00011011 11111111
– c. 14.23.120.8
– d. 252.5.15.111
Solution
– a. The first bit is 0. This is a class A address
– b. The first 2 bits are 1; the third bit is 0. This is a class C address
– c. The first byte is 14; the class is A
– d. The first byte is 252; the class is E
Classes
Structure of IPv4 Address
• Mask
– 32-bit number of contiguous 1’s
followed by contiguous 0’s
– To help to find the net ID and the host
ID
IPv4 datagram format
IPV6
• The network layer protocol in the TCP/IP protocol suite is currently
IPv4
• Although IPv4 is well designed, data communication has evolved
since the
• inception of IPv4 in the 1970s
• IPv4 has some deficiencies that make it unsuitable for the fast-
growing Internet
IPv6 datagram header and payload
Format of an IPv6 datagram
Next header codes for IPv6
Comparison between IPv4 and IPv6 packet headers
TCP Protocol
TCP
• TCP is a connection-oriented protocol
• It creates a virtual connection between two TCPs to send data
• In addition, TCP uses flow and error control mechanisms at the transport
level
TCP segments
• The bytes of data being transferred in each connection are numbered by
TCP
• The numbering starts with an arbitrarily generated number
Eg:
• Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte
is numbered 10,001. What are the sequence numbers for each segment if
data are sent in five segments, each carrying 1,000 bytes?
TCP segment
format
Control
field
TCP Window
Management
• TCP uses two windows (send window and receive window) for each
direction of data transfer, which means four windows for a
bidirectional communication
• To make the discussion simple, we make an assumption that
communication is
• only unidirectional
• The bidirectional communication can be inferred using two
unidirectional communications with piggybacking
Send window in
TCP
Receive window in TCP
TCP
connection
• TCP is connection-oriented and it establishes a virtual path between the
source
and destination
• TCP, which uses the services of IP, a connectionless protocol, can be
connection- oriented
• All of the segments belonging to a message are sent over this virtual path
• The point is that a TCP connection is virtual, not physical
• TCP operates at a higher level and uses the services of IP to deliver
individual
segments to the receiver, but it controls the connection itself
• If a segment is lost or corrupted, it is retransmitted
Connection establishment using three-way
handshake
seq: 8000
S
SYN
seq: 15000
ack: 8001
5000
A S rwnd:
SYN + ACK
seq: 8000
ack: 15001
A rwnd: 10000
ACK
Means “no data” !
seq: 8001 if piggybacking
Data
transfer
Pushing data
Urgent data
Connection Termination
Connection termination using three-way
handshaking
Congestion
control
• Congestion control in TCP is based on both open loop and closed-
loop mechanisms
• TCP uses a congestion window and a congestion policy that avoid
congestion
and detect
UDP
UDP
• UDP provides
– best effort delivery
– Connectionless
– Unreliable
– Out of order delivery
• TCP
– Reliable
– In-order delivery
– Congestion control
– Flow control
– Connection setup
UDP
• The User Datagram Protocol (UDP) is called a connectionless,
unreliable transport protocol
• It does not add anything to the services of IP except to provide process-to-
process communication instead of host-to-host communication
UDP
format
Pseudoheader for checksum
calculation
FTP
FTP
File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP
for copying a file from one host to another
FTP
• FTP uses the services of TCP
• It needs two TCP connections
• The well-known port 21 is used for the control connection and the well-
known
port 20 for the data connection
Opening the control
connection
Creating the data
connection
HTTP
transaction
Request and response
messages
Request and status
lines
Methods
Header
format
Exampl
e
• HTTP version 1.1 specifies a persistent connection by default
Exampl
e