CN Unit-1 Lecture Notes
CN Unit-1 Lecture Notes
LECTURE NOTES
COMPUTER NETWORKS
FACULTY NAME :
YEAR III
SEMESTER I
STREAM : CSE
UNIT-I
Computer Networks
Network hardware, Network software, OSI, TCP/IP Reference models, Example Networks:
Internet, ARPANET. Physical Layer: Guided Transmission media: twisted pairs, coaxial
cable, Power lines, fiber optics. Wireless transmission: Electromagnetic spectrum, Radio
transmission, Microwave transmission, Infrared transmission, and Light transmission
1.3 ARPANET:
– small size
– transmission technology
• single cable
• 10Mbps ~ 10Gb/s
• 10Gb/s : 10,000,000.000 bps
– topology:
• bus
– Ethernet (IEEE 802.3): 10 or 100 Mbps (10Gb/s)
• ring
– IBM token ring (IEEE 802.5): 4 or 16 Mbps
1.5. Intranet: An intranet is a private network that is contained within an enterprise. It may
consist of many interlinked local area networks and also use leased lines in the wide area
network.
An intranet uses TCP/IP,HTTP, and other Internet protocols and in general looks like a private
version of the Internet. With tunnenling, companies can send private messages through the
public network, using the public network with special encryption/decryption and other security
safeguards to connect one part of their intranet to another.
Internet: is a worldwide system of computer networks - a network of networks in which users at
any one computer can, if they have permission, get information from any other computer (and
sometimes talk directly to users at other computers).
Bus Toplogy
it is difficult to add a workstation
have to completely reroute the cable and possibly run two additional lengths ofit.
if any one of the cables breaks, the entire network is disrupted. Therefore, it isvery
expensive to maintain.
A bus is the simplest physical topology. It consists of a single cable that runs toevery
workstation
This topology uses the least amount of cabling, but also covers the shortestamount of
distance.
2. STAR Topology
• Star topologies are easy to install. A cable is run from each workstation tothe hub. The
hub is placed in a central location in the office.
• Star topologies are more expensive to install than bus networks, because there are several
more cables that need to be installed, plus the cost of the hubs that are needed.
3. Ring Topology:
• Each computer connects to two other computers, joining them in a circle creating a
unidirectional path where messages move workstation to workstation.
• Each entity participating in the ring reads a message, then regenerates it and hands it to
its neighbor on a different network cable.
4. Mesh Toplogy:
• The mesh topology is the simplest logical topology in terms of data flow, butit is the most
complex in terms of physical design.
• In this physical topology, each device is connected to every other device
• This topology is rarely found in LANs, mainly because of the complexity ofthe cabling.
• If there are x computers, there will be (x × (x–1)) ÷ 2 cables in the network.For example,
if you have five computers in a mesh network, it will use 5 × (5 – 1) ÷ 2, which equals
10 cables. This complexity is compounded when you add another workstation.
5. Hybrid topology: A hybrid topology is a type of network topology that uses two or more
differing network topologies. These topologies can include a mix of bus topology, mesh
topology, ring topology, star topology, and tree topology
Application to Application
PRESENTATION PRESENTATION
Application to Application
SESSION SESSION
Source to Destination
Router
Source to Destination
Hop to Hop
Switch
Hop to Hop
29
Applica Application
Telnet, FTP, SMTP, To allow access to
tion
HTTP, DNS, SNMP, network resources
Specific address etc…
Physical Layer
From data link layer To data link layer
Physical layer
110 10101000000010 111 110 10101000000010111 Physical layer
Transmission medium
One of the major function of the physical layer is to move data in the form of electromagnetic signals across a
transmission medium.
Its responsible for movements of individual bits from one hop (Node) to next. Both data and the signals can be
either analog or digital.
Transmission media work by conducting energy along a physical path which can be wired or wireless
Concerned:
Physical characteristics of interface and medium (Transmission medium)
Representation of bits (stream of bits (0s or 1s) with no interpretation and encoded into signals) Data
rate (duration of a bit, which is how long it last)
Synchronization of bits (sender and receivers clock must be synchronized) Line configuration (Point-to-
Point, Point-to-Multipoint)
Physical topology
Transmission mode (Simplex, half duplex, full duplex)
Data link layer is responsible for moving frames from one hop (Node) to the next.
Concerned:
Framing (stream of bits into manageable data units) Physical
addressing (MAC Address)
Flow Control (mechanism for overwhelming the receiver) Error
Control (trailer, retransmission)
Access Control (defining master device in the same link)
32
The network layer is responsible for the delivery of individual packets from the source host to
the destination host.
Concerned:
Logica l a ddressing (IP Address)
Routing (Source to destination transmission betweennetworks)
33
H
4 D H D H
4 D
a 4 at
at at
Segments Segments
a a
To network layer From network layer
The transport layer is responsible for the delivery of a message from one process to another
Concerned:
•Service-point addressing (Port address)
• .Segmentation and reassembly (Sequence umber)
• Connection control (Connectionless or connection oriented) Flow control
(end to end)
• Error Control (Process to Process)
Concerned:
•Dialog Control (Half Duplex/Full duplex)
• Synchronization (Synchronization points, process
inline within same page)
35
Concerned:
• Translation (interoperability between different encoding system)
Encryption (Privacy schemes)
• Compression (data compression)
Application layer
Application layer
To presentation layer
From presentation layer
The application layer is responsible f or prov iding serv ices to the user.
Concerned:
Network virtual terminal (Software) File transfer, access and management Mail services
Directory services (access to distributed database sources for global information about various objects
and services)
37
APPLICATION Layer: This layer also contains the high level protocols. The main issue
with this layer is the ability to use both TCP and
• UDP protocols.
TRANSPORT Layer: This layer acts as the delivery service used by the application layer.
Again the two protocols used are TCP and UDP.
The choice is made based on the application's transmission reliability requirements.
The transport layer also handles all error detection and recovery.
INTERNET Layer: This layer is also known as Internet layer. The main purpose of this
layer is to organize or handle the movement of data on network.
Physical &Data link Layer: This layer is also known as network interface layer
This layer normally consists of device drivers in the OS and the network interface card
attached to the system.
Both the device drivers and the network interface card take care of the communication
details with the media being used to transfer the data over the network
• Higher bandwidth
– 400 to 600Mhz
– up to 10,800 voice conversations
• Can be tapped easily (pros and cons)
• Switch:
– Split large networks into small segments, decreasing the number of users sharing
the same network resources and bandwidth.
– Understands when two devices want to talk to each other, and gives them a
switched connection
– Helps prevent data collisions and reduces network congestion, increasing network
performance.
– Most home users get very little, if any, advantage from switches, even when
sharing a broadband connection.
• Bridge
Resides on Layer 2 of the OSI model.
– Connects two LANs and forwards or filters data packets between them.
– Creates an extended network in which any two workstations on the linked LANs
can share data.
– Transparent to protocols and to higher level devices like routers.
– Forward data depending on the Hardware (MAC) address, not the Network
address (IP).
– Resides on Layer 2 of the OSI model.
• Repeater
– Used to boost the signal between two cable segments or wireless access points.
– Can not connect different network architecture.
– Does not simply amplify the signal, it regenerates the packets and retimes them.
Resides on Layer 1 of the OSI model
• Router
– A device that connects any number of LANs.
– Uses standardized protocols to move packets efficiently to their destination.
– More sophisticated than bridges, connecting networks of different types (for
example, star and token ring)
– Forwards data depending on the Network address (IP), not the Hardware (MAC)
address.
– Routers are the only one of these four devices that will allow you to share a single
IP address among multiple network clients.
– Resides on Layer 3 of the OSI model.
• Additional Network Hardware Devices
Example Networks
Internet
ARPANET
NSFNET
Third-generation mobile phone networks
Wireless LANs: 802.11
RFID and sensor networks
Example Networks
Internet
The Internet is not really a network at all, but a vast collection of different networks that use certain
common protocols and provide certain common services.
It is an unusual system in that it was not planned by anyone and is not controlled by anyone.
Architecture of the Internet
Example Networks
Internet
Architecture of the Internet
To join the Internet, the computer is connected to an Internet Service Provider, or simply ISP, from
who the user purchases Internet access or connectivity.
A common way to connect to an ISP is to use the phone line to your house, in which case your phone
company is your ISP.
DSL, short for Digital Subscriber Line, reuses the telephone line that connects to your house for
digital data transmission.
The computer is connected to a device called a DSL modem that converts between digital packets
and analog signals that can pass unhindered over the telephone line.
At the other end, a device called a DSLAM (Digital Subscriber Line Access Multiplexer) converts
between signals and packets.
ARPANET
ARPANET stands for Advanced Research Projects Agency NET.
ARPANET was the first network which consisted of distributed control.
It was the first to implement TCP/IP protocols.
It was basically the beginning of the Internet with the use of these technologies.
It was designed with a basic idea in mind that was to communicate with scientific users among an
institute or university.
History of ARPANET :
ARPANET was introduced in the year 1969 by the Advanced Research Projects Agency (ARPA) of
US Department of Defense.
It was established using a bunch of PCs at various colleges and sharing of information and messages
was done.
It was for playing as long separation diversions and individuals were asked to share their perspectives.
In the year 1980, ARPANET was handed over to a different military network, Defense Data Network.
Characteristics of ARPANET :
Example Networks
ARPANET
It is basically a type of WAN.
It used the concept of Packet Switching Network.
It used Interface Message Processors(IMPs) for sub-netting.
ARPANETs software was split into two parts- a host and a subnet.
Advantages of ARPANET :
ARPANET was designed to service even in a Nuclear Attack.
It was used for collaborations through E-mails.
It created advancement in the transfer of important files and data of defense.
Limitations of ARPANET :
Increased number of LAN connections resulted in difficulty handling.
It was unable to cope-up with advancements in technology.
Appropriate for low error rate and real-time traffic. Ex: Ethernet
Acknowledged connectionless service.
3) Flow Control: A receiving node can receive the frames at a faster rate than
it can process the frame. Without flow control, the receiver's buffer can
overflow, and frames can get lost. To overcome this problem, the data link layer uses
the flow control to prevent the sending node on one side ofthe link from
overwhelming the receiving node on another side of the link.This prevents traffic
jam at the receiver side.
4) Error Control: Error control is achieved by adding a trailer at the end ofthe
frame. Duplication of frames are also prevented by using this mechanism. Data Link
Layers adds mechanism to prevent duplication of frames.
5) Error detection: Errors can be introduced by signal attenuation and noise. Data
Link Layer protocol provides a mechanism to detect one or more errors. This is
achieved by adding error detection bits in the frame and thenreceiving node can
perform an error check.
6) Error correction: Error correction is similar to the Error detection, except that
receiving node not only detects the errors but also determine wherethe errors have
occurred in the frame.
7) Access Control: Protocols of this layer determine which of the devices has
control over the link at any given time, when two or more devices are connected to the
same link.
8) Reliable delivery: Data Link Layer provides a reliable delivery service, i.e.,
transmits the network layer datagram without any error. A reliable delivery service is
accomplished with transmissions and
acknowledgements. A data link layer mainly provides the reliable delivery service
over the links as they have higher error rates and they can be corrected locally, link at
which an error occurs rather than forcing toretransmit the data.
9) Half-Duplex & Full-Duplex: In a Full-Duplex mode, both the nodes can
transmit the data at the same time. In a Half-Duplex mode, only one node can
transmit the data at the same time.
FRAMING
To provide service to the network layer, the data link layer must use the
service provided to it by the physical layer. What the physical layer does is
accept a raw bit stream and attempt to deliver it to the destination. This bit
stream is not guaranteed to be error free. The number of bits received may be
less than, equal to, or more than the number of bits transmitted, and they
may have different values. It is up to the data link layer to detect
and, if necessary, correct errors. The usual approach is for the data link layer
to break the bit stream up into discrete frames and compute the checksum for
each frame (framing). When a frame arrives at the destination, the checksum
is recomputed. If the newly computed checksum is different from the one
contained in the frame, the data link layer knows that an error has occurred and
takes steps to deal with it (e.g., discarding the bad frame and possibly also
sending back an error report).
We will look at four framing methods:
Character count.
Character count method uses a field in the header to specify the number of
characters in the frame. When the data link layer at the destination sees the
character count, it knows how many characters follow and hence where the
end of the frame is. This technique is shown in Fig.
(a) For four frames of sizes 5, 5, 8, and 8 characters, respectively.
A frame delimited by flag bytes (b) Four examples of byte sequences before
and after byte stuffing
Starting and ending flags, with bit stuffing allows data frames to contain an
arbitrary number of bits and allows character codes with an arbitrary number
of bits per character. It works like this. Each frame begins and endswith a
special bit pattern, 01111110 (in fact, a flag byte).
Whenever the sender's data link layer encounters five consecutive 1s in the
data, it automatically stuffs a 0 bit into the outgoing bit stream. This bit stuffing
is analogous to byte stuffing, in which an escape byte is stuffed into the
outgoing character stream before a flag byte in the data.
When the receiver sees five consecutive incoming 1 bit, followed by a 0 bit,it
automatically de- stuffs (i.e., deletes) the 0 bit. Just as byte stuffing is completely
transparent to the network layer in both computers, so is bit stuffing. If the user
data contain the flag pattern, 01111110, this flag istransmitted as 011111010
but stored in the receiver's memory as 01111110.
Fig: Bit stuffing. (a) The original data. (b) The data as they appear on the line.
(c) The data as they are stored in the receiver's memory after destuffing.
the bit boundaries. The combinations high- high and low-low are not used for data but
are used for delimiting frames insome protocols.
ERROR DETECTION
Error is a condition when the receiver’s information does not match with
the sender’s information. During transmission, digital signals suffer from
noise that can introduce errors in the binary bits travelling from sender to
receiver. That means a 0 bit may change to 1 o r a 1 b i t m a y c h a
nge to 0.
3) Checksum
In checksum error detection scheme, the data is divided into k segmentseach
of m bits. In thesender’s end the segmentsare added using1’s complement
arithmetic to get the sum. The sum is complemented to get the checksum.
The checksum segment is sent along with the data segments.
At the receiver’s end, all received segments are added using 1’s
complementarithmetic to get the sum. The sum is complemented.
At the destination, the incoming data unit is divided by the same number. Ifat
this step there is no remainder, the data unit is assumed to be correct and is
therefore accepted.
A remainder indicates that the data unit has been damaged in transit and
therefore must be rejected.
ERROR CORRECTION
Error Correction codes are used to detect and correct the errors when data
istransmitted from the sender to the receiver.
Error Correction can be handled in two ways: Backward error correction:
Once the error is discovered, the
receiver requeststhe sender to retransmit the entire data unit.
Forward error correction: In this case, the receiver uses the error-correcting
code which automatically corrects the errors.
A single additional bit can detect the error, but cannot correct it.
For correcting the errors, one has to know the exact position of the error. For
example, If we want to calculate a single-bit error, the error correction code
willdetermine which one of seven bits is in error. To achieve this, we have to
add some additional redundant bits.
Suppose r is the number of redundant bits and d is the total number of the data
bits. The number of redundant bits’ r can be calculated by using the formula:
r
2 >=d+r+1
The value of r is calculated by using the above formula. For example, if the
value of d is 4, then the possible smallest value that satisfies the above relation
would be 3.
To determine the position of the bit which is in error, a technique developed
by R.W Hamming is Hamming code which can be applied to any length of the
dataunit and uses the relationship between data units and redundant units.
HAMMING CODE
Parity bits: The bit which is appended to the original data of binary bits so
thatthe total number of 1s is even or odd.
Even parity: To check for even parity, if the total number of 1s is even, then
the
value of the parity bit is 0. If the total number of 1s occurrences is odd, then
thevalue of the parity bit is 1.
Odd Parity: To check for odd parity, if the total number of 1s is even, then
the
value of parity bit is 1. If the total number of 1s is odd, then the value of
paritybit is 0.
At the receiving end, the parity bits are recalculated. The decimal value of
theparity bits determines the position of an error.
Relationship b/w Error position & binary number
r r >
Number of redundant bits r: 2 >= d+r+1 2 = 4+r+1
We observe from the above figure that the bit position that includes 1 in
the first position are 1, 3, 5, 7. Now, we perform the even-parity check at
these bitpositions.
We observe from the above figure that the bit positions that includes 1 in the
We observe from the above figure that the bit positions that includes 1 in thethird
position are 4, 5, 6, 7. Now, we perform the even-parity check at these bit positions.
The total number of 1 at these bit positions corresponding to r4 is even, therefore,
the value of the r4 bit is 0.