Pdf24-JNTUA Computer Networks Notes - R20
Pdf24-JNTUA Computer Networks Notes - R20
me/jntua
Physical Structures:
Type of Connection
A network is two or more devices connected through links. A link is a communications pathway that
transfers data from one device to another. There are two possible types of connections: point-to-point and
multipoint.
Point-to-Point:
A point-to-point connection provides a dedicated link between two devices. The entire capacity of the link Fig: Mesh Topology
is reserved for transmission between those two devices.
Advantages:
Multipoint: The use of dedicated links guarantees that each connection can carry its own data load, thus eliminating
A multipoint (also called multidrop) connection is one in which more than two specific devices share a the traffic problems that can occur when links must be shared by multiple devices.
single link. A mesh topology is robust. If one link becomes unusable, it does not incapacitate the entire system.
There is the advantage of privacy or security. When every message travels along a dedicated line, only
the intended recipient sees it. Physical boundaries prevent other users from gaining access to messages.
Finally, point-to-point links make fault identification and fault isolation easy.
Disadvantages:
Installation and reconnection are difficult.
The sheer bulk of the wiring can be greater than the available space can accommodate.
The hardware required to connect each link (I/O ports and cable) can be prohibitively expensive.
Ex: connection of telephone regional offices.
Star Topology
Advantages:
A ring is relatively easy to install and reconfigure.
Fig: Star Topology
Advantages: To add or delete a device requires changing only two connections.
Less expensive than a mesh topology. Fault isolation is simplified.
Easy to install and reconfigure. Disadvantages:
Unidirectional traffic can be a disadvantage.
Additions, moves, and deletions involve only one connection: between that device and the hub.
Star topology is robust. A break in the ring (such as a disabled station) can disable the entire network.
If one link fails, only that link is affected. All other links remain active. This factor also lends itself to Network Types:
easy fault identification and fault isolation. One network can be distinguished from another network based on few criteria such as size, Geographical
Hub can be used to monitor link problems and bypass defective links. area, and ownership. There are 2 basic types of Networks. They are Local area networks and Wide Area
Disadvantage: Networks.
Star topology is the dependency of the whole topology on one single point, the hub. If the hub goes
down, the whole system is dead. Local Area Network (LAN): LAN’s, are privately-owned networks within a single building or campus of up
to a few kilometers in size. They are widely used to connect personal computers and workstations in
Bus Topology company offices and factories to share resources (e.g., printers) and exchange information.
A bus topology is example of multipoint Link. One long cable acts as a backbone to link all the devices in a
Each host in a LAN has an identifier, an address that uniquely defines the host in the LAN.
network.
A packet sent by a host to another host carries both the source host’s and the destination host’s
addresses.
LANs are distinguished from other kinds of networks by three characteristics:
1) Their size
2) Their transmission technology, and
3) Their topology.
Fig: Bus Topology
I. Size: LANs are restricted in size, which means that the worst-case transmission time is bounded and
Nodes are connected to the bus cable by drop lines and taps. A drop line is a connection running between
known in advance.
the device and the main cable. A tap is a connector that either splices into the main cable or punctures the
II. Transmission technology: LANs consisting of a cable to which all the machines are attached.
sheathing of a cable to create a contact with the metallic core.
Traditional LANs run at speeds of 10 Mbps to 100 Mbps, have low delay (microseconds or
Advantages:
nanoseconds), and make very few errors. NewerLANs operate at up to 10 Gbps. [(1 Mbps is 1,000,000
Ease of installation.
bits/sec) and gigabits/sec (1 Gbps is 1,000,000,000 bits/sec)].
A bus uses less cabling than mesh or star topologies. III. Topology: Various topologies are possible for broadcast LANs. Ex: Bus and Ring.
Only the backbone cable stretches through the entire facility
Disadvantages:
It includes difficult reconnection and fault isolation.
Difficult to add new devices.
Signal reflection at the taps can cause degradation in quality.
Fault or break in the bus cable stops all transmission, even between devices on the same side of the
problem. The damaged area reflects signals back in the direction of origin, creating noise in both
directions.
Ring Topology
In a ring topology, each device has a dedicated point-to-point connection with only the two devices on
either side of it. A signal is passed along the ring in one direction, from device to device, until it reaches its
destination. Each device in the ring incorporates a repeater. Wide Area Network:
A wide area network (WAN) is also an interconnection of devices capable of communication.
A wide area network, or WAN, spans a large geographical area, often a country or continent.
It contains a collection of machines intended for running user (i.e., application) programs. An internet is a switched network in which a switch connects at least two links together. The two most
A WAN interconnects connecting devices such as switches, routers, or modems. common types of switched networks are circuit-switched and packet-switched networks.
A WAN is normally created and run by communication companies and leased by an organization that i. Circuit-Switched Network
uses it. In a circuit-switched network, a dedicated connection, called a circuit, is always available between the two
Ex: point-to-point WANs and switched WANs. end systems; the switch can only make it active or inactive.
The collections of machines called as hosts. The hosts are connected by a communication subnet, or just In Figure, the four telephones at each side are connected to a switch. The switch connects a telephone set at
subnet for short. one side to a telephone set at the other side. The thick line connecting two switches is a high-capacity
The job of the subnet is to carry messages from host to host. communication line that can handle four voice communications at the same time; the capacity can be shared
In most wide area networks, the subnet consists of two distinct components: transmission lines and between all pairs of telephone sets.
switching elements.
Transmission lines: move bits between machines. They can be made of copper wire, optical
fiber, or even radio links.
Switching elements: These are specialized computers that connect three or more transmission
lines. When data arrive on an incoming line, the switching element must choose an outgoing
line on which to forward them. These switching computers have been called as Router.
The collection of communication lines and routers (but not the hosts) form the subnet. Fig: A circuit-switched network
i. Point-to-Point WAN: A circuit-switched network is efficient only when it is working at its full capacity; most of the time, it is
A point-to-point WAN is a network that connects two communicating devices through a transmission media inefficient because it is working at partial capacity.
(cable or air).
ii. Packet-Switched Network:
In a computer network, the communication between the two ends is done in blocks of data called packets.
This allows us to make the switches function for both storing and forwarding because a packet is an
independent entity that can be stored and sent later.
Requirement Levels
Second Scenario
In this scenario communication between Sender and Receiver takes place in three layers, as shown in Figure.
We assume that Ann and Maria each have three machines that can perform the task at each layer.
Although Alice and Bob need to exchange data, communication at the physical layer means exchanging
signals. Data need to be transmitted and received, but the media have to change data to signals. Both data
and the signals that represent them can be either analog or digital in form.
Data can be analog or digital. The term analog data refers to information that is continuous; digital data
refers to information that has discrete states.
address, such as [email protected]. At the transport layer, addresses are called port numbers, and For example, an analog clock that has hour, minute, and second hands gives information in a continuous
these define the application-layer programs at the source and destination. Port numbers are local addresses form; the movements of the hands are continuous. On the other hand, a digital clock that reports the hours
that distinguish between several programs running at the same time. At the network-layer, the addresses are and the minutes will change suddenly from 8:05 to 8:06.
global, with the whole Internet as the scope. A network-layer address uniquely defines the connection of a
device to the Internet. The link-layer addresses, sometimes called MAC addresses, are locally defined Analog data, such as the sounds made by a human voice, take on continuous values. When someone speaks,
addresses, each of which defines a specific host or router in a network (LAN or WAN). We will come back
an analog wave is created in the air. This can be captured by a microphone and converted to an analog signal
to these addresses in future chapters.
or sampled and converted to a digital signal.
Multiplexing and Demultiplexing
Since the TCP/IP protocol suite uses several protocols at some layers, we can say that we have multiplexing Digital data take on discrete values. For example, data are stored in computer memory in the form of 0s and
at the source and demultiplexing at the destination. Multiplexing in this case means that a protocol at a layer 1s. They can be converted to a digital signal or modulated into an analog signal for transmission across a
can encapsulate a packet from several next-higher layer protocols (one at a time); demultiplexing means that medium.
a protocol can decapsulate and deliver a packet to several next-higher layer protocols (one at a time). Figure
shows the concept of multiplexing and demultiplexing at the three upper layers.
Periodic and Nonperiodic: Both analog and digital signals can take one of two forms: periodic or
nonperiodic (Sometimes referred to as aperiodic; the prefix a in Greek means “non”).
A periodic signal completes a pattern within a measurable time frame, called a period, and repeats that
pattern over subsequent identical periods. The completion of one full pattern is called a cycle. A
nonperiodic signal changes without exhibiting a pattern or cycle that repeats over time. Both analog and
digital signals can be periodic or nonperiodic.
In data communications, we commonly use periodic analog signals and nonperiodic digital signals.
TRANSMISSION IMPAIRMENT:
Signals travel through transmission media, which are not perfect. The imperfection causes signal
impairment. This means that the signal at the beginning of the medium is not the same as the signal at the
end of the medium. What is sent is not what is received. Three causes of impairment are attenuation,
distortion, and noise (see Figure 1.32).
Attenuation:
Attenuation means a loss of energy. When a signal, simple or composite, travels through a medium, it loses
FIGURE 1.28: COMMUNICATION AT THE PHYSICAL LAYER some of its energy in overcoming the resistance of the medium. That is why a wire carrying electric signals
ANALOG AND DIGITAL SIGNALS: Like the data they represent, signals can be either analog or digital. gets warm, if not hot, after a while. Some of the electrical energy in the signal is converted to heat. To
compensate for this loss, amplifiers are used to amplify (meaning enlarge on/go into
An analog signal has infinitely many levels of intensity (meaning strength/power) over a period of time. As detail/develop/expand/clarify/add details to) the signal.
the wave moves from value A to value B, it passes through and includes an infinite number of values along
its path. Decibel:
A digital signal, on the other hand, can have only a limited number of defined values. Although each value To show that a signal has lost or gained strength, engineers use the unit of the decibel. The decibel (dB)
can be any number, it is often as simple as 1 and 0. measures the relative strengths of two signals or one signal at two different points. Note that the decibel is
negative if a signal is attenuated and positive if a signal is amplified.
The simplest way to show signals is by plotting them on a pair of perpendicular axes. The vertical axis
represents the value or strength of a signal. The horizontal axis represents time.
Figure 1.29 illustrates an analog signal and a digital signal. The curve representing the analog signal passes Distortion:
through an infinite number of points. The vertical lines of the digital signal, however, demonstrate the
sudden jump that the signal makes from value to value.
Induced noise comes from sources such as motors and appliances. These devices act as a sending antenna, One characteristic that measures network performance is bandwidth. However, the term can be used in two
and the transmission medium acts as the receiving antenna. different contexts with two different measuring values: bandwidth in hertz and bandwidth in bits per second.
Crosstalk is the effect of one wire on the other. One wire acts as a sending antenna and the other as the Bandwidth in Hertz: Bandwidth in hertz is the range of frequencies contained in a composite signal or the
receiving antenna. range of frequencies a channel can pass. For example, we can say the bandwidth of a subscriber telephone
line is 4 kHz.
Impulse noise is a spike (a signal with high energy in a very short time) that comes from power lines,
lightning, and so on. Bandwidth in Bits per Seconds: The term bandwidth can also refer to the number of bits per second that a
channel, a link, or even a network can transmit. For example, one can say the bandwidth of a Fast Ethernet
DATA RATE LIMITS: network (or the links in this network) is a maximum of 100 Mbps. This means that this network can send 100
Mbps.
A very important consideration in data communications is how fast we can send data, in bits per second, over
a channel. Data rate depends on three factors: Relationship: There is an explicit relationship between the bandwidth in hertz and bandwidth in bits per
second. Basically, an increase in bandwidth in hertz means an increase in bandwidth in bits per second.
1. The bandwidth available
THROUGHPUT:
2. The level of the signals we use
The throughput is a measure of how fast we can actually send data through a network. Although, at first
3. The quality of the channel (the level of noise) glance, bandwidth in bits per second and throughput seem the same, they are different. A link may have a
Two theoretical formulas were developed to calculate the data rate: one by Nyquist for a noiseless channel, bandwidth of B bps, but we can only send T bps through this link with T always less than B.
another by Shannon for a noisy channel. For example, we may have a link with a bandwidth of 1 Mbps, but the devices connected to the end of the
link may handle only 200 kbps. This means that we cannot send more than 200 kbps through this link.
Noiseless Channel: Nyquist Bit Rate:
Imagine a highway designed to transmit 1000 cars per minute from one point to another. However, if there is
For a noiseless channel, the Nyquist bit rate formula defines the theoretical maximum bit rate BitRate =
2 x bandwidth x log2L congestion on the road, this figure may be reduced to 100 cars per minute. The bandwidth is 1000 cars per
minute; the throughput is 100 cars per minute.
In this formula, bandwidth is the bandwidth of the channel, L is the number of signal levels used to represent
data, and BitRate is the bit rate in bits per second. According to the formula, we might think that, given a LATENCY (DELAY):
specific bandwidth, we can have any bit rate we want by increasing the number of signal levels. The latency or delay defines how long it takes for an entire message to completely arrive at the destination
Although the idea is theoretically correct, practically there is a limit. When we increase the number of signal from the time the first bit is sent out from the source. We can say that latency is made of four components:
levels, we impose a burden on the receiver. propagation time, transmission time, queuing time and processing delay.
Noisy Channel: Shannon Capacity: Propagation Time: Propagation time measures the time required for a bit to travel from the source to the
destination. The propagation time is calculated by dividing the distance by the propagation speed.
In reality, we cannot have a noiseless channel; the channel is always noisy. In 1944, Claude Shannon
introduced a formula, called the Shannon capacity, to determine the theoretical highest data rate for a noisy Propagation time = Distance / (Propagation Speed)
channel: Capacity = bandwidth x log2 (1 + SNR)
The first bit leaves earlier and arrives earlier; the last bit leaves later and arrives later. The transmission time The use of long-distance communication using electric signals started with the invention of the
of a message depends on the size of the message and the bandwidth of the channel. telegraph by Morse in the 19th century.
Transmission time = (Message size) / Bandwidth Communication by telegraph was slow and dependent on a metallic medium. Extending the
range of the human voice became possible when the telephone was invented in 1869.
Queuing Time: The third component in latency is the queuing time, the time needed for each intermediate
or end device to hold the message before it can be processed. The queuing time is not a fixed factor; it Telephone communication at that time also needed a metallic medium to carry the electric
changes with the load imposed on the network. signals that were the result of a conversion from the human voice.
When there is heavy traffic on the network, the queuing time increases. An intermediate device, such as a The communication was, however, unreliable due to the poor quality of the wires. The lines
router, queues they arrived messages and processes them one by one. If there are many messages, each were often noisy and the technology was unsophisticated.
message will have to wait. Wireless communication started in 1895 when Hertz was able to send high frequency signals.
Bandwidth-Delay Product Later, Marconi devised a method to send telegraph-type messages over the Atlantic Ocean.
Bandwidth and delay are two performance metrics of a link. The bandwidth-delay product defines the We have come a long way. Better metallic media have been invented (twisted-pair and coaxial
number of bits that can fill the link. cables, for example).
JITTER: The use of optical fibers has increased the data rate incredibly. Free space (air, vacuum, and water) is used
more efficiently, in part due to the technologies (such as modulation and multiplexing).
Another performance issue that is related to delay is jitter. We can roughly say that jitter is a problem if
different packets of data encounter different delays and the application using the data at the receiver site is Electromagnetic energy, a combination of electric and magnetic fields vibrating in relation to each other,
time-sensitive (audio and video data, for example). If the delay for the first packet is 20 ms, for the second is includes power, radio waves, infrared light, visible light, and ultraviolet light, and X, gamma, and cosmic
45 ms, and for the third is 40 ms, then the real-time application that uses the packets endures jitter. rays. Each of these constitutes a portion of the electromagnetic spectrum.
TRANSMISSION MEDIA In telecommunications, transmission media can be divided into two broad categories: guided and unguided.
INTRODUCTION: Guided media include twisted-pair cable, coaxial cable, and fiber-optic cable.
Transmission media are actually located below the physical layer and are directly controlled by the physical Unguided medium is free space. Figure 1.34 shows this taxonomy.
layer. We could say that transmission media belong to layer zero. Figure 1.33 shows the position of
transmission media in relation to the physical layer.
The air can also be used to convey the message in a smoke signal or semaphore.
GUIDED MEDIA:
For a written message, the transmission medium might be a mail carrier, a truck, or an airplane.
Although metal casing improves the quality of cable by preventing the penetration of noise or crosstalk, it is
bulkier and more expensive. Figure 1.36 shows the difference between UTP and STP.
Performance: One way to measure the performance of twisted-pair cable is to compare attenuation versus
frequency and distance. A twisted-pair cable can pass a wide range of frequencies.
Applications: Twisted-pair cables are used in telephone lines to provide voice and data channels. The local
FIGURE 1.36: UTP AND STP CABLES
loop—the line that connects subscribers to the central telephone office— commonly consists of unshielded
twisted-pair cables.
Coaxial Cable Standards: Coaxial cables are categorized by their Radio Government (RG) ratings. Each
FIGURE 1.40: BENDING OF LIGHT RAY
RG number denotes a unique set of physical specifications, including the wire gauge of the inner conductor,
the thickness and type of the inner insulator, the construction of the shield, and the size and type of the outer As the figure shows, if the angle of incidence I (the angle the ray makes with the line perpendicular to the
casing. Each cable defined by an RG rating is adapted for a specialized function, as shown in Table 1.2. interface between the two substances) is less than the critical angle, the ray refracts and moves closer to the
surface. If the angle of incidence is equal to the critical angle, the light bends along the interface. If the angle
Category Impedance Use
is greater than the critical angle, the ray reflects (makes a turn) and travels again in the denser substance.
RG-59 75 Ω Cable TV
Optical fibers use reflection to guide light through a channel. A glass or plastic core is surrounded by a
RG-58 50 Ω Thin Ethernet cladding of less dense glass or plastic. The difference in density of the two materials must be such that a
beam of light moving through the core is reflected off the cladding instead of being refracted into it. See
RG-11 50 Ω Thick Ethernet
Figure 1.41.
TABLE 1.2: CATEGORIES OF COAXIAL CABLES
To connect coaxial cable to devices, we need coaxial connectors. The most common type of connector used
today is the Bayonet Neill-Concelman (BNC) connector. Figure 1.39 shows three popular types of these
connectors: the BNC connector, the BNC T connector, and the BNC terminator. FIGURE 1.41: OPTICAL FIBER
Propagation Modes: Current technology supports two modes (multimode and single mode) for propagating
light along optical channels, each requiring fiber with different physical characteristics. Multimode can be
implemented in two forms: step-index or graded-index (see Figure 1.42).
Cable Composition
Figure 1.44 shows the composition of a typical fiber-optic cable. The outer jacket is made of either PVC or
Teflon. Inside the jacket are Kevlar strands to strengthen the cable.
In multimode step-index fiber, the density of the core remains constant from the center to the edges. A
beam of light moves through this constant density in a straight line until it reaches the interface of the core
and the cladding. At the interface, there is an abrupt change due to a lower density; this alters the angle of the FIGURE 1.44: FIBER CONSTRUCTION
beam’s motion. The term step-index refers to the suddenness of this change, which contributes to the
distortion of the signal as it passes through the fiber. Kevlar is a strong material used in the fabrication of bulletproof vests. Below the Kevlar is another plastic
coating to cushion the fiber. The fiber is at the center of the cable, and it consists of cladding and core.
A second type of fiber, called multimode graded-index fiber, decreases this distortion of the signal through
the cable. The word index here refers to the index of refraction. As we saw above, the index of refraction is Fiber-Optic Cable Connectors:
related to density. A graded-index fiber, therefore, is one with varying densities. Density is highest at the
There are three types of connectors for fiber-optic cables, as shown in Figure 1.45. The subscriber channel
center of the core and decreases gradually to its lowest at the edge. Figure 1.43 shows the impact of this (SC) connector is used for cable TV. It uses a push/pull locking system. The straight-tip (ST) connector is
variable density on the propagation of light beams.
used for connecting cable to networking devices. It uses a bayonet locking system and is more reliable than
Single-Mode: Single-mode uses step-index fiber and a highly focused source of light that limits beams to a SC. MT-RJ is a connector that is the same size as RJ45.
small range of angles, all close to the horizontal.
The single-mode fibers itself is manufactured with a much smaller diameter than that of multimode fiber
and with substantially lower density (index of refraction). The decrease in density results in a critical angle
that is close enough to 90° to make the propagation of beams almost horizontal. In this case, propagation of
different beams is almost identical, and delays are negligible. All the beams arrive at the destination
“together” and can be recombined with little distortion to the signal (see Figure 1.43).
Fiber Sizes:
Higher bandwidth. Fiber-optic cable can support dramatically higher bandwidths (and hence
data rates) than either twisted-pair or coaxial cable. Currently, data rates and bandwidth
utilization over fiber-optic cable are limited not by the medium but by the signal generation and
reception technology available.
Less signal attenuation. Fiber-optic transmission distance is significantly greater than that of
other guided media. A signal can run for 50 km without requiring regeneration. We need
repeaters every 5 km for coaxial or twisted-pair cable.
Disadvantages: There are some disadvantages in the use of optical fiber.Installation and maintenance.
Fiber-optic cable is a relatively new technology. Its installation and maintenance require expertise that is not
yet available everywhere.
Cost. The cable and the interfaces are relatively more expensive than those of other guided
media. If the demand for bandwidth is not high, often the use of optical fiber cannot be justified.
Unguided medium transport electromagnetic waves without using a physical conductor. This type of
communication is often referred to as wireless communication. Signals are normally broadcast through free
space and thus are available to anyone who has a device capable of receiving them.
FIGURE 1.46: OPTICAL FIBER PERFORMANCE Unguided signals can travel from the source to the destination in several ways: ground propagation, sky
propagation, and line-of-sight propagation, as shown in Figure 1.47.
Applications:
Fiber-optic cable is often found in backbone networks because its wide bandwidth is cost-effective. Today,
with wavelength-division multiplexing (WDM), we can transfer data at a rate of 1600 Gbps.
Some cable TV companies use a combination of optical fiber and coaxial cable, thus creating a hybrid
network. Optical fiber provides the backbone structure while coaxial cable provides the connection to the
user premises. This is a cost-effective configuration since the narrow bandwidth requirement at the user end
does not justify the use of optical fiber.
Local-area networks such as 100Base-FX network (Fast Ethernet) and 1000Base-X also use fiber-optic
cable.
FIGURE 1.47: PROPAGATION METHODS
ADVANTAGES AND DISADVANTAGES OF OPTICAL FIBER:
BAND RANGE PROPAGATION APPLICATION It is an advantage because, for example, an AM radio can receive signals inside a building.
Very low frequency (VLF) 3-30kHz Ground Long-range radio It is a disadvantage because we cannot isolate a communication to just inside or outside a
building.
navigation
The radio wave band is relatively narrow, just under 1 GHz, compared to the microwave band. When this
Low frequency (LF) 30–300 kHz Ground Radio beacons and band is divided into subbands, the subbands are also narrow, leading to a low data rate for digital
navigational locators
communications.
Middle frequency (MF) 300 kHz–3 MHz Sky AM radio Omnidirectional Antenna: Radio waves use omnidirectional antennas that send out signals in all
directions. Based on the wavelength, strength, and the purpose of transmission, we can have several types of
High frequency (HF) 3–30 MHz Sky Citizens band (CB), antennas. Figure 1.48 shows an omnidirectional antenna.
ship/aircraft
Very high frequency (VHF) 30–300 MHz Sky and line-of- VHF TV, FM radio
sight
Ultrahigh frequency (UHF) 300 MHz–3 Line-of-sight UHF TV, cellular phones, paging,
GHz satellite
Applications: The omnidirectional characteristics of radio waves make them useful for multicasting, in
Extremely high frequency 30–300 GHz Line-of-sight Radar, satellite
which there is one sender but many receivers. AM and FM radio, television, maritime radio, cordless phones,
(EHF)
and paging are examples of multicasting.
TABLE 1.4: BANDS (CONTINUED)
Microwaves: Electromagnetic waves having frequencies between 1 and 300 GHz are called microwaves.
We can divide wireless transmission into three broad groups: radio waves, microwaves, and infrared waves. Microwaves are unidirectional. When an antenna transmits microwaves, they can be narrowly focused. This
means that the sending and receiving antennas need to be aligned. The unidirectional property has an obvious
RADIO WAVES: advantage. A pair of antennas can be aligned without interfering with another pair of aligned antennas.
Applications:
Microwaves, due to their unidirectional properties, are very useful when unicast (one-to- one)
communication is needed between the sender and the receiver. They are used in cellular phones, satellite
networks and wireless LANs.
FIGURE 1.50: SWITCHED NETWORK
Infrared:
The end systems (communicating devices) are labeled A, B, C, D, and so on, and the switches are labeled I,
Infrared waves, with frequencies from 300 GHz to 400 THz (wavelengths from 1 mm to 770 nm), can be II, III, IV, and V. Each switch is connected to multiple links.
used for short-range communication. Infrared waves, having high frequencies, cannot penetrate walls. This
advantageous characteristic prevents interference between one system and another; a short-range THREE METHODS OF SWITCHING:
communication system in one room cannot be affected by another system in the next room. Traditionally, three methods of switching have been discussed: circuit switching, packet switching, and
When we use our infrared remote control, we do not interfere with the use of the remote by our neighbors. message switching. The first two are commonly used today. The third has been phased out in general
However, this same characteristic makes infrared signals useless for long-range communication. In addition, communications but still has networking applications. Packet switching can further be divided into two
we cannot use infrared waves outside a building because the sun’s rays contain infrared waves that can subcategories—virtual circuit approach and datagram approach—as shown in Figure 1.51.
interfere with the communication. Note: we discuss only circuit switching and packet switching; message switching is more conceptual than
Applications: The infrared band, almost 400 THz, has an excellent potential for data transmission. Such a practical.
wide bandwidth can be used to transmit digital data with a very high data rate.
SWITCHING:
We have switching at the physical layer, at the data-link layer, at the network layer, and even logically at the
application layer (message switching).
INTRODUCTION:
A network is a set of connected devices. Whenever we have multiple devices, we have the problem of how to
connect them to make one-to-one communication possible. One solution is to make a point-to-point FIGURE 1.51: TAXONOMY OF SWITCHED NETWORKS
connection between each pair of devices (a mesh topology) or between a central device and every other
device (a star topology). These methods, however, are impractical and wasteful when applied to very large Switching and TCP/IP Layers:
networks.
Switching can happen at several layers of the TCP/IP protocol suite.
The number and length of the links require too much infrastructure to be cost-efficient, and the majority of
those links would be idle most of the time. Other topologies employing multipoint connections, such as a
Conceptually, we can say that communication using e-mail is a kind of message-switched communication, THREE PHASES:
but we do not see any network that actually can be called a message-switched network.
The actual communication in a circuit-switched network requires three phases: connection setup, data
CIRCUIT-SWITCHED NETWORKS: transfer, and connection teardown.
A circuit-switched network consists of a set of switches connected by physical links. A connection between SETUP PHASE: Before the two parties (or multiple parties in a conference call) can communicate, a
two stations is a dedicated path made of one or more links. However, each connection uses only one dedicated circuit (combination of channels in links) needs to be established. The end systems are normally
dedicated channel on each link. Each link is normally divided into n channels by using FDM or TDM. connected through dedicated lines to the switches, so connection setup means creating dedicated channels
between the switches.
Figure 1.52 shows a trivial circuit-switched network with four switches and four links. Each link is divided
into n (n is 3 in the figure) channels by using FDM or TDM. DATA TRANSFER PHASE: After the establishment of the dedicated circuit (channels), the two parties
can transfer data.
TEARDOWN PHASE: When one of the parties needs to disconnect, a signal is sent to each switch to
release the resources.
Efficiency:
It can be argued that circuit-switched networks are not as efficient as the other two types of networks
because resources are allocated during the entire duration of the connection. These resources are unavailable
to other connections. In a telephone network, people normally terminate the communication when they have
finished their conversation.
However, in computer networks, a computer can be connected to another computer even if there is no
activity for a long time. In this case, allowing resources to be dedicated means that other connections are
FIGURE 1.52: A TRIVIAL CIRCUIT-SWITCHED NETWORK deprived.
We have explicitly shown the multiplexing symbols to emphasize the division of the link into channels even Delay:
though multiplexing can be implicitly included in the switch fabric.
Although a circuit-switched network normally has low efficiency, the delay in this type of network is
The end systems, such as computers or telephones, are directly connected to a switch. We have shown only minimal. During data transfer the data are not delayed at each switch; the resources are allocated for the
two end systems for simplicity. When end system A needs to communicate with end system M, system A duration of the connection. Figure 1.53 shows the idea of delay in a circuit-switched network when only two
needs to request a connection to M that must be accepted by all switches as well as by M itself. This is called switches are involved.
the setup phase; a circuit (channel) is reserved on each link, and the combination of circuits or channels
defines the dedicated path. After the dedicated path made of connected circuits (channels) is established, the
data-transfer phase can take place. After all data have been transferred, the circuits are torn down.
As Figure 1.53 shows, there is no waiting time at each switch. The total delay is due to the time needed to
create the connection, transfer data, and disconnect the circuit. The delay caused by the setup is the sum of
four parts: the propagation time of the source computer request (slope of the first gray box), the request FIGURE 1.54: A DATAGRAM NETWORK WITH FOUR SWITCHES (ROUTERS)
signal transfer time (height of the first gray box), the propagation time of the acknowledgment from the
destination computer (slope of the second gray box), and the signal transfer time of the acknowledgment In this example, all four packets (or datagrams) belong to the same message, but may travel different paths to
(height of the second gray box). reach their destination. This is so because the links may be involved in carrying packets from other sources
and do not have the necessary bandwidth available to carry all the packets from A to X.
The delay due to data transfer is the sum of two parts: the propagation time (slope of the colored box) and
data transfer time (height of the colored box), which can be very long. The third box shows the time needed This approach can cause the datagrams of a transmission to arrive at their destination out of order with
to tear down the circuit. We have shown the case in which the receiver requests disconnection, which creates different delays between the packets.
the maximum delay.
Packets may also be lost or dropped because of a lack of resources. In most protocols, it is the responsibility
PACKET SWITCHING: of an upper-layer protocol to reorder the datagrams or ask for lost datagrams before passing them on to the
application.
In data communications, we need to send messages from one end system to another. If the message is going
to pass through a packet-switched network, it needs to be divided into packets of fixed or variable size. The The datagram networks are sometimes referred to as connectionless networks. The term connectionless here
size of the packet is determined by the network and the governing protocol. means that the switch (packet switch) does not keep information about the connection state. There are no
setup or teardown phases. Each packet is treated the same by a switch regardless of its source or destination.
In packet switching, there is no resource allocation for a packet. This means that there is no reserved
bandwidth on the links, and there is no scheduled processing time for each packet. Resources are allocated ROUTING TABLE:
on demand. The allocation is done on a first come, first-served basis. If there are no setup or teardown phases, how are the packets routed to their destinations in a datagram
When a switch receives a packet, no matter what the source or destination is, the packet must wait if there network? In this type of network, each switch (or packet switch) has a routing table which is based on the
are other packets being processed. As with other systems in our daily life, this lack of reservation may create destination address. The routing tables are dynamic and are updated periodically. The destination addresses
delay. For example, if we do not have a reservation at a restaurant, we might have to wait. and the corresponding forwarding output ports are recorded in the tables. Figure 1.55 shows the routing table
for a switch.
In a packet-switched network, there is no resource reservation; resources are allocated on demand.
We can have two types of packet-switched networks: datagram networks and virtual circuit networks.
DATAGRAM NETWORKS:
In a datagram network, each packet is treated independently of all others. Even if a packet is part of a
multipacket transmission, the network treats it as though it existed alone. Packets in this approach are
referred to as datagrams. Datagram switching is normally done at the network layer.
Efficiency: Resources can be allocated during the setup phase, as in a circuit-switched network, or on demand, as in a
datagram network.
The efficiency of a datagram network is better than that of a circuit-switched network; resources are
allocated only when there are packets to be transferred. If a source sends a packet and there is a delay of a As in a datagram network, data are packetized and each packet carries an address in the header. However, the
few minutes before another packet can be sent, the resources can be reallocated during these minutes for address in the header has local jurisdiction (it defines what the next switch should be and the channel on
other packets from other sources. which the packet is being carried), not end-to-end jurisdiction.
Delay: As in a circuit-switched network, all packets follow the same path established during the connection. A
virtual-circuit network is normally implemented in the data-link layer, while a circuit-switched network is
There may be greater delay in a datagram network than in a virtual-circuit network. Although there are no
implemented in the physical layer and a datagram network in the network layer. But this may change in the
setup and teardown phases, each packet may experience a wait at a switch before it is forwarded. Figure 1.56
future.
gives an example of delay in a datagram network for one packet.
Figure 1.57 is an example of a virtual-circuit network. The network has switches that allow traffic from
sources to destinations. A source or destination can be a computer, packet switch, bridge, or any other device
that connects other networks.
Setup Phase:
In the setup phase, a switch creates an entry for a virtual circuit. For example, suppose source A needs to
create a virtual circuit to B. Two steps are required: the setup request and the acknowledgment.
Addressing: In a virtual-circuit network, two types of addressing are involved: global and local (virtual-
circuit identifier).
Global Addressing: A source or a destination needs to have a global address—an address that can be unique
in the scope of the network or internationally if the network is part of an international network.
However, we will see that a global address in virtual-circuit networks is used only to create a virtual-circuit
identifier.
Virtual-Circuit Identifier:
FIGURE 1.59: SWITCH AND TABLES IN A VIRTUAL-CIRCUIT NETWORK
The identifier that is actually used for data transfer is called the virtual-circuit identifier (VCI) or the label.
Setup Request: A setup request frame is sent from the source to the destination. Figure 1.60 shows the
A VCI, unlike a global address, is a small number that has only switch scope; it is used by a frame between
process.
two switches. When a frame arrives at a switch, it has a VCI; when it leaves, it has a different VCI.
Figure 1.58 shows how the VCI in a data frame changes from one switch to another. Note that a VCI does
not need to be a large number since each switch can use its own unique set of VCIs.
Three Phases:
As in a circuit-switched network, a source and destination need to go through three phases in a virtual-circuit
network: setup, data transfer, and teardown. In the setup phase, the source and destination use their global
addresses to help switches make table entries for the connection. In the teardown phase, the source and FIGURE 1.60: SETUP REQUEST IN A VIRTUAL-CIRCUIT NETWORK
destination inform the switches to delete the corresponding entry. Data transfer occurs between these two
Acknowledgment:
phases.
A special frame, called the acknowledgment frame, completes the entries in the switching tables. Figure 1.61
Data-Transfer Phase: To transfer a frame from a source to its destination, all switches need to have a table
shows the process.
entry for this virtual circuit. The table, in its simplest form, has four columns. This means that the switch
holds four pieces of information for each virtual circuit that is already set up. Figure 1.59 shows such a Teardown Phase:
switch and its corresponding table.
Circuit-Switched Technology in WANs: virtual-circuit networks are used in switched WANs such as ATM
networks. The data-link layer of these technologies is well suited to the virtual circuit technology.
Switching at the data-link layer in a switched WAN is normally implemented by using virtual-circuit
techniques.
FIGURE 1.61: SETUP ACKNOWLEDGMENT IN A VIRTUAL-CIRCUIT NETWORK ***** USEFUL QUESTIONS with ANSWERS *****
As we said before, resource reservation in a virtual-circuit network can be made during the setup or can be Ans: Set of rules established for users to exchange information.
on demand during the data-transfer phase.
Q: Define the term topology.
In the first case, the delay for each packet is the same; in the second case, each packet may encounter
Ans: Architecture of a network.
different delays.
Q: Define the term deterministic.
There is one big advantage in a virtual-circuit network even if resource allocation is on demand. The source
can check the availability of the resources, without actually reserving it. Consider a family that wants to dine Ans: Access to the network is provided at fixed time intervals
at a restaurant.
Q: What is the difference between a hub and a switch? Ans: Hub – Broadcasts data it receives to all devices
Although the restaurant may not accept reservations (allocation of the tables is on demand), the family can connected to its ports. Switch – Establishes a direct connection from the sender to the destination without
call and find out the waiting time. This can save the family time and effort. passing the data traffic to other networking devices.
Delay in Virtual-Circuit Networks: Q: Cite the three advantages of a wired network. Ans: 1) Faster network data transfer speeds (within the
LAN), 2) Relatively inexpensive to setup & 3) the network is not susceptible to outside interference.
In a virtual-circuit network, there is a one-time delay for setup and a one-time delay for teardown. If
resources are allocated during the setup phase, there is no wait time for individual packets. Figure 1.62 Q: Cite three advantages of a wireless network. Ans: 1) User mobility 2) Simple installations & 3) No
shows the delay for a packet traveling through two switches in a virtual-circuit network. cables
The packet is traveling through two switches (routers). There are three transmission times (3T ), three Q: What does it mean for a wireless networking device to be Wi-Fi compliant? Ans: That the device has
propagation times (3τ), data transfer depicted by the sloping lines, a setup delay (which includes transmission been tested by the Wi-Fi Alliance (Wireless Fidelity) and is certified for compliance with 802.11x wireless
and propagation in two directions), and a teardown delay (which includes transmission and propagation in standards.
one direction).
Q: List five steps that can be used to protect the home network. Ans: 1) Change the default factory
We ignore the processing time in each switch. The total delay time is Total delay + 3T + 3τ + setup delay + passwords. 2) Change the default SSID. “Service Set Identifier” 3) turn on encryption. 4) Turn off the SSID
teardown delay broadcast. & 5) Enable MAC address filtering.
Q: What is Stateful Packet Inspection “SPI”? Ans: A type of firewall protection that inspects incoming data
packets to make sure they correspond to an outgoing request.
C) Primary D) secondary
UNIT –I
10. In a connection, more than two devices can share a single link.
Objective questions
A) Point-to-point B) multipoint
1. The is the physical path over which a message travels.
C) Primary D) secondary
A) Protocol B) Medium
11. In transmission, the channel capacity is shared by both communicating devices at all times.
C) Signal D) All the above
A) Simplex B) half-duplex
2. The information to be communicated in a data communications system is the .
C) full-duplex D) half-simplex
A) Medium B) Protocol
12. In the original ARPANET, were directly connected together.
C) Message D) Transmission
A) IMPs B) host computers
3. Frequency of failure and network recovery time after a failure is measures of the of network.
C) Networks D) routers
A) Performance B) Reliability
13. This was the first network.
C) Security D) Feasibility
A) CSNET B) NSFNET
4. TDM Stands for .
C) ANSNET D) ARPANET
A) Time discrete measures B) Time Division Multiplexing
14. Which organization has authority over interstate and international commerce in the
C) Time division measures D) All the above
Communications field?
5. Which topology requires a central controller or hub?
A) ITU-T B) IEEE
A) Mesh B) Star
C) FCC D) ISOC
C) Bus D) Ring
15. is special-interest groups that quickly test, evaluate, and standardize new technologies.
6. Which topology requires a multipoint connection?
A) Forums B) Regulatory agencies
A) Mesh B) Star
B) C) Standards organizations D) All of the above
C) Bus D) Ring
16. Which agency developed standards for physical connection interfaces and electronic signalling a
7. Communication between a computer and a keyboard involves transmission. specification?
8. A television broadcast is an example of transmission. 17. is the protocol suite for the current Internet.
C) Timing D) none of the above C) Both (a) and (b) D) none of the mentioned
C) FDM D) DSS 1. List out the advantages and drawbacks of bus topology.
22. Fiber optic cable consists of 2 Explain the Difference between LAN, MAN, WAN.
A) Local loops B) Trunks &Multiplexing 6 Write any four reasons for using Layer Protocol.
C) Switching D) ALL 7. List out the advantages and disadvantages of OSI Reference model compare with TCP/IP model.
24) In the OSI model, as a data packet moves from the lower to the upper layers, headers are 8. Difference between the datagram packet switching and virtual circuit switching.
A) Added B) removed 9. Write the advantages of optical fiber over twisted pair and coaxial cable.
25. Which transmission media has the highest transmission speed in a network?
A) Coaxial cable B) twisted pair cable
UNIT 2 layer of the sending node needs to encapsulate the datagram received from the network in a frame, and
INTRODUCTION TO DATALINK LAYER the data-link layer of the receiving node needs to decapsulate the datagram from the frame.
INTRODUCTION: FRAMING: Definitely, the first service provided by the data-link layer is framing. The data-link layer at
The Internet is a combination of networks glued together by connecting devices (routers or each node needs to encapsulate the datagram (packet received from the network layer) in a frame before
switches). If a packet is to travel from a host to another host, it needs to pass through these networks. sending it to the next node. The node also needs to decapsulate the datagram from the frame received on
Figure shows the same scenario. Communication at the data-link layer is made up of five separate logical the logical channel. Although we have shown only a header for a frame.
connections between the data-link layers in the path.
FLOW CONTROL: The sending data-link layer at the end of a link is a producer of frames; the receiving
data-link layer at the other end of a link is a consumer. If the rate of produced frames is higher than the
rate of consumed frames, frames at the receiving end need to be buffered while waiting to be consumed
(processed). Definitely, we cannot have an unlimited buffer size at the receiving side. We have two
choices. The first choice is to let the receiving data-link layer drop the frames if its buffer is full. The
second choice is to let the receiving data-link layer send a feedback to the sending data-link layer to ask it
to stop or slow down. Different data-link-layer protocols use different strategies for flow control.
ERROR CONTROL: At the sending node, a frame in a data-link layer needs to be changed to bits,
transformed to electromagnetic signals, and transmitted through the transmission media. At the receiving
node, electromagnetic signals are received, transformed to bits, and put together to create a frame. Since
electromagnetic signals are susceptible to error, a frame is susceptible to error. The error needs first to be
detected. After detection, it needs to be either corrected at the receiver node or discarded and
retransmitted by the sending node.
CONGESTION CONTROL: Although a link may be congested with frames, which may result in frame
loss, most data-link-layer protocols do not directly use a congestion control to alleviate congestion,
although some wide-area networks do. In general, congestion control is considered an issue in the
network layer or the transport layer because of its end-to-end nature.
TWO CATEGORIES OF LINKS: Although two nodes are physically connected by a transmission
medium such as cable or air, we need to remember that the data-link layer controls how the medium is
used. We can have a data-link layer that uses the whole capacity of the medium; we can also have a data-
link layer that uses only part of the capacity of the link. In other words, we can have a point-to-point link
or a broadcast link. In a point-to-point link, the link is dedicated to the two devices; in a broadcast link,
the link is shared between several pairs of devices.
COMMUNICATION AT THE DATA-LINK LAYER
Two Sub layers: To better understand the functionality of and the services provided by the link layer, we
The data-link layer at Alice’s computer communicates with the data-link layer at router R2. The data-link
can divide the data-link layer into two sub layers: data link control (DLC) and media access control
layer at router R2 communicates with the data-link layer at router R4, and so on. Finally, the data-link
(MAC). The data link control sub layer deals with all issues common to both point-to-point and broadcast
layer at router R7 communicates with the data-link layer at Bob’s computer. Only one data-link layer is
links; the media access control sub layer deals only with issues specific to broadcast links.
involved at the source or the destination, but two data-link layers are involved at each router.
LINK-LAYER ADDRESSING:
The reason is that Alice’s and Bob’s computers are each connected to a single network, but each router A link-layer address is sometimes called a link address, sometimes a physical address, and
takes input from one network and sends output to another network. Note that although switches are also sometimes a MAC address.
involved in the data-link-layer communication, for simplicity we have not shown them in the figure. Since a link is controlled at the data-link layer, the addresses need to belong to the data-link layer.
When a datagram passes from the network layer to the data-link layer, the datagram will be encapsulated
SERVICES:
in a frame and two data-link addresses are added to the frame header. These two addresses are changed
The data-link layer is located between the physical and the network layers. The data link layer provides
services to the network layer; it receives services from the physical layer. The duty scope of the data-link every time the frame moves from one link to another. Figure demonstrates the concept in a small internet.
layer is node-to-node. When a packet is travelling in the Internet, the data-link layer of a node (host or
router) is responsible for delivering a datagram to the next node in the path. For this purpose, the data-link
1 2
In the internet in Figure, we have three links and two routers. We also have shown only two hosts: Alice Anytime a host or a router needs to find the link-layer address of another host or router in its
(source) and Bob (destination). For each host, we have shown two addresses, the IP addresses (N) and the network, it sends an ARP request packet. The packet includes the link-layer and IP addresses of the
link-layer addresses (L). sender and the IP address of the receiver. Because the sender does not know the link-layer address of the
receiver, the query is broadcast over the link using the link-layer broadcast address.
Note that a router has as many pairs of addresses as the number of links the router is connected to.
We have shown three frames, one in each link. Each frame carries the same datagram with the same Every host or router on the network receives and processes the ARP request packet, but only the
source and destination addresses (N1 and N8), but the link-layer addresses of the frame change from link intended recipient recognizes its IP address and sends back an ARP response packet. The response packet
to link. contains the recipient’s IP and link-layer addresses. The packet is unicast directly to the node that sent the
request packet.
In link 1, the link-layer addresses are L1 and L2. In link 2, they are L4 and L5. In link 3, they are
L7 and L8. In Figure (a), the system on the left (A) has a packet that needs to be delivered to another system
(B) with IP address N2. System A needs to pass the packet to its data-link layer for the actual delivery,
but it does not know the physical address of the recipient.
It uses the services of ARP by asking the ARP protocol to send a broadcast ARP request packet to
ask for the physical address of a system with an IP address of N2. This packet is received by every system
on the physical network, but only system B will answer it, as shown in Figure (b).
System B sends an ARP reply packet that includes its physical address. Now system A can send
all the packets it has for this destination using the physical address it received.
Note that the IP addresses and the link-layer addresses are not in the same order. For IP
addresses, the source address comes before the destination address; for link-layer addresses, the
destination address comes before the source.
3 4
Error Detection:
Cyclic Redundancy Check:
Types of Errors:
Whenever bits flow from one point to another, they are subject to unpredictable changes because
of interference. This interference can change the shape of the signal. The term single-bit error means
that only 1 bit of a given data unit (such as a byte, character, or packet) is changed from 1 to 0 or from 0 FIGURE: CRC ENCODER AND DECODER
to 1.
The term burst error means that 2 or more bits in the data unit have changed from 1 to 0 or from Encoder: Let us take a closer look at the encoder. The encoder takes a dataword and augments it with n −
0 to 1. Figure 2.8 shows the effect of a single-bit and a burst error on a data unit. k number of 0s. It then divides the augmented dataword by the divisor, as shown in Figure.
Decoder: The codeword can change during transmission. The decoder does the same division process as
the encoder. The remainder of the division is the syndrome. If the syndrome is all 0s, there is no error
with a high probability; the dataword is separated from the received codeword and accepted. Otherwise,
everything is discarded.
Redundancy:
The central concept in detecting or correcting errors is redundancy. To be able to detect or
correct errors, we need to send some extra bits with our data. These redundant bits are added by the
sender and removed by the receiver. Their presence allows the receiver to detect or correct corrupted bits.
Detection versus Correction:
The correction of errors is more difficult than the detection. In error detection, we are only
looking to see if any error has occurred. The answer is a simple yes or no. We are not even interested in
the number of corrupted bits. A single-bit error is the same for us as a burst error.
In error correction, we need to know the exact number of bits that are corrupted and, more
importantly, their location in the message. The number of errors and the size of the message are important
factors.
If we need to correct a single error in an 8-bit data unit, we need to consider eight possible error FIGURE: DIVISION IN CRC ENCODER
locations; if we need to correct two errors in a data unit of the same size, we need to consider 28
(permutation of 8 by 2) possibilities. You can imagine the receiver’s difficulty in finding 10 errors in a
data unit of 1000 bits.
5 6
Suppose the message is a list of five 4-bit numbers that we want to send to a destination. In addition to
sending these numbers, we send the sum of the numbers. For example, if the set of numbers is (7, 11, 12,
0, 6), we send (7, 11, 12, 0, 6, 36), where 36 is the sum of the original numbers.
The receiver adds the five numbers and compares the result with the sum. If the two are the same, the
receiver assumes no error, accepts the five numbers, and discards the sum. Otherwise, there is an error
somewhere and the message is not accepted.
FIGURE: DIVISION IN THE CRC DECODER FOR TWO CASES (10)2+ (0100)2= (0110)2 → (6)10
The above Figure shows two cases: The left-hand figure shows the value of the syndrome when no error Instead of sending 36 as the sum, we can send 6 as the sum (7, 11, 12, 0, 6, 6). The receiver can
has occurred; the syndrome is 000. The right-hand part of the figure shows the case in which there is a add the first five numbers in one’s complement arithmetic. If the result is 6, the numbers are accepted;
single error. The syndrome is not all 0s (it is 011). otherwise, they are rejected.
CHECKSUM:
Checksum is an error-detecting technique that can be applied to a message of any length. In the
Internet, the checksum technique is mostly used at the network and transport layer rather than the data-
link layer. FORWARD ERROR CORRECTION:
At the source, the message is first divided into m-bit units. The generator then creates an extra m-
bit unit called the checksum, which is sent with the message. At the destination, the checker creates a new We need to correct the error or reproduce the packet immediately. Several schemes have been designed
checksum from the combination of the message and sent checksum. If the new checksum is all 0s, the and used in this case that is collectively referred to as forward error correction (FEC) techniques.
message is accepted; otherwise, the message is discarded (Figure). Note that in the real implementation,
the checksum unit is not necessarily added at the end of the message; it can be inserted in the middle of HAMMING DISTANCE:
To detect s errors, the minimum Hamming distance should be dmin = s + 1. For error detection, we
the message.
definitely need more distance. It can be shown that to detect t errors, we need to have dmin = 2t + 1. In
other words, if we want to correct 10 bits in a packet, we need to make the minimum hamming distance
21 bits, which means a lot of redundant bits, need to be sent with the data.
To give an example, consider the famous BCH code. In this code, if data is 99 bits, we need to
send 255 bits (extra 156 bits) to correct just 23 possible bit errors. Most of the time we cannot afford such
a redundancy.
CHUNK INTERLEAVING: Another way to achieve FEC in multimedia is to allow some small chunks
to be missing at the receiver. We cannot afford to let all the chunks belonging to the same packet be
missing; however, we can afford to let one chunk be missing in each packet. Figure shows that we can
FIGURE: CHECKSUM divide each packet into 5 chunks (normally the number is much larger).
7 8
DLC SERVICES:
The data link control (DLC) deals with procedures for communication between two adjacent nodes—
node-to-node communication—no matter whether the link is dedicated or broadcast. Data link control
functions include framing and flow and error control.
FRAMING: The data-link layer, needs to pack bits into frames, so that each frame is distinguishable
from another. Framing in the data-link layer separates a message from one source to a destination by
adding a sender address and a destination address. The destination address defines where the packet is to
go; the sender address helps the recipient acknowledge the receipt.
Although the whole message could be packed in one frame, which is not normally done; one
reason is that a frame can be very large, making flow and error control very inefficient. When a message
is carried in one very large frame, even a single-bit error would require the retransmission of the whole
FIGURE: INTERLEAVING
frame. When a message is divided into smaller frames, a single-bit error affects only that small frame.
We can then create data chunk by chunk (horizontally), but combine the chunks into packets vertically. In
this case, each packet sent carries a chunk from several original packets. If the packet is lost, we miss only Character-Oriented Framing:
one chunk in each packet, which is normally acceptable in multimedia communication. To separate one frame from the next, an 8-bit (1-byte) flag is added at the beginning and the end
of a frame. The flag, composed of protocol-dependent special characters, signals the start or end of a
COMBINING HAMMING DISTANCE AND INTERLEAVING: frame. Figure 2.17 shows the format of a frame in a character-oriented protocol.
Hamming distance and interleaving can be combined. We can first create n-bit packets that can correct t-
bit errors. Then we interleave m rows and send the bits column by column. In this way, we can
automatically correct burst errors up to m × t-bit errors.
FIGURE: A FRAME IN A CHARACTER-ORIENTED PROTOCOL
COMPOUNDING HIGH- AND LOW-RESOLUTION PACKETS:
Still another solution is to create a duplicate of each packet with a low-resolution redundancy and Byte stuffing (or character stuffing), a special byte is added to the data section of the frame when there is
combine the redundant version with the next packet. For example, we can create four low-resolution a character with the same pattern as the flag. The data section is stuffed with an extra byte. This byte is
packets out of five high-resolution packets and send them as shown in Figure. If a packet is lost, we can
use the low-resolution version from the next packet. Note that the low-resolution section in the first usually called the escape character (ESC) and has a predefined bit pattern. Whenever the receiver
packet is empty. encounters the ESC character, it removes it from the data section and treats the next character as data, not
In this method, if the last packet is lost, it cannot be recovered, but we use the low-resolution as a delimiting flag. Figure shows the situation.
version of a packet if the lost packet is not the last one. The audio and video reproduction does not have
Byte stuffing by the escape character allows the presence of the flag in the data section of the
the same quality, but the lack of quality is not recognized most of the time.
frame, but it creates another problem. What happens if the text contains one or more escape characters
followed by a byte with the same pattern as the flag? To solve this problem, the escape characters that are
part of the text must also be marked by another escape character. In other words, if the escape character is
part of the text, an extra one is added to show that the second one is part of the text.
FIGURE: COMPOUNDING HIGH- AND LOW-RESOLUTION PACKETS FIGURE: BYTE STUFFING AND UNSTUFFING
9 10
Bit-Oriented Framing: Error control at the data-link layer is normally very simple and implemented using one of the
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, following two methods. In both methods, a CRC is added to the frame header by the sender and checked
so that the receiver does not mistake the pattern 0111110 for a flag. by the receiver.
Figure shows bit stuffing at the sender and bit removal at the receiver. Note that even if we have a In the first method, if the frame is corrupted, it is silently discarded; if it is not corrupted, the
0 after five 1s, we still stuff a 0. The 0 will be removed by the receiver. This means that if the flag like packet is delivered to the network layer. This method is used mostly in wired LANs such as
pattern 01111110 appears in the data, it will change to 011111010 (stuffed) and is not mistaken for a flag Ethernet.
by the receiver. The real flag 01111110 is not stuffed by the sender and is recognized by the receiver.
In the second method, if the frame is corrupted, it is silently discarded; if it is not corrupted,
an acknowledgment is sent (for the purpose of both flow and error control) to the sender.
The data-link layer at the sender gets a packet from its network layer, makes a frame out of it, and
FIGURE: BIT STUFFING AND UNSTUFFING
sends the frame. The data-link layer at the receiver receives a frame from the link, extracts the packet
FLOW AND ERROR CONTROL: from the frame, and delivers the packet to its network layer. The data-link layers of the sender and
If the items are produced faster than they can be consumed, the consumer can be overwhelmed receiver provide transmission services for their network layers.
and may need to discard some items. If the items are produced more slowly than they can be consumed,
the consumer must wait, and the system becomes less efficient. Flow control is related to the first issue.
We need to prevent losing the data items at the consumer site.
Buffers: Although flow control can be implemented in several ways, one of the solutions is normally to FSM OF SIMPLE PROTOCOL
use two buffers; one at the sending data-link layer and the other at the receiving data-link layer. A buffer
is a set of memory locations that can hold packets at the sender and receiver. The flow control STOP-AND-WAIT PROTOCOL:
Stop-and-Wait protocol uses both flow and error control. In this protocol, the sender sends one frame at
communication can occur by sending signals from the consumer to the producer. When the buffer of the
a time and waits for an acknowledgment before sending the next one. To detect corrupted frames, we
receiving data-link layer is full, it informs the sending data-link layer to stop pushing frames. need to add a CRC to each data frame.
When a frame arrives at the receiver site, it is checked. If its CRC is incorrect, the frame is
Error Control: Since the underlying technology at the physical layer is not fully reliable, we need to corrupted and silently discarded. The silence of the receiver is a signal for the sender that a frame was
implement error control at the data-link layer to prevent the receiving node from delivering corrupted either corrupted or lost.
packets to its network layer. Every time the sender sends a frame, it starts a timer. If an acknowledgment arrives before the
timer expires, the timer is stopped and the sender sends the next frame (if it has one to send). If the timer
expires, the sender resends the previous frame, assuming that the frame was either lost or corrupted.
11 12
Figure shows the outline for the Stop-and-Wait protocol. Note that only one frame and one We have one primary station and multiple secondary stations. A primary station can send
acknowledgment can be in the channels at any time. commands; a secondary station can only respond. The NRM is used for both point-to-point and
multipoint links, as shown in Figure.
In ABM, the configuration is balanced. The link is point-to-point, and each station can function as
a primary and a secondary (acting as peers), as shown in Figure. This is the common mode today.
Framing: To provide the flexibility necessary to support all the options possible in the modes and
configurations just described, HDLC defines three types of frames: information frames (I-frames),
supervisory frames (S-frames), and unnumbered frames (U-frames).
Each type of frame serves as an envelope for the transmission of a different type of message. I-
frames are used to data-link user data and control information relating to user data (piggybacking).
S-frames are used only to transport control information. U-frames are reserved for system
FIG: FSM OF STOP-AND-WAIT PROTOCOL management. Information carried by U-frames is intended for managing the link itself. Each frame in
HDLC may contain up to six fields, as shown in Figure: a beginning flag field, an address field, a control
Piggybacking: The two protocols we discussed in this section are designed for unidirectional
field, an information field, a frame check sequence (FCS) field, and an ending flag field. In multiple-
communication, in which data is flowing only in one direction although the acknowledgment may travel
frame transmissions, the ending flag of one frame can serve as the beginning flag of the next frame.
in the other direction. Protocols have been designed in the past to allow data to flow in both directions.
However, to make the communication more efficient, the data in one direction is piggybacked with the
acknowledgment in the other direction. In other words, when node A is sending data to node B, Node A
also acknowledges the data received from node B. Because piggybacking makes communication at the
data link layer more complicated, it is not a common practice.
HDLC:
High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point
and multipoint links. It implements the Stop-and-Wait protocol. FIGURE 2.27: HDLC FRAMES
Configurations and Transfer Modes: HDLC provides two common transfer modes that can be used in
Flag field. This field contains synchronization pattern 01111110, which identifies both the
different configurations: normal response mode (NRM) and asynchronous balanced mode (ABM). In
beginning and the end of a frame.
normal response mode (NRM), the station configuration is unbalanced.
Address field. This field contains the address of the secondary station. If a primary station
created the frame, it contains to address. If a secondary station creates the frame, it contains
13 14
from address. The address field can be one byte or several bytes long, depending on the needs expires, that the last frame is lost or damaged. The value of N(R) is the negative
of the network. acknowledgment number.
Selective reject (SREJ). If the value of the code subfield is 11, it is an SREJ Sframe. This is a
Control field. The control field is one or two bytes used for flow and error control. NAK frame used in Selective Repeat ARQ. Note that the HDLC Protocol uses the term selective
Information field. The information field contains the user’s data from the network layer or reject instead of selective repeat. The value of N(R) is the negative acknowledgment number.
management information. Its length can vary from one network to another. Control Field for U-Frames
Unnumbered frames are used to exchange session management and control information between
FCS field. The frame check sequence (FCS) is the HDLC error detection field. It can contain connected devices. Unlike S-frames, U-frames contain an information field, but one used for system
either a 2- or 4-byte CRC. management information, not user data. As with S-frames, however, much of the information carried by
U-frames is contained in codes included in the control field. U-frame codes are divided into two sections:
The control field determines the type of frame and defines its functionality. The format is specific a 2-bit prefix before the P/F bit and a 3-bit suffix after the P/F bit. Together, these two segments (5 bits)
for the type of frame, as shown in Figure. can be used to create up to 32 different types of U-frames.
15 16
Address. The address field in this protocol is a constant value and set to 11111111 (broadcast c. The system does the same. It applies the same function to the password of the user (known to
address). the system) and the challenge value to create a result. If the result created is the same as the
result sent in the response packet, access is granted; otherwise, it is denied. CHAP is more
Control. This field is set to the constant value 00000011 (imitating unnumbered frames in
secure than PAP, especially if the system continuously changes the challenge value. Even if
HDLC). As we will discuss later, PPP does not provide any flow control. Error control is also the intruder learns the challenge value and the result, the password is still secret.
limited to error detection.
(iii) Network Control Protocols:
Protocol. The protocol field defines what is being carried in the data field: either user data or PPP is a multiple-network-layer protocol. It can carry a network-layer data packet from protocols
other information. This field is by default 2 bytes long, but the two parties can agree to use defined by the Internet, OSI, Xerox, DECnet, AppleTalk, Novel, and so on. To do this, PPP has defined a
only 1 byte. specific Network Control Protocol for each network protocol. For example, IPCP (Internet Protocol
Control Protocol) configures the link for carrying IP data packets.
Payload field. The data field is a sequence of bytes with the default of a maximum of 1500
bytes; but this can be changed during negotiation. IPCP:
One NCP protocol is the Internet Protocol Control Protocol (IPCP). This protocol configures
o The data field is byte-stuffed if the flag byte pattern appears in this field. the link used to carry IP packets in the Internet. IPCP is especially of interest to us. The format of an IPCP
packet is shown in Figure 2.30. IPCP defines seven packets, distinguished by their code values, as shown
o Because there is no field defining the size of the data field, padding is needed if the
in Table.
size is less than the maximum default value or the maximum negotiated value.
Other Protocols: There are other NCP protocols for other network-layer protocols. The OSI
FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.
Network Layer Control Protocol has a protocol field value of 8023; the Xerox NS IDP Control Protocol
(i) Link Control Protocol: has a protocol field value of 8025; and so on.
The Link Control Protocol (LCP) is responsible for establishing, maintaining, configuring, and
terminating links. It also provides negotiation mechanisms to set options between the two endpoints. Both
endpoints of the link must reach an agreement about the options before the link can be established.
(ii)Authentication Protocols:
Authentication plays a very important role in PPP because PPP is designed for use over dial-up
links where verification of user identity is necessary. Authentication means validating the identity of a
user who needs to access a set of resources. PPP has created two protocols for authentication: Password
Authentication Protocol and Challenge Handshake Authentication Protocol. Note that these protocols are TABLE 2.4: CODE VALUE FOR IPCP PACKETS
used during the authentication phase.
PAP:
The Password Authentication Protocol (PAP) is a simple authentication procedure with a two-
step process:
a. The user who wants to access a system sends authentication identification (usually the user
name) and a password.
FIGURE 2.30: IPCP PACKET ENCAPSULATED IN PPP FRAME
b. The system checks the validity of the identification and password and either accepts or denies
connection. Multilink PPP:
PPP was originally designed for a single-channel point-to-point physical link. The availability of
CHAP: multiple channels in a single point-to-point link motivated the development of Multilink PPP. In this case,
The Challenge Handshake Authentication Protocol (CHAP) is a three-way handshaking a logical PPP frame is divided into several actual PPP frames. A segment of the logical frame is carried in
authentication protocol that provides greater security than PAP. In this method, the password is kept the payload of an actual PPP frame, as shown in Figure.
secret; it is never sent online.
a. The system sends the user a challenge packet containing a challenge value, usually a few
bytes.
b. The user applies a predefined function that takes the challenge value and the user’s own
password and creates a result. The user sends the result in the response packet to the system.
FIGURE: MULTILINK PPP
17 18
MEDIA ACCESS CONTROL (MAC) A collision involves two or more stations. If all these stations try to resend their frames after the
time-out, the frames will collide again. Pure ALOHA dictates that when the time-out period passes, each
When nodes or stations are connected and use a common link, called a multipoint or broadcast station waits a random amount of time before resending its frame. The randomness will help avoid more
link, we need a multiple-access protocol to coordinate access to the link. The problem of controlling the collisions. We call this time the backoff time TB.
access to the medium is similar to the rules of speaking in an assembly.
Pure ALOHA has a second method to prevent congesting the channel with retransmitted frames.
Many protocols have been devised to handle access to a shared link. All of these protocols belong After a maximum number of retransmission attempts Kmax, a station must give up and try later.
to a sublayer in the data-link layer called media access control (MAC). We categorize them into three
groups, as shown in Figure.
RANDOM ACCESS:
In random-access or contention methods, no station is superior to another station and none is
assigned control over another. At each instance, a station that has data to send uses a procedure defined by
the protocol to make a decision on whether or not to send.
This decision depends on the state of the medium (idle or busy). In other words, each station can
Fig: Procedure for pure ALOHA protocol
transmit when it desires on the condition that it follows the predefined procedure, including testing the
state of the medium. Vulnerable time
Let us find the vulnerable time, the length of time in which there is a possibility of collision. We assume
Two features give this method its name. First, there is no scheduled time for a station to transmit. that the stations send fixed-length frames with each frame taking Tfr seconds to send.
Transmission is random among the stations. That is why these methods are called random access.
Second, no rules specify which station should send next. Stations compete with one another to access the
medium. That is why these methods are also called contention methods.
In a random-access method, each station has the right to the medium without being controlled by
any other station. However, if more than one station tries to send, there is an access conflict—collision—
and the frames will be either destroyed or modified.
ALOHA:
Pure ALOHA:
The original ALOHA protocol is called pure ALOHA. This is a simple but elegant protocol. The
idea is that each station sends a frame whenever it has a frame to send (multiple access). However, since
Station B starts to send a frame at time t. Now imagine station A has started to send its frame after t − Tfr.
there is only one channel to share, there is the possibility of collision between frames from different
This leads to a collision between the frames from station B and station A. On the other hand, suppose that
stations.
station C starts to send a frame before time t + Tfr. Here, there is also a collision between frames from
The pure ALOHA protocol relies on acknowledgments from the receiver. When a station sends a station B and station C. Looking at Figure , we see that the vulnerable time during which a collision may
frame, it expects the receiver to send an acknowledgment. If the acknowledgment does not arrive after a occur in pure ALOHA is 2 times the frame transmission time.
time-out period, the station assumes that the frame (or the acknowledgment) has been destroyed and
Pure ALOHA vulnerable time = 2 * Tfr
resends the frame.
19 20
Throughput transmission time. Therefore, if a station generates only one frame in this vulnerable time (and no other
Let us call G the average number of frames generated by the system during one frame transmission time. station generates a frame during this time), the frame will reach its destination successfully.
Then it can be proven that the average number of successfully transmitted frames for pure ALOHA is S =
CSMA:
G × e−2G. The maximum throughput Smax is 0.184, for G = 1/2. In other words, if one-half a frame is
To minimize the chance of collision and, therefore, increase the performance, the CSMA method
generated during one frame transmission time (one frame during two frame transmission times), then 18.4
was developed. The chance of collision can be reduced if a station senses the medium before trying to use
percent of these frames reach their destination successfully. We expect G = 1/2 to produce the maximum
it. Carrier sense multiple access (CSMA) requires that each station first listen to the medium (or check
throughput because the vulnerable time is 2 times the frame transmission time. Therefore, if a station
the state of the medium) before sending. In other words, CSMA is based on the principle “sense before
generates only one frame in this vulnerable time (and no other stations generate a frame during this time),
transmit” or “listen before talk.” CSMA can reduce the possibility of collision, but it cannot eliminate it.
the frame will reach its destination successfully.
Persistence Methods: What should a station do if the channel is busy? What should a station do if
Slotted ALOHA the channel is idle? Three methods have been devised to answer these questions: the 1-persistent
Pure ALOHA has a vulnerable time of 2 × Tfr. This is so because there is no rule that defines when the method, the nonpersistent method, and the p-persistent method
station can send. A station may send soon after another station has started or just before another station
has finished. Slotted ALOHA was invented to improve the efficiency of pure ALOHA. In slotted 1-Persistent: The 1-persistent method is simple and straightforward. In this method, after the
ALOHA we divide the time into slots of Tfr seconds and force the station to send only at the beginning of station finds the line idle, it sends its frame immediately (with probability 1). This method has the highest
the time slot. The following Figure shows an example of frame collisions in slotted ALOHA. chance of collision because two or more stations may find the line idle and send their frames immediately.
We will see later that Ethernet uses this method.
Nonpersistent: In the nonpersistent method, a station that has a frame to send senses the line. If
the line is idle, it sends immediately. If the line is not idle, it waits a random amount of time and then
senses the line again. The nonpersistent approach reduces the chance of collision because it is unlikely
that two or more stations will wait the same amount of time and retry to send simultaneously. However,
this method reduces the efficiency of the network because the medium remains idle when there may be
stations with frames to send.
p-Persistent: The p-persistent method is used if the channel has time slots with a slot duration
equal to or greater than the maximum propagation time. The p-persistent approach combines the
advantages of the other two strategies. It reduces the chance of collision and improves efficiency. In this
Fig:Frames in a slotted ALOHA network method, after the station finds the line idle it follows these steps:
1. With probability p, the station sends its frame.
Because a station is allowed to send only at the beginning of the synchronized time slot, if a station 2. With probability q = 1 − p, the station waits for the beginning of the next
misses this moment, it must wait until the beginning of the next time slot. This means that the station time slot and checks the line again.
which started at the beginning of this slot has already finished sending its frame. Of course, there is still a. If the line is idle, it goes to step 1.
the possibility of collision if two stations try to send at the beginning of the same time slot. However, the b. If the line is busy, it acts as though a collision has occurred and uses the
vulnerable time is now reduced to one-half, equal to Tfr. The following Figure shows the situation. backoff procedure.
CSMA/CD:
The CSMA method does not specify the procedure following a collision. Carrier sense multiple access
with collision detection (CSMA/CD) augments the algorithm to handle the collision.
In this method, a station monitors the medium after it sends a frame to see if the transmission was
successful. If so, the station is finished. If, however, there is a collision, the frame is sent again.
Throughput
It can be proven that the average number of successful transmissions for slotted ALOHA is S = G × e−G.
The maximum throughput Smax is 0.368, when G = 1. In other words, if one frame is generated during
one frame transmission time, then 36.8 percent of these frames reach their destination successfully. We
expect G = 1 to produce maximum throughput because the vulnerable time is equal to the frame
Fig: Collision of bits in CSMA/CD
21 22
To better understand CSMA/CD, let us look at the first bits transmitted by the two stations is sensed, a distant station may have already started transmitting. The distant station’s signal has not
involved in the collision. Although each station continues to send bits in the frame until it detects the yet reached this station. The IFS time allows the front of the transmitted signal by the distant station
collision, we show what happens as the first bits collide. In the Figure , stations A and C are involved in to reach this station. After waiting an IFS time, if the channel is still idle, the station can send, but it
the collision still needs to wait a time equal to the contention window (described next). The IFS variable can also
be used to prioritize stations or frame types. For example, a station that is assigned a shorter IFS has
At time t1, station A has executed its persistence procedure and starts sending the bits of its a higher priority.
frame. At time t2, station C has not yet sensed the first bit sent by A. Station C executes its persistence Contention Window. The contention window is an amount of time divided into slots. A station that
procedure and starts sending the bits in its frame, which propagate both to the left and to the right. The is ready to send chooses a random number of slots as its wait time. The number of slots in the
collision occurs sometime after time t2. Station C detects a collision at time t3 when it receives the first window changes according to the binary exponential backoff strategy. This means that it is set to one
bit of A’s frame. Station C immediately (or after a short time, but we assume immediately) aborts slot the first time and then doubles each time the station cannot detect an idle channel after the IFS
transmission. Station A detects collision at time t4 when it receives the first bit of C’s frame; it also
time. This is very similar to the p-persistent method except that a random outcome defines the
immediately aborts transmission. Looking at the figure, we see that A transmits for the duration t4 − t1; C number of slots taken by the waiting station. One interesting point about the contention window is
transmits for the duration t3 − t2. that the station needs to sense the channel after each time slot. However, if the station finds the
Minimum Frame Size: For CSMA/CD to work, we need a restriction on the frame size. Before sending channel busy, it does not restart the process; it just stops the timer and restarts it when the channel is
the last bit of the frame, the sending station must detect a collision, if any, and abort the transmission. sensed as idle. This gives priority to the station with the longest waiting time.
This is so because the station, once the entire frame is sent, does not keep a copy of the frame and does Acknowledgment. With all these precautions, there still may be a collision resulting in destroyed
not monitor the line for collision detection. Therefore, the frame transmission time Tfr must be at least data. In addition, the data may be corrupted during the transmission. The positive acknowledgment
two times the maximum propagation time Tp. To understand the reason, let us think about the worst-case and the time-out timer can help guarantee that the receiver has received the frame.
scenario. If the two stations involved in a collision are the maximum distance apart, the signal from the
first takes time Tp to reach the second, and the effect of the collision takes another time TP to reach the
first. So the requirement is that the first station must still be transmitting after 2Tp.
CSMA/CA:
Carrier sense multiple access with collision avoidance (CSMA/CA) was invented for wireless networks.
Collisions are avoided through the use of CSMA/CA’s three strategies: the interframe space, the
contention window, and acknowledgments.
Interframe Space (IFS). First, collisions are avoided by deferring transmission even if the channel is
found idle. When an idle channel is found, the station does not send immediately. It waits for a
period of time called the interframe space or IFS. Even though the channel may appear idle when it
23 24
Link-Layer Switches
A link-layer switch (or switch) operates in both the physical and the data-link layers. As a link-layer
device, the link-layer switch can check the MAC addresses (source and destination) contained in the
frame.
Filtering
The difference in functionality is between a link-layer switch and a hub is a link-layer switch has filtering
capability. It can check the destination address of a frame and can decide from which outgoing port the
frame should be sent. For example in Figure, we have a LAN with four stations that are connected to a
link-layer switch. If a frame destined for station 71:2B:13:45:61:42 arrives at port 1, the link-layer switch
consults its table to find the departing port. According to its table, frames for 71:2B:13:45:61:42 should
be sent out only through port 2; therefore, there is no need for forwarding the frame through other ports.
25 26
Here, a host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-
point link to the carrier. The packet is stored there until it has fully arrived so the checksum can be verified.
Then it is forwarded to the next router along the path until it reaches the destination host, where it is
delivered. This mechanism is store-and-forward packet switching.
Services Provided to the Transport Layer:
The network layer provides services to the transport layer at the network layer/transport layer interface.
The network layer services have been designed with the following goals in mind.
Routers 1. The services should be independent of the router technology.
A router is a three-layer device; it operates in the physical, data-link, and network layers. As a physical- 2. The transport layer should be shielded from the number, type, and topology of the routers present.
layer device, it regenerates the signal it receives. As a link-layer device, the router checks the physical 3. The network addresses made available to the transport layer should use a uniform numbering plan,
addresses (source and destination) contained in the packet. As a network-layer device, a router checks the even across LANs and WANs.
network-layer addresses. A router can connect networks. In other words, a router is an internetworking
device; it connects independent networks to form an internetwork. According to this definition, two Implementation of Connectionless Service:
networks connected by a router become an internetwork or an internet. There are three major differences Figure 5-2. Routing within a datagram subnet.
between a router and a repeater or a switch.
1. A router has a physical and logical (IP) address for each of its interfaces.
2. A router acts only on those packets in which the link-layer destination address matches the address of
the interface at which the packet arrives.
3. A router changes the link-layer address of the packet (both source and destination) when it forwards the
packet.
27
In above table, the link state packet from A arrives directly, so it must be sent to C and F and acknowledged
to A, as indicated by the flag bits. Similarly, the packet from F has to be forwarded to A and C and
acknowledged to F.
Flooding:
Flooding is another obvious candidate. This algorithm sends a packet on every outgoing line except the
line on which it arrived. The problem with flooding as a broadcast technique is the same problem it has as a
point-to-point routing algorithm: “it generates too many packets and consumes too much bandwidth”.
Multi-destination routing:
A third algorithm is multi-destination routing. If this method is used, each packet contains either a list
of destinations or a bit map indicating the desired destinations. When a packet arrives at a router, the router
checks all the destinations to determine the set of output lines that will be needed. The router generates a new
copy of the packet for each output line to be used and includes in each packet only those destinations that are
to use the line. In effect, the destination set is partitioned among the output lines. After a sufficient number of
hops, each packet will carry only one destination and can be treated as a normal packet.
Use of spanning tree:
A spanning tree is a subset of the subnet that includes all the routers but contains no loops.
When a process sends a multicast packet to a group, the first router examines its spanning tree and prunes
it, removing all lines that do not lead to hosts that are members of the group. In our example, Fig. 5-17(c)
shows the pruned spanning tree for group 1. Similarly, Fig. 5- 17(d) shows the pruned spanning tree for
group 2. Multicast packets are forwarded only along the appropriate spanning tree.
Advantages: Various ways of pruning the spanning tree are possible. The simplest one can be used if link state routing
The reverse path forwarding is that it is both reasonably efficient and easy to implement. is used and each router is aware of the complete topology, including which hosts belong to which groups.
It does not require routers to know about spanning trees. Then the spanning tree can be pruned, starting at the end of each path, working toward the root, and
It does not have the overhead of a destination list or bit map in each broadcast packet as does multi- removing all routers that do not belong to the group in question.
destination addressing.
It does not require any special mechanism to stop the process. Routing for Mobile Hosts:
Figure 5-18. A WAN to which LANs, MANs, and wireless cells are attached.
Multicast Routing:
For some applications such as tele conferencing, a source may want to send packets to multiple
destinations simultaneously or a group of processes implementing a distributed database systems. It is
frequently necessary for one process to send a message to all the other members of the group.
If the group is small, it can just send each other member a point-to-point message.
If the group is large, this strategy is expensive.
Thus, we need a way to send messages to well defined groups that are numerically large in size but small
compared to the network as a whole.
Sending a message to such a group is called multicasting, and its routing algorithm is called multicast
routing. In the model of Fig. 5-18, the world is divided up (geographically) into small units. Let us call them
Multicasting requires group management. areas, where an area is typically a LAN or wireless cell. Each area has one or more foreign agents, which
To create and destroy groups and are processes that keep track of all mobile hosts visiting the area. In addition, each area has a home agent,
To allow processes to join and leave groups. which keeps track of hosts whose home is in the area, but who are currently visiting another area.
The routing algorithm does not know how these tasks are accomplished but when a process joins a group; When a new host enters an area, either by connecting to it (e.g., plugging into the LAN) or just wandering
it informs its host of this fact. It is important that routers know which of their hosts belong to which groups. (travelling) into the cell, his computer must register itself with the foreign agent there. The registration
Either host must inform their routers about changes in group membership, or routers must query their hosts procedure typically works like this:
periodically. Either way, routers learn about which of their hosts are in which groups. Routers tell their 1) Periodically, each foreign agent broadcasts a packet announcing its existence and address. A newly-
neighbors, so the information propagates through the subnet. arrived mobile host may wait for one of these messages, but if none arrives quickly enough, the
To do multicast routing, each router computes a spanning tree covering all other routers. For example, in mobile host can broadcast a packet saying: Are there any foreign agents around?
Fig. 5-17(a) we have two groups, 1 and 2. Some routers are attached to hosts that belong to one or both of 2) The mobile host registers with the foreign agent, giving its home address, current data link layer
these groups, as indicated in the figure. A spanning tree for the leftmost router is shown in Fig. 5-17(b). address, and some security information.
To locate I, A constructs a special ROUTE REQUEST packet and broadcasts it. The packet reaches B and
D, as illustrated in Fig. 5-20(a). In fact, the reason B and D are connected to A in the graph is that they can
receive communication from A. F, for example, is not shown with an arc to A because it cannot receive A's
radio signal. Thus, F is not connected to A.
Route Maintenance:
Ideally, when a host leaves an area, that, too, should be announced to allow deregistration, but many users Because nodes can move or be switched off, the topology can change spontaneously. Periodically, each
abruptly turn off their computers when done. node broadcasts a Hello message. Each of its neighbors is expected to respond to it. If no response is
When a packet is sent to a mobile host, it is routed to the host's home LAN because that is what the forthcoming, the broadcaster knows that that neighbor has moved out of range and is no longer connected to
address says should be done, as illustrated in step 1 of Fig. 5-19. it. Similarly, if it tries to send a packet to a neighbor that does not respond, it learns that the neighbor is no
The home agent then does two things. longer available.
First, it encapsulates the packet in the payload field of an outer packet and sends the latter to the This information is used to purge (remove) routes that no longer work. For each possible destination, each
foreign agent (step 2 in Fig. 5-19). This mechanism is called tunneling; node, N, keeps track of its neighbors that have fed it a packet for that destination during the last ΔT seconds.
Second, the home agent tells the sender to henceforth send packets to the mobile host by These are called N's active neighbors for that destination.
encapsulating them in the payload of packets explicitly addressed to the foreign agent instead of just
sending them to the mobile host's home address (step 3). Subsequent packets can now be routed Congestion Control Algorithms:
directly to the host via the foreign agent (step 4), bypassing the home location entirely. When too many packets are present in (a part of) the subnet, performance degrades. This situation is
called congestion.
Routing in Ad Hoc Networks:
Here routing can be done when the hosts are mobile and also routers themselves are mobile. Among the Figure depicts the onset of congestion. When the number of packets hosts send into the network is well
possibilities are: within its carrying capacity, the number delivered is proportional to the number sent. If twice as many are
1. Military vehicles on a battlefield with no existing infrastructure. sent, twice as many are delivered. However, as the offered load approaches the carrying capacity, bursts of
2. A fleet of ships at sea. traffic occasionally fill up the buffers inside routers and some packets are lost. These lost packets consume
3. Emergency workers at an earthquake that destroyed the infrastructure. some of the capacity, so the number of delivered packets falls below the ideal curve. The network is now
4. A gathering of people with notebook computers in an area lacking 802.11. congested.
In all these cases, and others, each node consists of a router and a host, usually on the same computer.
Networks of nodes that just happen to be near each other are called ad hoc networks or MANETs (Mobile
Ad hoc NETworks).
A variety of routing algorithms for ad hoc networks have been proposed. One of the more interesting ones
is the AODV (Ad hoc On-demand Distance Vector) routing algorithm. It is a distant relative of the
Bellman-Ford distance vector algorithm but adapted to work in a mobile environment and takes into account
the limited bandwidth and low battery life found in this environment. If all of a sudden, streams of packets begin arriving on three or four input lines and all need the same output
It is an on-demand algorithm, that is, it determines a route to some destination only when somebody line, a queue will build up. If there is insufficient memory to hold all of them, packets will be lost. Adding
wants to send a packet to that destination. more memory may help up to a point that if routers have an infinite amount of memory, congestion gets
worse, not better. This is because by the time packets get to the front of the queue, they have already timed
Route Discovery: out (repeatedly) and duplicates have been sent. This makes matters worse, not better—it leads to congestion
Consider the ad hoc network of Fig. 5-20, in which a process at node A wants to send a packet to node I. collapse.
The AODV algorithm maintains a table at each node, keyed (enetered) by destination, giving information
about that destination, including which neighbor to send packets to in order to reach the destination. Suppose Low-bandwidth links or routers that process packets more slowly than the line rate can also become
that A looks in its table and does not find an entry for I. It now has to discover a route to I. This property of congested. In this case, the situation can be improved by directing some of the traffic away from the
discovering routes only when they are needed is what makes this algorithm ''on demand.'' bottleneck to other parts of the network. Eventually, however, all regions of the network will be congested.
Figure 5-20. (a) Range of A's broadcast. (b) After B and D have received A's broadcast
The most basic way to avoid congestion is to build a network that is well matched to the traffic that it carries.
If there is a low-bandwidth link on the path along which most traffic is directed, congestion is likely.
Sometimes resources can be added dynamically when there is serious congestion, for example, turning on
spare routers or enabling lines that are normally used only as backups (to make the system fault tolerant) or
purchasing bandwidth on the open market. This is called provisioning and happens on a time scale of
months, driven by long-term traffic trends.
Some local radio stations have helicopters flying around their cities to report on road congestion to make it
possible for their mobile listeners to route their packets (cars) around hotspots. This is called traffic-aware
routing. Splitting traffic across multiple paths is also helpful.
For example, consider the network illustrated in Fig(a). in which two routers are congested, as indicated.
Sometimes it is not possible to increase capacity. The only way then to beat back the congestion is to Suppose that a host attached to router A wants to set up a connection to a host attached to router B. Normally,
decrease the load. In a virtual-circuit network, new connections can be refused if they would cause the this connection would pass through one of the congested routers. To avoid this situation, we can redraw the
network to become congested. This is called admission control. network as shown in Fig(b). omitting the congested routers and all of their lines. The dashed line shows a
possible route for the virtual circuit that avoids the congested routers.
At a finer granularity, when congestion is imminent the network can deliver feedback to the sources whose
traffic flows are responsible for the problem. The network can request these sources to throttle their traffic, Traffic Throttling
or it can slow down the traffic itself. Two difficulties with this approach are how to identify the onset of When congestion is imminent, it must tell the senders to throttle back their transmissions and slow down.
congestion, and how to inform the source that needs to slow down. The term congestion avoidance is sometimes used to contrast this operating point with the one in which the
To tackle the first issue, routers can monitor the average load, queueing delay, or packet loss. In all cases, network has become (overly) congested.
rising numbers indicate growing congestion. To tackle the second issue, routers must participate in a
feedback loop with the sources. Choke Packets
The most direct way to notify a sender of congestion is to tell it directly. In this approach, the router selects a
Finally, when all else fails, the network is forced to discard packets that it cannot deliver. The general name congested packet and sends a choke packet back to the source host, giving it the destination found in the
for this is load shedding. A good policy for choosing which packets to discard can help to prevent packet. The original packet may be tagged (a header bit is turned on) so that it will not generate any
congestion collapse. more choke packets farther along the path and then forwarded in the usual way. To avoid increasing load on
the network during a time of congestion, the router may only send choke packets at a low rate.
Traffic-Aware Routing
The goal in taking load into account when computing routes is to shift traffic away from hotspots that will be When the source host gets the choke packet, it is required to reduce the traffic sent to the specified
the first places in the network to experience congestion. The most direct way to do this is to set the link destination, for example, by 50%. In a datagram network, choke packets to be sent to fast senders, because
weight to be a function of the (fixed) link bandwidth and propagation delay plus the (variable) measured load they will have the most packets in the queue. The host should ignore these additional chokes for the fixed
or average queuing delay. Least-weight paths will then favour paths that are more lightly loaded, all else time interval until its reduction in traffic takes effect. After that period, further choke packets indicate
being equal. that the network is still congested.
Admission Control
Hop-by-Hop Backpressure
INTERNETWORKING: FIGURE 3.12: SOME OF THE MANY WAYS NETWORKS CAN DIFFER.
Networks can differ in many ways. Some of the differences, such as different There are two basic choices for connecting different networks: we can build
modulation techniques or frame formats, are internal to the physical and data link devices that translate or convert packets from each kind of network into packets for
layers. These differences will not concern us here. Instead, in Fig. 3.12 we list some each other network, or, like good computer scientists, we can try to solve the
of the differences that can be exposed to the network layer. It is papering over problem by adding a layer of indirection and building a common layer on top of the
these differences that makes internetworking more difficult than operating within a different networks. In either case, the devices are placed at the boundaries
single network. between networks.
When packets sent by a source on one network must transit one or more Internetworking has been very successful at building large networks, but it
foreign networks before reaching the destination network, many problems can only works when there is a common network layer. There have, in fact, been many
occur at the interfaces between networks. To start with, the source needs to be network protocols over time. Getting everybody to agree on a single format is
able to address the destination. difficult when companies perceive it to their commercial advantage to have a
proprietary format that they control.
What do we do if the source is on an Ethernet network and the destination is
on a WiMAX network? Assuming we can even specify a WiMAX destination from an A router that can handle multiple network protocols is called a
Ethernet network, packets would cross from a connectionless network to a multiprotocol router. It must either translate the protocols, or leave connection
connection-oriented one. for a higher protocol layer. Neither approach is entirely satisfactory. Connection at a
higher layer, say, by using TCP, requires that all the networks implement TCP
This may require that a new connection be set up on short notice, which (which may not be the case). Then, it limits usage across the networks to
injects a delay, and much overhead if the connection is not used for many more applications that use TCP (which does not include many real-time applications).
packets. Many specific differences may have to be accommodated as well. How do
we multicast a packet to a group with some members on a network that does not TUNNELING:
support multicast?
Handling the general case of making two different networks interwork is
The differing max packet sizes used by different networks can be a major exceedingly difficult. However, there is a common special case that is manageable
nuisance, too. How do you pass an 8000-byte packet through a network whose even for different network protocols. This case is where the source and destination
maximum size is 1500 bytes? If packets on a connection-oriented network transit a hosts are on the same type of network, but there is a different network in between.
connectionless network, they may arrive in a different order than they were sent. As an example, think of an international bank with an IPv6 network in Paris, an
That is something the sender likely did not expect, and it might come as an IPv6 network in London and connectivity between the offices via the IPv4 Internet.
(unpleasant) surprise to the receiver as well. This situation is shown in Fig. 3.13.
1 2
COMPUTER NETWORKS COMPUTER NETWORKS
containing an IPv6 address in London, and sends it to the multiprotocol router that Across the networks that make up the internet, an interdomain or exterior
connects the Paris IPv6 network to the IPv4 Internet. gateway protocol is used. The networks may all use different intradomain
protocols, but they must use the same interdomain protocol.
When this router gets the IPv6 packet, it encapsulates the packet with an
IPv4 header addressed to the IPv4 side of the multiprotocol router that connects to In the Internet, the interdomain routing protocol is called BGP (Border
the London IPv6 network. Gateway Protocol).
That is, the router puts a (IPv6) packet inside a (IPv4) packet. When this There is one more important term to introduce. Since each network is
wrapped packet arrives, the London router removes the original IPv6 packet and operated independently of all the others, it is often referred to as an AS
sends it onward to the destination host. The path through the IPv4 Internet can be (Autonomous System). A good mental model for an AS is an ISP network. In fact,
seen as a big tunnel extending from one multiprotocol router to the other. an ISP network may be comprised of more than one AS, if it is managed, or, has
been acquired, as multiple networks. But the difference is usually not significant.
The IPv6 packet just travels from one end of the tunnel to the other, snug in
its nice box. It does not have to worry about dealing with IPv4 at all. Neither do the PACKET FRAGMENTATION: Each network or link imposes some maximum
hosts in Paris or London. Only the multiprotocol routers have to understand both size on its packets. These limits have various causes, among them:
IPv4 and IPv6 packets.
1. Hardware (e.g., the size of an Ethernet frame).
In effect, the entire trip from one multiprotocol router to the other is like a
2. Operating system (e.g., all buffers are 512 bytes).
hop over a single link. Tunneling is widely used to connect isolated hosts and
networks using other networks. 3. Protocols (e.g., the number of bits in the packet length field).
Networks run by different operators lead to bigger problems. First, the Hosts usually prefer to transmit large packets because this reduces packet
operators may have different ideas about what is a good path through the network. overheads such as bandwidth wasted on header bytes. An obvious internetworking
One operator may want the route with the least delay, while another may want the problem appears when a large packet wants to travel through a network whose
most inexpensive route. This will lead the operators to use different quantities to maximum packet size is too small. This nuisance has been a persistent issue, and
set the shortest-path costs. solutions to it have evolved along with much experience gained on the Internet.
Finally, the internet may be much larger than any of the networks that One solution is to make sure the problem does not occur in the first place.
comprise it. It may therefore require routing algorithms that scale well by using a However, this is easier said than done. A source does not usually know the path a
hierarchy, even if none of the individual networks need to use a hierarchy. packet will take through the network to a destination, so it certainly does not know
how small packets must be to get there. This packet size is called the Path MTU
All of these considerations lead to a two-level routing algorithm. Within each (Path Maximum Transmission Unit).
network, an intradomain or interior gateway protocol is used for routing.
(‘‘Gateway’’ is an older term for ‘‘router.’’) It might be a link state protocol of the The alternative solution to the problem is to allow routers to break up
Kind. packets into fragments, sending each fragment as a separate network layer
3 4
COMPUTER NETWORKS COMPUTER NETWORKS
packet. However, as every parent of a small child knows, converting a large object For file transfer, error-free transmission is more important than fast
into small fragments is considerably easier than the reverse process. transmission. The Type of service field provided 3 bits to signal priority and 3 bits
to signal whether a host cared more about delay, throughput, or reliability.
THE NETWORK LAYER IN THE INTERNET
The Total length includes everything in the datagram—both header and data.
THE IP VERSION 4 PROTOCOL: The maximum length is 65,535 bytes. At present, this upper limit is tolerable, but
with future networks, larger datagrams may be needed.
An appropriate place to start our study of the network layer in the Internet is
with the format of the IP datagrams themselves. An IPv4 datagram consists of a The Identification field is needed to allow the destination host to determine
header part and a body or payload part. The header has a 20-byte fixed part and a which packet a newly arrived fragment belongs to. All the fragments of a packet
variable-length optional part. The header format is shown in Fig. 3.14. The bits are contain the same Identification value.
transmitted from left to right and top to bottom, with the high-order bit of the
Version field going first. (This is a ‘‘big-endian’’ network byte order. DF stands for Don’t Fragment. It is an order to the routers not to fragment
the packet. Originally, it was intended to support hosts incapable of putting the
On little-endian machines, such as Intel x86 computers, a software pieces back together again.
conversion is required on both transmission and reception.) In retrospect, little-
endian would have been a better choice, but at the time IP was designed, no one MF stands for More Fragments. All fragments except the last one have this
knew it would come to dominate computing. bit set. It is needed to know when all fragments of a datagram have arrived.
The Fragment offset tells where in the current packet this fragment belongs.
All fragments except the last one in a datagram must be a multiple of 8 bytes, the
elementary fragment unit. Since 13 bits are provided, there is a maximum of 8192
fragments per datagram, supporting a maximum packet length up to the limit of
the Total length field. Working together, the Identification, MF, and Fragment offset
fields are used to implement fragmentation.
The TtL (Time to live) field is a counter used to limit packet lifetimes. It was
originally supposed to count time in seconds, allowing a maximum lifetime of 255
sec.
When the network layer has assembled a complete packet, it needs to know
what to do with it. The Protocol field tells it which transport process to give the
FIGURE 3.14: THE IPV4 (INTERNET PROTOCOL) HEADER
packet to. TCP is one possibility, but so are UDP and some others.
The Version field keeps track of which version of the protocol the datagram
Since the header carries vital information such as addresses, it rates its own
belongs to.
checksum for protection, the Header checksum. The algorithm is to add up all the
Since the header length is not constant, a field in the header, IHL, is 16-bit halfwords of the header as they arrive, using one’s complement arithmetic,
provided to tell how long the header is, in 32-bit words. The minimum value is 5, and then take the one’s complement of the result. For purposes of this algorithm,
which applies when no options are present. The maximum value of this 4-bit field is the Header checksum is assumed to be zero upon arrival. Such a checksum is
15, which limits the header to 60 bytes, and thus the Options field to 40 bytes. useful for detecting errors while the packet travels through the network.
The Differentiated services field is one of the few fields that have changed its The Source address and Destination address indicate the IP address of the
meaning (slightly) over the years. Originally, it was called the Type of service field. source and destination network interfaces.
Various combinations of reliability and speed are possible. For digitized voice, fast
The Options field was designed to provide an escape to allow subsequent
delivery beats accurate delivery.
versions of the protocol to include information not present in the original design, to
permit experimenters to try out new ideas, and to avoid allocating header bits to
5 6
COMPUTER NETWORKS COMPUTER NETWORKS
information that is rarely needed. The options are of variable length. The Options This format is referred to as dotted-decimal notation. Note that because each
field is padded out to a multiple of 4 bytes. Originally, the five options listed in Fig. byte (octet) is only 8 bits, each number in the dotted-decimal notation is between 0
3.15. and 255. We sometimes see an IPv4 address in hexadecimal notation. Each
hexadecimal digit is equivalent to four bits. This means that a 32-bit address has 8
hexadecimal digits. This notation is often used in network programming. Figure
3.16 shows an IP address in the three discussed notations.
IPV4 ADDRESSES: Figure 3.17 shows the prefix and suffix of a 32-bit IPv4 address. The prefix
length is n bits and the suffix length is (32 − n) bits.
The identifier used in the IP layer of the TCP/IP protocol suite to identify the
connection of each device to the Internet is called the Internet address or IP
address. An IPv4 address is a 32-bit address that uniquely and universally defines
the connection of a host or a router to the Internet. The IP address is the address
of the connection, not the host or the router, because if the device is moved to
another network, the IP address may be changed.
IPv4 addresses are unique in the sense that each address defines one, and
only one, connection to the Internet. If a device has two connections to the
FIGURE 3.16: THREE DIFFERENT NOTATIONS IN IPV4 ADDRESSING
Internet, via two networks, it has two IPv4 addresses. IPv4 addresses are universal
in the sense that the addressing system must be accepted by any host that wants
to be connected to the Internet.
Address Space
7 8
COMPUTER NETWORKS COMPUTER NETWORKS
prefixes were designed instead of one (n = 8, n = 16, and n = 24). The whole the Internet was faced with the problem of the addresses being rapidly used up,
address space was divided into five classes (class A, B, C, D, and E), as shown in resulting in no more addresses available for organizations and individuals that
Figure 3.18. This scheme is referred to as classful addressing. needed to be connected to the Internet.
In class A, the network length is 8 bits, but since the first bit, which is 0, Subnetting and Supernetting: To alleviate address depletion, two
defines the class, we can have only seven bits as the network identifier. This means strategies were proposed and, to some extent, implemented: subnetting and
there are only 27 = 128 networks in the world that can have a class A address. Supernetting. In subnetting, a class A or class B block is divided into several
subnets.
In class B, the network length is 16 bits, but since the first two bits, which
are (10)2, define the class, we can have only 14 bits as the network identifier. This Each subnet has a larger prefix length than the original network. While
means there are only 214 = 16,384 networks in the world that can have a class B subnetting was devised to divide a large block into smaller ones, Supernetting was
address. devised to combine several class C blocks into a larger block to be attractive to
organizations that need more than the 256 addresses available in a class C block.
All addresses that start with (110)2 belong to class C. In class C, the network This idea did not work either because it makes the routing of packets more difficult.
length is 24 bits, but since three bits define the class, we can have only 21 bits as
the network identifier. This means there are 221 = 2,097,152 networks in the world Classless Addressing:
that can have a class C address.
Subnetting and Supernetting in classful addressing did not really solve the
address depletion problem. With the growth of the Internet, it was clear that a
larger address space was needed as a long-term solution. The larger address space,
however, requires that the length of IP addresses also be increased, which means
the format of the IP packets needs to be changed.
Although the long-range solution has already been devised and is called
IPv6, a short-term solution was also devised to use the same address space but to
change the distribution of addresses to provide a fair share to each organization.
The short-term solution still uses IPv4 addresses, but it is called classless
addressing. In other words, the class privilege was removed from the distribution to
compensate for the address depletion.
FIGURE 3.18: OCCUPATION OF THE ADDRESS SPACE IN CLASSFUL In classless addressing, the whole address space is divided into variable
ADDRESSING length blocks. The prefix in an address defines the block (network); the suffix
defines the node (device). Theoretically, we can have a block of 20, 21, 22, . . . ,
Class D is not divided into prefix and suffix. It is used for multicast 232 addresses. One of the restrictions, as we discuss later, is that the number of
addresses. All addresses that start with 1111 in binary belong to class E. As in Class addresses in a block needs to be a power of 2. An organization can be granted one
D, Class E is not divided into prefix and suffix and is used as reserve. block of addresses. Figure 3.19 shows the division of the whole address space into
nonoverlapping blocks.
Advantage of Classful Addressing:
Address Depletion: The reason that classful addressing has become Unlike classful addressing, the prefix length in classless addressing is
obsolete is address depletion. Since the addresses were not distributed properly, variable. We can have a prefix length that ranges from 0 to 32. The size of the
9 10
COMPUTER NETWORKS COMPUTER NETWORKS
network is inversely proportional to the length of the prefix. A small prefix means a
larger network; a large prefix means a smaller network.
IPv6 (IP version 6) is a replacement design that does just that. It uses
128-bit addresses; a shortage of these addresses is not likely any time in the
foreseeable future. However, IPv6 has proved very difficult to deploy. It is a
different network layer protocol that does not really interwork with IPv4, despite
11 12
COMPUTER NETWORKS COMPUTER NETWORKS
many similarities. Also, companies and users are not really sure why they should previously were required are now optional (because they are not used
want IPv6 in any case. so often).
In 1990 IETF started work on a new version of IP, one that would never run o In addition, the way options are represented is different, making
out of addresses, would solve a variety of other problems, and be more flexible and it simple for routers to skip over options not intended for them.
efficient as well. Its major goals were: This feature speeds up packet processing time.
1. Support billions of hosts, even with inefficient address allocation. A fourth area in which IPv6 represents a big advance is in security.
2. Reduce the size of the routing tables. Finally, more attention has been paid to quality of service.
4. Provide better security (authentication and privacy). The Main IPv6 Header:
5. Pay more attention to the type of service, particularly for real-time data. The IPv6 header is shown in Fig. 3.22. The Version field is always 6 for IPv6
(and 4 for IPv4). During the transition period from IPv4, which has already taken
6. Aid multicasting by allowing scopes to be specified. more than a decade, routers will be able to examine this field to tell what kind of
7. Make it possible for a host to roam without changing its address. packet they have.
8. Allow the protocol to evolve in the future. As an aside, making this test wastes a few instructions in the critical path,
given that the data link header usually indicates the network protocol for
9. Permit the old and new protocols to coexist for years. demultiplexing, so some routers may skip the check.
The design of IPv6 presented a major opportunity to improve all of the The Differentiated services field (originally called Traffic class) is used to
features in IPv4 that fall short of what is now wanted. One proposal was to run TCP distinguish the class of service for packets with different real-time delivery
over CLNP, the network layer protocol designed for OSI. With its 160-bit addresses, requirements.
CLNP would have provided enough address space forever.
The Flow label field provides a way for a source and destination to mark
IPv6 meets IETF’s goals fairly well. It maintains the good features of IP, groups of packets that have the same requirements and should be treated in the
discards or deemphasizes the bad ones, and adds new ones where needed. In same way by the network, forming a pseudo connection.
general, IPv6 is not compatible with IPv4, but it is compatible with the other
auxiliary Internet protocols, including TCP, UDP, ICMP, IGMP, OSPF, BGP, and DNS, The Payload length field tells how many bytes follow the 40-byte header of
with small modifications being required to deal with longer addresses. Fig. 3.22. The name was changed from the IPv4 Total length field because the
meaning was changed slightly: the 40 header bytes are no longer counted as part
The main features of IPv6 are discussed below. of the length (as they used to be). This change means the payload can now be
65,535 bytes instead of a mere 65,515 bytes.
First and foremost, IPv6 has longer addresses than IPv4. They are 128
bits long, which solves the problem that IPv6 set out to solve:
providing an effectively unlimited supply of Internet addresses.
13 14
COMPUTER NETWORKS COMPUTER NETWORKS
defined. Each ICMP message type is carried encapsulated in an IP packet. The most
important ones are listed in Fig. 3.23.
8000::123:4567:89AB:CDEF The TIMESTAMP REQUEST and TIMESTAMP REPLY messages are similar,
except that the arrival time of the message and the departure time of the reply are
INTERNET CONTROL PROTOCOLS: recorded in the reply. This facility can be used to measure network performance.
In addition to IP, which is used for data transfer, the Internet has several OSPF—AN INTERIOR GATEWAY ROUTING PROTOCOL:
companion control protocols that are used in the network layer. They include ICMP,
ARP, and DHCP. The Internet is made up of a large number of independent networks or ASes
(Autonomous Systems) that are operated by different organizations, usually a
ICMP—The Internet Control Message Protocol: company, university, or ISP. Inside of its own network, an organization can use its
own algorithm for internal routing, or intradomain routing, as it is more
The operation of the Internet is monitored closely by the routers. When
commonly known. Nevertheless, there are only a handful of standard protocols that
something unexpected occurs during packet processing at a router, the event is
are popular.
reported to the sender by the ICMP (Internet Control Message Protocol). ICMP
is also used to test the Internet. About a dozen types of ICMP messages are
15 16
COMPUTER NETWORKS COMPUTER NETWORKS
An intradomain routing protocol is also called an interior gateway OSPF works by exchanging information between adjacent routers, which is
protocol. We will study the problem of routing between independently operated not the same as between neighboring routers. In particular, it is inefficient to have
networks, or interdomain routing. For that case, all networks must use the same every router on a LAN talk to every other router on the LAN. To avoid this situation,
interdomain routing protocol or exterior gateway protocol. The protocol that is one router is elected as the designated router. It is said to be adjacent to all the
used in the Internet is BGP (Border Gateway Protocol). other routers on its LAN, and exchanges information with them.
Early intradomain routing protocols used a distance vector design, based on In effect, it is acting as the single node that represents the LAN. Neighboring
the distributed Bellman-Ford algorithm inherited from the ARPANET. It works well in routers that are not adjacent do not exchange information with each other. A
small systems, but less well as networks get larger. It also suffers from the count- backup designated router is always kept up to date to ease the transition should
to-infinity problem and generally slow convergence. the primary designated router crash and need to be replaced immediately.
The ARPANET switched over to a link state protocol in May 1979 because of During normal operation, each router periodically floods LINK STATE UPDATE
these problems, and in 1988 IETF began work on a link state protocol for messages to each of its adjacent routers. These messages gives its state and
intradomain routing. That protocol, called OSPF (Open Shortest Path First), provide the costs used in the topological database. The flooding messages are
became a standard in 1990. It drew on a protocol called IS-IS (Intermediate- acknowledged, to make them reliable.
System to Intermediate-System), which became an ISO standard.
Each message has a sequence number, so a router can see whether an
Given the long experience with other routing protocols, the group designing incoming LINK STATE UPDATE is older or newer than what it currently has. Routers
OSPF had a long list of requirements that had to be met. First, the algorithm had to also send these messages when a link goes up or down or its cost changes.
be published in the open literature, hence the ‘‘O’’ in OSPF.
DATABASE DESCRIPTION messages give the sequence numbers of all the
Second, the new protocol had to support a variety of distance metrics, link state entries currently held by the sender. By comparing its own values with
including physical distance, delay, and so on. Third, it had to be a dynamic those of the sender, the receiver can determine who has the most recent values.
algorithm, one that adapted to changes in the topology automatically and quickly. These messages are used when a link is brought up.
Fourth, and new for OSPF, it had to support routing based on type of service. All these messages are sent directly in IP packets. The five kinds of
The new protocol had to be able to route real-time traffic one way and other traffic messages are summarized in Fig. 3.24.
a different way. At the time, IP had a Type of service field, but no existing routing
protocol used it. This field was included in OSPF but still nobody used it, and it was
eventually removed.
Fifth, and related to the above, OSPF had to do load balancing, splitting the
load over multiple lines. Most previous protocols sent all packets over a single best
route, even if there were two routes that were equally good. The other route was
not used at all. In many cases, splitting the load over multiple routes gives better
performance.
FIGURE 3.24: THE FIVE TYPES OF OSPF MESSAGES
Sixth, support for hierarchical systems was needed. By 1988, some networks
BGP—THE EXTERIOR GATEWAY ROUTING PROTOCOL:
had grown so large that no router could be expected to know the entire topology.
OSPF had to be designed so that no router would have to. Within a single AS, OSPF and IS-IS are the protocols that are commonly
used. Between ASes, a different protocol, called BGP (Border Gateway Protocol),
OSPF supports both point-to-point links (e.g., SONET) and broadcast
is used. A different protocol is needed because the goals of an intradomain protocol
networks (e.g., most LANs). Actually, it is able to support networks with multiple
and an interdomain protocol are not the same. All an intradomain protocol has to
routers, each of which can communicate directly with the others (called multi-
do is move packets as efficiently as possible from the source to the destination.
access networks) even if they do not have broadcast capability. Earlier protocols
did not handle this case well.
17 18
COMPUTER NETWORKS COMPUTER NETWORKS
At the bottom, it has the same AS path but a different next hop because it
came across a different link. This advertisement continues to propagate and crosses
the boundary into AS1. At router R1a, at the top of the figure, the AS path is AS2,
AS3 and the next hop is R2a.
Carrying the complete path with the route makes it easy for the receiving
router to detect and break routing loops. The rule is that each router that sends a
route outside of the AS prepends its own AS number to the route. (This is why the
list is in reverse order.)
FIGURE 3.26: POSITION OF IP & OTHER NETWORK-LAYER
PROTOCOLS IN TCP/IP PROTOCOL SUITE
IPv4 is also a connectionless protocol that uses the datagram approach. This
means that each datagram is handled independently, and each datagram can follow
a different route to the destination. This implies that datagrams sent by the same
source to the same destination could arrive out of order. Again, IPv4 relies on a
FIGURE 3.25: PROPAGATION OF BGP ROUTE ADVERTISEMENTS
higher-level protocol to take care of all these problems.
When a router receives a route, it checks to see if its own AS number is
DATAGRAM FORMAT:
already in the AS path. If it is, a loop has been detected and the advertisement is
discarded. Packets used by the IP are called datagrams. Figure 3.27 shows the IPv4
datagram format. A datagram is a variable-length packet consisting of two parts:
19 20
COMPUTER NETWORKS COMPUTER NETWORKS
header and payload (data). The header is 20 to 60 bytes in length and contains Protocol. In TCP/IP, the data section of a packet, called the payload, carries the
information essential to routing and delivery. It is customary in TCP/IP to show the whole packet from another protocol. A datagram, for example, can carry a
header in 4-byte sections. packet belonging to any transport-layer protocol such as UDP or TCP. A
datagram can also carry a packet from other protocols that directly use the
Version Number. The 4-bit version number (VER) field defines the version of service of the IP, such as some routing protocols or some auxiliary protocols.
the IPv4 protocol, which, obviously, has the value of 4.
Header checksum. IP is not a reliable protocol; it does not check whether the
Header Length. The 4-bit header length (HLEN) field defines the total length of payload carried by a datagram is corrupted during the transmission. IP puts the
the datagram header in 4-byte words. The IPv4 datagram has a variable-length
burden of error checking of the payload on the protocol that owns the payload,
header. such as UDP or TCP. The datagram header, however, is added by IP, and its
Service Type. In the original design of the IP header, this field was referred to error-checking is the responsibility of IP.
as type of service (TOS), which defined how the datagram should be handled. Source and Destination Addresses. These 32-bit source and destination
address fields define the IP address of the source and destination respectively.
The source host should know its IP address. The destination IP address is either
known by the protocol that uses the service of IP or is provided by the DNS.
Payload. Payload, or data, is the main reason for creating a datagram. Payload
is the packet coming from other protocols that use the service of IP. Comparing
a datagram to a postal package, payload is the content of the package; the
header is only the information written on the package.
ICMPv4:
Total Length. This 16-bit field defines the total length (header plus data) of the The Internet Control Message Protocol version 4 (ICMPv4) has been
IP datagram in bytes. A 16-bit number can define a total length of up to 65,535 designed to compensate for the above two deficiencies. It is a companion to the IP
(when all bits are 1s). protocol. ICMP itself is a network-layer protocol.
Identification, Flags, and Fragmentation Offset. These three fields are However, its messages are not passed directly to the data-link layer as would
related to the fragmentation of the IP datagram when the size of the datagram be expected. Instead, the messages are first encapsulated inside IP datagrams
is larger than the underlying network can carry. before going to the lower layer. When an IP datagram encapsulates an ICMP
message, the value of the protocol field in the IP datagram is set to 1 to indicate
Time-to-live. The time-to-live (TTL) field is used to control the maximum that the IP payroll is an ICMP message.
number of hops (routers) visited by the datagram. When a source host sends
the datagram, it stores a number in this field. This value is approximately two MESSAGES:
times the maximum number of routers between any two hosts. Each router that
ICMP messages are divided into two broad categories: error-reporting
processes the datagram decrements this number by one. If this value, after
messages and query messages.
being decremented, is zero, the router discards the datagram.
21 22
COMPUTER NETWORKS COMPUTER NETWORKS
The error-reporting messages report problems that a router or a host Source Quench: Another error message is called the source quench (type 4)
(destination) may encounter when it processes an IP packet. message, which informs the sender that the network has encountered congestion
and the datagram has been dropped; the source needs to slow down sending more
The query messages, which occur in pairs, help a host or a network datagrams.
manager get specific information from a router or another host. For example,
nodes can discover their neighbors. Also, hosts can discover and learn about
routers on their network and routers can help a node redirect its messages.
As Figure 3.28 shows, the first field, ICMP type, defines the type of the
message. The code field specifies the reason for the particular message type. The
last common field is the checksum field (to be discussed later in the chapter). The
rest of the header is specific for each message type.
The data section in error messages carries information for finding the original
packet that had the error. In query messages, the data section carries extra
information based on the type of query.
Error Reporting Messages: Since IP is an unreliable protocol, one of the FIGURE 3.28: GENERAL FORMAT OF ICMP MESSAGES
main responsibilities of ICMP is to report some errors that may occur during the
Redirection Message: The redirection message (type 5) is used when the
processing of the IP datagram. ICMP does not correct errors, it simply reports
source uses a wrong router to send out its message. The router redirects the
them.
message to the appropriate router, but informs the source that it needs to change
Error correction is left to the higher-level protocols. Error messages are its default router in the future. The IP address of the default router is sent in the
always sent to the original source because the only information available in the message.
datagram about the route is the source and destination IP addresses.
Parameter Problem: A parameter problem message (type 12) can be sent
ICMP uses the source IP address to send the error message to the source when either there is a problem in the header of a datagram (code 0) or some
(originator) of the datagram. To make the error-reporting process simple, ICMP options are missing or cannot be interpreted (code 1).
follows some rules in reporting messages:
Query Messages: Query messages in ICMP can be used independently
First, no error message will be generated for a datagram having a without relation to an IP datagram. Of course, a query message needs to be
multicast address or special address (such as this host or loopback). encapsulated in a datagram, as a carrier.
Second, no ICMP error message will be generated in response to a Query messages are used to probe or test the liveliness of hosts or routers in
datagram carrying an ICMP error message. the Internet, find the one-way or the round-trip time for an IP datagram between
two devices, or even find out whether the clocks in two devices are synchronized.
Third, no ICMP error message will be generated for a fragmented Naturally, query messages come in pairs: request and reply.
datagram that is not the first fragment.
23 24
COMPUTER NETWORKS COMPUTER NETWORKS
protocol defined at the network layer; it is one of the auxiliary protocols, like ICMP, or hosts. The message is encapsulated in a datagram with the destination
which is considered part of the IP. IGMP messages, like ICMP messages, are address set to the corresponding multicast address. Although all hosts
encapsulated in an IP datagram. receive this message, those not interested drop it.
There are only two types of messages in IGMP version 3, query and report A report message is sent by a host as a response to a query message. The
messages, as shown in Figure 3.29. A query message is periodically sent by a message contains a list of records in which each record gives the identifier of the
router to all hosts attached to it to ask them to report their interests about corresponding group (multicast address) and the addresses of all sources that the
membership in groups. A report message is sent by a host as a response to a query host is interested in receiving messages from (inclusion).
message.
The record can also mention the source addresses from which the host does
not desire to receive a group message (exclusion). The message is encapsulated in
a datagram with the multicast address 224.0.0.22 (multicast address assigned to
IGMPv3).
6. 6. Multidestination routing
a) is same as broadcast routing b) contains the list of all destinations 15. A routing table contains information entered manually.
c) data is not sent by packets d) none
a. Static b. Dynamic
c. Hierarchical d. Non static
7. A subset of a network that includes all the routers but contains no loops is
called
16. Which of the following is/are the uses of static routing methods?
a) spanning tree b) spider structure
c) spider tree d) none a. To manually define a default route. b. To provide more secure network
environment.
8. Which one of the following algorithm is not used for congestion control? c. To provide more efficient resource utilization. d. All of the above
a) traffic aware routing b) admission control
c) load shedding d) none of the mentioned 17. A routing table is updated periodically using one of the dynamic routing
protocols.
a. static b. dynamic
c. hierarchical d. non static
27 28
COMPUTER NETWORKS COMPUTER NETWORKS
27. A one-to-all communication between one source and all hosts on a network is
18.Which of the following is not the category of dynamic routing algorithm? classified as a .
a. Distance vector protocols b. Link state protocols a. unicast b. multicast
c. Hybrid protocols d. Automatic state protocols c. broadcast d. point to point
19. In forwarding, the full IP address of a destination is given in the 28. allow the exchange of summary information between autonomous
routing table. systems.
a. next-hop b. network-specific a. Interior Gateway Protocol (IGP) b. Exterior Gateway Protocol
c. host-specific d. default (EGP)
c. Border Gateway Protocol (BGP) d. Dynamic Gateway Protocol (DGP)
20. To build the routing table, algorithms allow routers to automatically
discover and maintain awareness or the paths through the network. 29).A robust routing protocol provides the ability to .......... build and manage the
a. Static routing b. dynamic routing information in the IP routing table.
c. Hybrid routing d. automatic routing a. Dynamically b. Statically
c. Hierarchically d. All of the above
21. In forwarding, the mask and destination addresses are both 0.0.0.0 in
the routing table. 30. State True of False for definition of an autonomous system(AS).
a. next-hop b. network-specific i) An AS is defined as a physical portion of a larger IP network.
c. host-specific d. default ii) An AS is normally comprised of an internetwork within an organization.
a. i-True, ii-True b. i-True, ii-False
22).To build the routing table, method use preprogrammed definitions c. i-False, ii-True d. i-False, ii-False
representing paths through the network.
a. Static routing b. dynamic routing 31. What are the parameters on which two networks differ.
c. Hybrid routing d. automatic routing a) Packet sized used b) use flow and error control technique
c) Connectionless control and security mechanism d) all
23).In forwarding, the destination addresses is a network address in the
32. are the limitations that cause different networks have different
routing table. packet size.
a. next-hop b. network-specific a) hardware b) operating system
c. host-specific d. default c) protocols d) all
24). allows routers to exchange information within an AS. 33. Fragmentation means
a. Interior Gateway Protocol (IGP) b. Exterior Gateway Protocol a) adding of sma;ll packets to form large packets
b) breaking the large packet into small packets
(EGP)
c) forwarding packet through different networks
c. Border Gateway Protocol (BGP) d. Static Gateway Protocol
d) None
(SGP)
34. The header part of a fragment contains number of fields
25. In forwarding, the routing table holds the address of just the next hop a) 2 b)3 c)1 d)4
instead of complete route information.
a. next-hop b. network-specific 35. The header checksum is the IP header is used to verify .
c. host-specific d. default a) only header b) only data c) both d) None
42. Bridges are used in layer. 3. What is meant by connection state information in a virtual circuit network?
a) physical b)MAC c)network d)application
4. Compare Virtual-Circuit and Datagram Subnets.
43. Which is a intranet working device
a) router b)gateway c)bridge d)ALL 5. What is routing algorithm? What are the classifications of it?
46. The length of the subnet mask is bits . 9. Explain distance vector routing algorithm.
a)16 bits b)32bits c)64bits d)any
10. Explain count-to-infinity problem.
47. Address resolution protocol is used to MAP the IP address on to the . 11. Write short notes on the following
a) data link layer b)internet address c)network address d)port (a) IPV4 (b) IPV6
address 12. Write about Internet Control Protocols.
48. RARP is used to map the data link layer address onto
address.
a)network b)port c)IP d)None
50. Which class of IP addressing provide more number of hosts in each network
a)class-A b)class-B c)class-c d)class-D
31 32
COMPUTER NETWORKS COMPUTER NETWORKS
UNIT-IV
Furthermore, the connectionless transport service is also very similar to
TRANSPORT LAYER: the connectionless network service. However, note that it can be difficult to provide
a connectionless transport service on top of a connection-oriented network service,
The transport layer in the TCP/IP suite is located between the application since it is inefficient to set up a connection to send a single packet and then tear
layer and the network layer. It provides services to the application layer and (meaning run/rip/rush) it down immediately afterwards.
receives services from the network layer.
The transport layer acts as a liaison between a client program and a server
program, a process-to-process connection. The transport layer is the heart of the
TCP/IP protocol suite; it is the end-to-end logical vehicle for transferring data from
one point to another in the Internet.
Introduction:
The transport layer is located between the application layer and the network
layer. It provides a process-to-process communication between two application
layers, one at the local host and the other at the remote host.
THE TRANSPORT SERVICE: To allow users to access the transport service, the transport layer must
provide some operations to application programs, that is, a transport service
Services provided to the upper layers: interface. Each transport service has its own interface.
The ultimate goal of the transport layer is to provide efficient, reliable, and The transport service is similar to the network service, but there are also
cost-effective data transmission service to its users, normally processes in the some important differences. The main difference is that the network service is
application layer. To achieve this, the transport layer makes use of the services intended to model the service offered by real networks and all. Real networks can
provided by the network layer. The software and/or hardware within the transport lose packets, so the network service is generally unreliable.
layer that does the work is called the transport entity.
The connection-oriented transport service, in contrast, is reliable. Of course,
The transport entity can be located in the operating system kernel, in a real networks are not error-free, but that is precisely the purpose of the transport
library package bound into network applications, in a separate user process, or layer—to provide a reliable service on top of an unreliable network.
even on the network interface card. The first two options are most common on the
Internet. The (logical) relationship of the network, transport, and application layers A second difference between the network service and transport service is
is illustrated in Fig. 4.1. whom the services are intended for. The network service is used only by the
transport entities. Few users write their own transport entities, and thus few users
Just as there are two types of network service, connection-oriented and or programs ever (meaning always/forever/still) see the bare network service.
connectionless, there are also two types of transport service. The connection-
oriented transport service is similar to the connection-oriented network service Berkeley sockets: Let us now briefly inspect another set of transport
in many ways. In both cases, connections have three phases: establishment, data primitives, the socket primitives as they are used for TCP. Sockets were first
transfer, and release. Addressing and flow control are also similar in both layers. released as part of the Berkeley UNIX 4.2BSD software distribution in 1983. They
quickly became popular.
The primitives are now widely used for Internet programming on many For another thing, the process of establishing a connection over the wire of
operating systems, especially UNIX-based systems, and there is a socket-style API Fig. 4.3(a) is simple: the other end is always there (unless it has crashed, in which
for Windows called ‘‘winsock.’’ The primitives are listed in Fig. 4.2. case it is not there). Either way, there is not much to do.
Even on wireless links, the process is not much different. Just sending a
message is sufficient to have it reach all other destinations. If the message is not
acknowledged due to an error, it can be resent. In the transport layer, initial
connection establishment is complicated.
Addressing:
Figure 4.3: Environment of the (a) data link layer (b) transport layer
At the data link layer, two routers communicate directly via a physical
channel, whether wired or wireless, whereas at the transport layer, this physical
channel is replaced by the entire network.
For one thing, over point-to-point links such as wires or optical fiber, it is
usually not necessary for a router to specify which router it wants to talk to—each
outgoing line leads directly to a particular router. In the transport layer, explicit Figure 4.4: TSAPs, NSAPs, and Transport connections
addressing of destinations is required.
Application processes, both clients and servers, can attach themselves to a The sender then times out and sends them all again. This time the packets
local TSAP to establish a connection to a remote TSAP. These connections run take the shortest route and are delivered quickly so the sender releases the
through NSAPs on each host, as shown in figure 4.4. connection.
A possible scenario for a transport connection is as follows: Unfortunately, eventually the initial batch of packets finally come out of
hiding and arrive at the destination in order, asking the bank to establish a new
1. A mail server process attaches itself to TSAP 1522 on host 2 to wait connection and transfer money (again). The bank has no way of telling that these
for an incoming call. A call such as our LISTEN might be used, for are duplicates. It must assume that this is a second, independent transaction, and
example. transfers the money again.
Packet lifetime can be restricted to a known maximum using one (or more) When it arrives, the recipient sends back a DR segment and starts a timer,
of the following techniques: just in case its DR is lost. When this DR arrives, the original sender sends back an
ACK segment and releases the connection.
1. Restricted network design.
Connection Release:
Releasing a connection is easier than establishing one. There are two styles
of terminating a connection: asymmetric release and symmetric release.
Asymmetric release is the way the telephone system works: when one
party hangs up, the connection is broken.
Asymmetric release is abrupt and may result in data loss. Consider the
scenario of Fig. 4.6. After the connection is established, host 1 sends a segment
that arrives properly at host 2. Then host 1 sends another segment.
Symmetric release does the job when each process has a fixed amount of Figure 4.5: Three protocol scenarios for establishing a connection
data to send and clearly knows when it has sent it. In other situations, determining using a three-way handshake. CR denotes Connection Request. (a) normal
that all the work has been done and the connection should be terminated is not so operation. (b) old duplicate connection request appearing out of nowhere.
obvious. (c) duplicate connection request and duplicate ack.
One can envision a protocol in which host 1 says ‘‘I am done. Are you done Finally, when the ACK segment arrives, the receiver also releases the
too?’’ If host 2 responds: ‘‘I am done too. Goodbye, the connection can be safely connection. Releasing a connection means that the transport entity removes the
released.’’ information about the connection from its table of currently open connections and
signals the connection’s owner (the transport user) somehow.
In practice, we can avoid this quandary (meaning dilemma/difficulty) by
foregoing the need for agreement and pushing the problem up to the transport If the final ACK segment is lost, as shown in Fig. 4.7(b), the situation is
user, letting each side independently decide when it is done. This is an easier saved by the timer. When the timer expires, the connection is released anyway.
problem to solve. Now consider the case of the second DR being lost.
Figure 4.7 illustrates four scenarios of releasing using a three-way The user initiating the disconnection will not receive the expected response,
handshake. While this protocol is not infallible, it is usually adequate. In Fig. 4.7(a), will time out, and will start all over again. In Fig. 4.7(c), we see how this works,
we see the normal case in which one of the users sends a DR (DISCONNECTION assuming that the second time no segments are lost and all segments are delivered
REQUEST) segment to initiate the connection release. correctly and on time.
Our last scenario, Fig. 4.7(d), is the same as Fig. 4.7(c) except that now we
assume all the repeated attempts to retransmit the DR also fail due to lost
segments. After N retries, the sender just gives up and releases the connection.
Meanwhile, the receiver times out and also exits.
MULTIPLEXING:
When a segment comes in, some way is needed to tell which process to give
it to. This situation, called multiplexing, is shown in Fig. 4.8(a). In this figure, four
distinct transport connections all use the same network connection (e.g., IP
address) to the remote host.
Multiplexing can also be useful in the transport layer for another reason.
Figure 4.8: (A) Multiplexing (B) Inverse Multiplexing
Suppose, for example, that a host has multiple network paths that it can use. If a
user needs more bandwidth or more reliability than one of the network paths can
provide, a way out is to have a connection that distributes the traffic among
multiple network paths on a round-robin basis, as indicated in Fig. 4.8(b).
If hosts and routers are subject to crashes or connections are long-lived In the preceding discussion, we did not talk about how to divide bandwidth
(e.g., large software or media downloads), recovery from these crashes becomes between different transport senders. This sounds like a simple question to answer—
an issue. give all the senders an equal fraction of the bandwidth—but it involves several
considerations.
If the transport entity is entirely within the hosts, recovery from network and
router crashes is straightforward. The transport entities expect lost segments all Perhaps the first consideration is to ask what this problem has to do with
the time and know how to cope with them by using retransmissions. congestion control.
A more troublesome problem is how to recover from host crashes. In A second consideration is what a fair portion means for flows in a network. It
particular, it may be desirable for clients to be able to continue working when is simple enough if N flows use a single link, in which case they can all have 1/N of
servers crash and quickly reboot. the bandwidth (although efficiency will dictate that they use slightly less if the
traffic is bursty).
CONGESTION CONTROL:
But what happens if the flows have different, but overlapping, network
If the transport entities on many machines send too many packets into the paths? For example, one flow may cross three links, and the other flows may cross
network too quickly, the network will become congested, with performance one link. The three-link flow consumes more network resources. It might be fairer
degraded as packets are delayed and lost. in some sense to give it less bandwidth than the one-link flows.
Controlling congestion to avoid this problem is the combined responsibility of The form of fairness that is often desired for network usage is max-min
the network and transport layers. Congestion occurs at routers, so it is detected at fairness. An allocation is max-min fair if the bandwidth given to one flow cannot be
the network layer. increased without decreasing the bandwidth given to another flow with an allocation
that is no larger.
However, congestion is ultimately caused by traffic sent into the network by
the transport layer. The only effective way to control congestion is for the transport Convergence:
protocols to send packets into the network more slowly.
A final criterion is that the congestion control algorithm converge quickly to a
DESIRABLE BANDWIDTH ALLOCATION: fair and efficient allocation of bandwidth. The discussion of the desirable operating
point above assumes a static network environment.
Before we describe how to regulate traffic, we must understand what we are
trying to achieve by running a congestion control algorithm. That is, we must However, connections are always coming and going in a network, and the
specify the state in which a good congestion control algorithm will operate the bandwidth needed by a given connection will vary over time too. Because of the
network. variation in demand, the ideal operating point for the network varies over time.
The goal is more than to simply avoid congestion. It is to find a good A good congestion control algorithm should rapidly converge to the ideal
allocation of bandwidth to the transport entities that are using the network. A good operating point, and it should track that point as it changes over time. If the
allocation will deliver good performance because it uses all the available bandwidth convergence is too slow, the algorithm will never be close to the changing operating
but avoids congestion, it will be fair across competing transport entities, and it will point. If the algorithm is not stable, it may fail to converge to the right point in
quickly track changes in traffic demands. some cases, or even oscillate around the right point.
An efficient allocation of bandwidth across transport entities will use all of the Now it is time to regulate the sending rates to obtain a desirable bandwidth
network capacity that is available. However, it is not quite right to think that if allocation. The sending rate may be limited by two factors.
there is a 100-Mbps link, five transport entities should get 20 Mbps each. They
should usually get less than 20 Mbps for good performance.
The first is flow control, in the case that there is insufficient buffering at Wireless networks lose packets all the time due to transmission errors. To
the receiver. function well, the only packet losses that the congestion control algorithm should
observe are losses due to insufficient bandwidth, not losses due to transmission
The second is congestion, in the case that there is insufficient capacity in errors. One solution to this problem is to mask the wireless losses by using
the network. retransmissions over the wireless link.
INTRODUCTION TO UDP:
When a UDP packet arrives, its payload is handed to the process attached to
the destination port. This attachment occurs when the BIND primitive or something
similar is used.
Wireless issues:
Figure 4.10: the UDP header
Transport protocols such as TCP that implement congestion control should be
independent of the underlying network and link layer technologies. That is a good Think of ports as mailboxes that applications can rent to receive packets. In
theory, but in practice there are issues with wireless networks. The main issue is fact, the main value of UDP over just using raw IP is the addition of the source and
that packet loss is often used as a congestion signal, including by TCP. destination ports.
Without the port fields, the transport layer would not know what to do with
each incoming packet. With them, it delivers the embedded segment to the correct
application.
The source port is primarily needed when a reply must be sent back to the
source. By copying the Source port field from the incoming segment into the
Destination port field of the outgoing segment, the process sending the reply can
specify which process on the sending machine is to get it.
The UDP length field includes the 8-byte header and the data. The minimum
length is 8 bytes, to cover the header. The maximum length is 65,515 bytes, which
is lower than the largest number that will fit in 16 bits because of the size limit on
IP packets.
An optional Checksum is also provided for extra reliability. It checksums the Figure 4.12: Steps in making a remote procedure call, the stubs are
shaded
header, the data, and a conceptual IP pseudoheader. When performing this
computation, the Checksum field is set to zero and the data field is padded out with
an additional zero byte if its length is an odd number. Step 4 is the operating system passing the incoming packet to the server stub.
The checksum algorithm is simply to add up all the 16-bit words in one’s
complement and to take the one’s complement of the sum. Finally, step 5 is the server stub calling the server procedure with the
unmarshaled parameters.
Remote procedure call: The reply traces the same path in the other direction.
In a certain sense, sending a message to a remote host and getting a reply The key item to note here is that the client procedure, written by the user,
back is a lot like making a function call in a programming language. The idea just makes a normal (i.e., local) procedure call to the client stub, which has the
behind RPC is to make a remote procedure call look as much as possible like a local same name as the server procedure. Since the client procedure and client stub are
one. in the same address space, the parameters are passed in the usual way.
In the simplest form, to call a remote procedure, the client program must be Similarly, the server procedure is called by a procedure in its address space
bound with a small library procedure, called the client stub, that represents the with the parameters it expects. To the server procedure, nothing is unusual.
server procedure in the client’s address space.
Real-Time Transport Protocols
Similarly, the server is bound with a procedure called the server stub.
These procedures hide the fact that the procedure call from the client to the server Client-server RPC is one area in which UDP is widely used. Another one is for
is not local. The actual steps in making an RPC are shown in Fig. 4.12. real-time multimedia applications.
RTP—The Real-Time Transport Protocol: to. It is the method used to multiplex and demultiplex multiple data streams onto a
single stream of UDP packets.
The basic function of RTP is to multiplex several real-time data streams onto
a single stream of UDP packets. The UDP stream can be sent to a single destination Finally, the Contributing source identifiers, if any, are used when mixers are
(unicasting) or to multiple destinations (multicasting). present.
Because RTP just uses normal UDP, its packets are not treated specially by RTCP—The Real-time Transport Control Protocol
the routers unless some normal IP quality-of-service features are enabled. In
particular, there are no special guarantees about delivery, and packets may be lost, RTP has a little sister protocol (little sibling protocol?) called RTCP
delayed, corrupted, etc. (Realtime Transport Control Protocol). It is defined along with RTP in RFC 3550
and handles feedback, synchronization, and the user interface. It does not transport
The RTP format contains several features to help receivers work with any media samples.
multimedia information. The RTP header is illustrated in Fig. 4.13. It consists of
three 32-bit words and potentially some extensions. THE INTERNET TRANSPORT PROTOCOLS:
TCP
UDP is a simple protocol and it has some very important uses, such as
clientserver interactions and multimedia, but for most Internet applications,
reliable, sequenced delivery is needed. UDP cannot provide this, so another protocol
is required. It is called TCP and is the main workhorse of the Internet.
Introduction to TCP:
The Timestamp is produced by the stream’s source to note when the first
sample in the packet was made.
The Synchronization source identifier tells which stream the packet belongs
It is up to TCP to send datagrams fast enough to make use of the capacity A key feature of TCP, and one that dominates the protocol design, is that
but not cause congestion, and to time out and retransmit any datagrams that are every byte on a TCP connection has its own 32-bit sequence number. When the
not delivered. Datagrams that do arrive may well do so in the wrong order; it is
Internet began, the lines between routers were mostly 56-kbps leased lines, so a
also up to TCP to reassemble them into messages in the proper sequence.
host blasting away at full speed took over 1 week to cycle through the sequence
The TCP Service Model: numbers.
TCP service is obtained by both the sender and the receiver creating end The sending and receiving TCP entities exchange data in the form of
points, called sockets. Each socket has a socket number (address) consisting of segments. A TCP segment consists of a fixed 20-byte header (plus an optional
the IP address of the host and a 16-bit number local to that host, called a port. A part) followed by zero or more data bytes. The TCP software decides how big
port is the TCP name for a TSAP. segments should be.
For TCP service to be obtained, a connection must be explicitly established It can accumulate data from several writes into one segment or can split data
between a socket on one machine and a socket on another machine. A socket may from one write over multiple segments. Two limits restrict the segment size. First,
be used for multiple connections at the same time. In other words, two or more each segment, including the TCP header, must fit in the 65,515- byte IP payload.
connections may terminate at the same socket. Second, each link has an MTU (Maximum Transfer Unit).
Port numbers below 1024 are reserved for standard services that can usually Each segment must fit in the MTU at the sender and receiver so that it can
only be started by privileged users (e.g., root in UNIX systems). They are called be sent and received in a single, unfragmented packet. However, it is still possible
well-known ports. for IP packets carrying TCP segments to be fragmented when passing over a
network path for which some link has a small MTU.
For example, any process wishing to remotely retrieve mail from a host can
connect to the destination host’s port 143 to contact its IMAP daemon. The list of If this happens, it degrades performance and causes other problems.
well-known ports is given at www.iana.org. Over 700 have been assigned. A few of Instead, modern TCP implementations perform path MTU discovery by using the
the better-known ones are listed in Fig. 4.14. technique outlined in RFC 1191. This technique uses ICMP error messages to find
the smallest MTU for any link on the path. TCP then adjusts the segment size
downwards to avoid fragmentation.
The basic protocol used by TCP entities is the sliding window protocol with a
dynamic window size. When a sender transmits a segment, it also starts a timer.
When the segment arrives at the destination, the receiving TCP entity sends back a
segment (with data if any exist, and otherwise without) bearing an
acknowledgement number equal to the next sequence number it expects to receive
and the remaining window size.
If the sender’s timer goes off before the acknowledgement is received, the
sender transmits the segment again.
All TCP connections are full duplex and point-to-point. Full duplex means that Figure 4.15 shows the layout of a TCP segment. Every segment begins with a
traffic can go in both directions at the same time. Point-to-point means that each fixed-format, 20-byte header. The fixed header may be followed by header options.
connection has exactly two end points. TCP does not support multicasting or After the options, if any, up to 65,535 − 20 − 20 = 65,495 data bytes may follow,
broadcasting. where the first 20 refer to the IP header and the second to the TCP header.
A TCP connection is a byte stream, not a message stream. Message
oundaries are not preserved end to end.
Segments without any data are legal and are commonly used for The ACK bit is set to 1 to indicate that the Acknowledgement number is valid.
acknowledgements and control messages. This is the case for nearly all packets. If ACK is 0, the segment does not contain an
acknowledgement, so the Acknowledgement number field is ignored.
The PSH bit indicates PUSHed data. The receiver is hereby kindly requested
to deliver the data to the application upon arrival and not buffer it until a full buffer
has been received (which it might otherwise do for efficiency).
The RST bit is used to abruptly reset a connection that has become confused
due to a host crash or some other reason.
The SYN bit is used to establish connections. The FIN bit is used to release a
connection.
The Window size field tells how many bytes may be sent starting at the byte
acknowledged.
A Checksum is also provided for extra reliability. The Options field provides a
way to add extra facilities not covered by the regular header.
The Source port and Destination port fields identify the local end points of Connections are established in TCP by means of the three-way handshake.
the connection. The source and destination end points together identify the To establish a connection, one side, say, the server, passively waits for an incoming
connection. This connection identifier is called a 5 tuple because it consists of five connection by executing the LISTEN and ACCEPT primitives in that order, either
specifying a specific source or nobody in particular.
pieces of information: the protocol (TCP), source IP and source port, and
destination IP and destination port.
The other side, say, the client, executes a CONNECT primitive, specifying the
The Sequence number and Acknowledgement number fields perform their IP address and port to which it wants to connect, the maximum TCP segment size it
usual functions. is willing to accept, and optionally some user data (e.g., a password). The
CONNECT primitive sends a TCP segment with the SYN bit on and ACK bit off and
The Sequence number and Acknowledgement number fields perform their waits for a response.
usual functions.
When this segment arrives at the destination, the TCP entity there checks to
The TCP header length tells how many 32-bit words are contained in the TCP see if there is a process that has done a LISTEN on the port given in the Destination
header. This information is needed because the Options field is of variable length, port field. If not, it sends a reply with the RST bit on to reject the connection.
so the header is, too.
TCP Connection Release
Now come eight 1-bit flags. CWR and ECE are used to signal congestion
when ECN (Explicit Congestion Notification) is used. CWR is set to signal Congestion Although TCP connections are full duplex, to understand how connections are
Window Reduced from the TCP sender to the TCP receiver so that it knows the released it is best to think of them as a pair of simplex connections. Each simplex
sender has slowed down and can stop sending the ECN-Echo. connection is released independently of its sibling.
URG is set to 1 if the Urgent pointer is in use. The Urgent pointer is used to To release a connection, either party can send a TCP segment with the FIN
indicate a byte offset from the current sequence number at which urgent data are bit set, which means that it has no more data to transmit. When the FIN is
to be found. acknowledged, that direction is shut down for new data.
Performance also degrades when there is a structural resource imbalance. Making measurements at the same time that some user has decided to run a
For example, if a gigabit communication line is attached to a low-end PC, the poor video conference over your network will often give different results than if there is
host will not be able to process the incoming packets fast enough and some will be no video conference.
lost. These packets will eventually be retransmitted, adding delay, wasting
5) Be Careful When Using a Coarse-Grained Clock
bandwidth, and generally reducing performance.
Computer clocks function by incrementing some counter at regular intervals.
Overloads can also be synchronously triggered. As an example, if a segment
contains a bad parameter , in many cases the receiver will thoughtfully send back 6) Be Careful about Extrapolating the Results
an error notification.
Suppose that you make measurements with simulated network loads running
Another tuning issue is setting timeouts. When a segment is sent, a timer is from 0 (idle) to 0.4 (40% of capacity).
set to guard against loss of the segment. If the timeout is set too short,
unnecessary retransmissions will occur, clogging the wires. If the timeout is set too
long, unnecessary delays will occur after a segment is lost.
When a network performs poorly, its users often complain to the folks
running it, demanding improvements. To improve the performance, the operators
must first determine exactly what is going on. To find out what is really happening,
the operators must make measurements.
Other measurements are made with counters that record how often some
event has happened (e.g., number of lost segments).
UNIT-V
Standard Application-Layer Protocols:
INTRODUCTION TO APPLICATION LAYER:
There are several application-layer protocols that have been standardized
INTRODUCTION: and documented by the Internet authority, and we are using them in our daily
interaction with the Internet.
The application layer provides services to the user. Communication is
provided using a logical connection, which means that the two application layers Each standard protocol is a pair of computer programs that interact with the
assume that there is an imaginary direct connection through which they can send user and the transport layer to provide a specific service to the user.
and receive messages.
Nonstandard Application-Layer Protocols:
Providing Services:
A programmer can create a nonstandard application-layer program if she can
All communication networks that started before the Internet were designed write two programs that provide service to the user by interacting with the
to provide services to network users. Most of these networks, however, were transport layer.
originally designed to provide one specific service. For example, the telephone
Application-Layer Paradigms
network was originally designed to provide voice service: to allow people all over
the world to talk to each other. This network, however, was later used for some It should be clear that to use the Internet we need two application programs
other services, such as facsimile (fax), enabled by users adding some extra to interact with each other: one running on a computer somewhere in the world,
hardware at both ends. the other running on another computer somewhere else in the world. The two
programs need to send messages to each other through the Internet infrastructure.
The Internet was originally designed for the same purpose: to provide service
to users around the world. The layered architecture of the TCP/IP protocol suite, However, we have not discussed what the relationship should be between
however, makes the Internet more flexible than other communication networks these programs.
such as postal or telephone networks.
Should both application programs be able to request services and provide
Each layer in the suite was originally made up of one or more protocols, but services, or should the application programs just do one or the other?
new protocols can be added or some protocols can be removed or replaced by the
Internet authorities. However, if a protocol is added to each layer, it should be Two paradigms have been developed during the lifetime of the Internet to
designed in such a way that it uses the services provided by one of the protocols at answer this question: the client-server paradigm and the peer-to-peer paradigm.
the lower layer.
Traditional Paradigm: Client-Server:
If a protocol is removed from a layer, care should be taken to change the
The traditional paradigm is called the client-server paradigm. It was the
protocol at the next higher layer that supposedly uses the services of the removed
most popular paradigm until a few years ago. In this paradigm, the service provider
protocol. The application layer, however, is somewhat different from other layers in
is an application program, called the server process; it runs continuously, waiting
that it is the highest layer in the suite.
for another application program, called the client process, to make a connection
The protocols in this layer do not provide services to any other protocol in through the Internet and ask for service.
the suite; they only receive services from the protocols in the transport layer. This
means that protocols can be removed from this layer easily. New protocols can be There are normally some server processes that can provide a specific type of
service, but there are many clients that request service from any of these server
also added to this layer as long as the new protocols can use the services provided
processes. The server process must be running all the time; the client process is
by one of the transport-layer protocols.
started when the client needs to receive service.
paradigm) has emerged to respond to the needs of some new applications. suite.
In this paradigm, there is no need for a server process to be running all the Several APIs have been designed for communication. One of the most
time and waiting for the client processes to connect. The responsibility is shared common one is: socket interface. The socket interface is a set of instructions that
between peers. provide communication between the application layer and the operating system, as
shown in Figure 5.1.
A computer connected to the Internet can provide service at one time and
receive service at another time. A computer can even provide and receive services
at the same time.
CLIENT-SERVER PROGRAMMING:
The server handles the request received from a client, prepares a result, and It is a set of instructions that can be used by a process to communicate with
sends the result back to the client. This definition of a server implies that a server another process. The idea of sockets allows us to use the set of all instructions
must be running when a request from a client arrives, but the client needs to be already designed in a programming language for other sources and sinks.
run only when it is needed.
For example, in most computer languages, like C, C++, or Java, we have
This means that if we have two computers connected to each other several instructions that can read and write data to other sources and sinks such as
somewhere, we can run a client process on one of them and the server on the a keyboard (a source), a monitor (a sink), or a file (source and sink). We can use
other. However, we need to be careful that the server program is started before we the same instructions to read from or write to sockets.
start running the client program.
Sockets:
Application Programming Interface:
Although a socket is supposed to behave like a terminal or a file, it is not a
A client process communicate with a server process with the help of a physical entity like them; it is an abstraction. It is an object that is created and
computer program which is normally written in a computer language with a used by the application program.
predefined set of instructions that tells the computer what to do.
Socket Addresses:
A computer language has a set of instructions for mathematical operations, a
The interaction between a client and a server is two-way communication. In
set of instructions for string manipulation, a set of instructions for input/output
a two-way communication, we need a pair of addresses: local (sender) and remote
access, and so on.
(receiver). The local address in one direction is the remote address in the other
If we need a process to be able to communicate with another process, we direction and vice versa.
need a new set of instructions to tell the lowest four layers of the TCP/IP suite to
Since communication in the client-server paradigm is between two sockets,
open the connection, send and receive data from the other end, and close the
we need a pair of socket addresses for communication: a local socket address
connection. A set of instructions of this kind is normally referred to as an
and a remote socket address. However, we need to define a socket address in
application programming interface (API).
terms of identifiers used in the TCP/IP protocol suite.
An interface in programming is a set of instructions between two entities. In
A socket address should first define the computer on which a client or a
this case, one of the entities is the process at the application layer and the other is
server is running. Socket address should be a combination of an IP address (32 bit)
the operating system that encapsulates the first four layers of the TCP/IP protocol
and a port number (16 bit). A pair of processes provide services to the users of the Internet, human or
Since a socket defines the end-point of the communication, we can say that a programs. A pair of processes, however, need to use the services provided by the
socket is identified by a pair of socket addresses, a local and a remote. transport layer for communication because there is no physical communication at
the application layer.
Finding Socket Addresses: How can a client or a server find a pair of
socket addresses for communication? The situation is different for each site. WORLD WIDE WEB AND HTTP:
Server Site: The server needs a local (server) and a remote (client) socket World Wide Web:
address for communication.
The idea of the Web was first proposed by Tim Berners-Lee in 1989. The Web
Local Socket Address The local (server) socket address is provided by the today is a repository of information in which the documents, called web pages, are
operating system. The operating system knows the IP address of the computer on distributed all over the world and related documents are linked together.
which the server process is running. The port number of a server process, however,
needs to be assigned. The popularity and growth of the Web can be related to two terms in the
above statement: distributed and linked. Distribution allows the growth of the Web.
If the server process is a standard one defined by the Internet authority, a Each web server in the world can add a new web page to the repository and
port number is already assigned to it. For example, the assigned port number for a announce it to all Internet users without overloading a few servers.
Hypertext Transfer Protocol (HTTP) is the integer 80, which cannot be used by any
other process. Linking allows one web page to refer to another web page stored in another
server somewhere else in the world. The linking of web pages was achieved using a
Remote Socket Address The remote socket address for a server is the concept called hypertext, which was introduced many years before the advent of
socket address of the client that makes the connection. Since the server can serve the Internet.
many clients, it does not know beforehand the remote socket address for
communication. The idea was to use a machine that automatically retrieved another
document stored in the system when a link to it appeared in the document. The
The server can find this socket address when a client tries to connect to the Web implemented this idea electronically to allow the linked document to be
server. The client socket address, which is contained in the request packet sent to retrieved when the link was clicked by the user.
the server, becomes the remote socket address that is used for responding to the
client. Today, the term hypertext, coined to mean linked text documents, has been
changed to hypermedia, to show that a web pagecan be a text document, an
Client Site: The client also needs a local (client) and a remote (server) image, an audio file, or a video file.
socket address for communication.
Architecture:
Local Socket Address The local (client) socket address is also provided by
the operating system. The operating system knows the IP address of the computer The WWW today is a distributed client-server service, in which a client using
on which the client is running. The port number, however, is a 16-bit temporary a browser can access a service using a server. However, the service provided is
integer that is assigned to a client process each time the process needs to start the distributed over many locations called sites. Each site holds one or more web
communication. pages.
The port number, however, needs to be assigned from a set of integers Each web page, however, can contain some links to other web pages in the
defined by the Internet authority and called the ephemeral (temporary) port same or other sites. In other words, a web page can be simple or composite. A
numbers. The operating system, however, needs to guarantee that the new port simple web page has no links to other web pages; a composite web page has one
number is not used by any other running client process. or more links to other web pages. Each web page is a file with a name and address.
Port. The port, a 16-bit integer, is normally predefined for the client-server
application.
Path. The path identifies the location and the name of the file in the
underlying operating system. The format of this identifier normally depends on the
operating system.
Figure 5.2: Browser
The controller receives input from the keyboard or the mouse and uses the To combine these four pieces together, the uniform resource locator
client programs to access the document. After the document has been accessed, (URL) has been designed; it uses three different separators between the four
the controller uses one of the interpreters to display the document on the screen. pieces as shown below:
The client protocol can be one of the protocols described later, such as HTTP
or FTP. The interpreter can be HTML, Java, or JavaScript, depending on the type of
document. Some commercial browsers include Internet Explorer, Netscape
Navigator, and Firefox. Web Documents:
Web Server: The web page is stored at the server. Each time a request The documents in the WWW can be grouped into three broad categories:
static, dynamic, and active.
arrives, the corresponding document is sent to the client. To improve efficiency,
servers normally store requested files in a cache in memory; memory is faster to Static Documents:
access than a disk.
Static documents are fixed-content documents that are created and stored
A server can also become more efficient through multithreading or in a server. The client can get a copy of the document only. In other words, the
multiprocessing. In this case, a server can answer more than one request at a time. contents of the file are determined when the file is created, not when it is used.
Some popular web servers include Apache and Microsoft Internet Information
Server. Static documents are prepared using one of several languages: HyperText
Markup Language (HTML), Extensible Markup Language (XML), Extensible Style
Language (XSL), and Extensible Hypertext Markup Language (XHTML).
Uniform Resource Locator (URL):
Dynamic Documents:
A web page, as a file, needs to have a unique identifier to distinguish it from
other web pages. To define a web page, we need three identifiers: host, port, and A dynamic document is created by a web server whenever a browser
path. requests the document. When a request arrives, the web server runs an application
program or a script that creates the dynamic document.
However, before defining the web page, we need to tell the browser what
clientserver application we want to use, which is called the protocol. This means we The server returns the result of the program or script as a response to the
need four identifiers to define the web page. browser that requested the document. Because a fresh document is created for
each request, the contents of a dynamic document may vary from one request to
The first is the type of vehicle to be used to fetch the web page; the last
another. A very simple example of a dynamic document is the retrieval of the time
three make up the combination that defines the destination object (web page).
and date from a server.
Protocol. The first identifier is the abbreviation for the client-server program
that we need in order to access the web page.
Active Documents:
Although most of the time the protocol is HTTP (HyperText Transfer For many applications, we need a program or a script to be run at the client
Protocol), we can also use other protocols such as FTP (File Transfer Protocol). site. These are called active documents. For example, suppose we want to run a
program that creates animated graphics on the screen or a program that interacts
Host. The host identifier can be the IP address of the server or the unique with the user.
name given to the server. IP addresses can be defined in dotted decimal notation.
HyperText Transfer Protocol (HTTP):
Message Formats:
The HyperText Transfer Protocol (HTTP) is used to define how the client-
server programs can be written to retrieve web pages from the Web. An HTTP client The HTTP protocol defines the format of the request and response messages.
sends a request; an HTTP server returns a response. The server uses the port Each message is made of four sections. The first section in the request message is
number 80; the client uses a temporary port number. HTTP uses the services of called the request line; the first section in the response message is called the status
TCP, which, as discussed before, is a connection-oriented and reliable protocol. line.
Nonpersistent versus Persistent Connections: The other three sections have the same names in the request and response
messages. However, the similarities between these sections are only in the names;
If the web pages, objects to be retrieved, are located on different servers, we they may have different contents. We discuss each message type separately.
do not have any other choice than to create a new TCP connection for retrieving
each object. However, if some of the objects are located on the same server, we Request Message:
have two choices: to retrieve each object using a new TCP connection or to make a
TCP connection and retrieve them all. The first method is referred to as a There are three fields in this line separated by one space and terminated by
two characters (carriage return and line feed). The fields are called method, URL,
nonpersistent connection, the second as a persistent connection.
and version.
Nonpersistent Connections
The method field defines the request types. Several methods are defined like
In a nonpersistent connection, one TCP connection is made for each GET, PUT, HEAD, POST, TRACE, DELETE, etc. The URL defines the address and
request/response. name of the corresponding web page. The version field gives the version of the
protocol; the most current version of HTTP is 1.1.
The following lists the steps in this strategy:
Response Message:
1. The client opens a TCP connection and sends a request.
A response message consists of a status line, header lines, a blank line, and
2. The server sends the response and closes the connection. sometimes a body. The first line in a response message is called the status line.
There are three fields in this line separated by spaces and terminated by a carriage
3. The client reads the data until it encounters an end-of-file marker; it then
return and line feed.
closes the connection.
Persistent Connections The first field defines the version of HTTP protocol, currently 1.1. The status
code field defines the status of the request. It consists of three digits. Whereas the
HTTP version 1.1 specifies a persistent connection by default. In a codes in the 100 range are only informational, the codes in the 200 range indicate a
persistent connection, the server leaves the connection open for more requests successful request.
after sending a response.
The codes in the 300 range redirect the client to another URL, and the codes
The server can close the connection at the request of a client or if a time-out in the 400 range indicate an error at the client site. Finally, the codes in the 500
has been reached. The sender usually sends the length of the data with each range indicate an error at the server site.
response. However, there are some occasions when the sender does not know the
The status phrase explains the status code in text form. After the status line,
length of the data.
we can have zero or more response header lines. Each header line sends additional
This is the case when a document is created dynamically or actively. In these information from the server to the client.
cases, the server informs the client that the length is not known and closes the
connection after sending the data so the client knows that the end of the data has Web Caching: Proxy Servers:
been reached. Time and resources are saved using persistent connections.
HTTP supports proxy servers. A proxy server is a computer that keeps
copies of responses to recent requests. The HTTP client sends a request to the
Only one set of buffers and variables needs to be set for the connection at
proxy server. The proxy server checks its cache.
each site. The round trip time for connection establishment and connection
termination is saved.
If the response is not stored in the cache, the proxy server sends the request
to the corresponding server. Incoming responses are sent to the proxy server and
stored for future requests from other clients. FTP uses two well-known TCP ports: port 21 is used for the control
connection, and port 20 is used for the data connection.
The proxy server reduces the load on the original server, decreases traffic,
and improves latency. However, to use the proxy server, the client must be Control Connection:
configured to access the proxy instead of the target server.
During this control connection, commands are sent from the client to the
HTTP Security: server and responses are sent from the server to the client. Commands, which are
sent from the FTP client control process, are in the form of ASCII uppercase, which
HTTP per se does not provide security. HTTP can be run over the Secure may or may not be followed by an argument. Some of the most common
Socket Layer (SSL). In this case, HTTP is referred to as HTTPS. HTTPS provides commands are shown in table below:
confidentiality, client and server authentication, and data integrity.
Command Argument(s) Description
FTP: ABOR Abort the previous command
CDUP Change to parent directory
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP CWD Directory name Change to another directory
for copying a file from one host to another. Although transferring files from one DELE File name Delete a file
system to another seems simple and straightforward, some problems must be dealt LIST Directory name List subdirectories or files
with first. MKD Directory name Create a new directory
PASS User password Password
PASV Server chooses a port
Although we can transfer files using HTTP, FTP is a better choice to transfer PORT Port identifier Client chooses a port
large files or to transfer files using different formats. Figure 5.3 shows the basic PWD Display name of current directory
model of FTP. The client has three components: the user interface, the client QUIT Log out of the system
control process, and the client data transfer process. The server has two Every FTP command generates at least one response. A response has two
components: the server control process and the server data transfer process. parts: a three-digit number followed by text. The numeric part defines the code;
the text part defines needed parameters or further explanations. The first digit
defines the status of the command. The second digit defines the area in which the
status applies. The third digit provides additional information.
ELECTRONIC MAIL:
The control connection is made between the control processes. The data Electronic mail (or e-mail) allows users to exchange messages. The nature of
connection is made between the data transfer processes. Separation of commands this application, however, is different from other applications discussed so far. In an
and data transfer makes FTP more efficient. The control connection uses very application such as HTTP or FTP, the server program is running all the time, waiting
simple rules of communication. We need to transfer only a line of command or a for a request from a client. When the request arrives, the server provides the
line of response at a time. The data connection, on the other hand, needs more service. There is a request and there is a response.
complex rules due to the variety of data types transferred.
In the case of electronic mail, the situation is different. First, e-mail is
Two Connections
considered a one-way transaction. When Alice sends an email to Bob, she may
expect a response, but this is not a mandate. Bob may or may not respond. If he
The two connections in FTP have different lifetimes. The control connection
does respond, it is another one-way transaction.
remains connected during the entire interactive FTP session. The data connection is
opened and then closed for each file transfer activity. Second, it is neither feasible nor logical for Bob to run a server program and
wait until someone sends an e-mail to him. Bob may turn off his computer when he in the queue to be sent.
is not using it.
This means that the idea of client/server programming should be The user agent at the Bob site allows Bob to read the received message. Bob
implemented in another way: using some intermediate computers (servers). The later uses an MAA client to retrieve the message from an MAA server running on
users run only client programs when they want and the intermediate servers apply the second server.
the client/server paradigm
User Agent: The first component of an electronic mail system is the user
Architecture: agent (UA). It provides service to the user to make the process of sending and
receiving a message easier.
To explain the architecture of e-mail, we give a common scenario as shown
in Figure 5.4. A user agent is a software package (program) that composes, reads, replies
to, and forwards messages. It also handles local mailboxes on the user computers.
The formal protocol that defines the MTA client and server in the Internet is
called Simple Mail Transfer Protocol (SMTP). SMTP is used two times, between
the sender and the sender’s mail server and between the two mail servers. SMTP
simply defines how commands and responses must be sent back and forth.
Message Access Agent: POP and IMAP: The first and second stages of
mail delivery use SMTP. However, SMTP is not involved in the third stage because
In the common scenario, the sender and the receiver of the e-mail, Alice and SMTP is a push protocol; it pushes the message from the client to the server.On the
Bob respectively, are connected via a LAN or a WAN to two mail servers. The other hand, the third stage needs a pull protocol; the client must pull messages
administrator has created one mailbox for each user where the received messages from the server. The direction of the bulk data is from the server to the client. The
are stored. third stage uses a message access agent.
A mailbox is part of a server hard drive, a special file with permission Currently two message access protocols are available: Post Office Protocol,
version 3 (POP3) and Internet Mail Access Protocol, version 4 (IMAP4).
restrictions. Only the owner of the mailbox has access to it. The administrator has
also created a queue (spool) to store messages waiting to be sent.
POP3:
A simple e-mail from Alice to Bob takes nine different steps. Alice and Bob
Post Office Protocol, version 3 (POP3) is simple but limited in
use three different agents: a user agent (UA), a message transfer agent functionality. The client POP3 software is installed on the recipient computer; the
(MTA), and a message access agent (MAA). When Alice needs to send a server POP3 software is installed on the mail server.
message to Bob, she runs a UA program to prepare the message and send it to her
mail server. Mail access starts with the client when the user needs to download its e-mail
from the mailbox on the mail server. The client opens a connection to the server on
The mail server at her site uses a queue (spool) to store messages waiting to TCP port 110. It then sends its user name and password to access the mailbox. The
be sent. The message, however, needs to be sent through the Internet from Alice’s user can then list and retrieve the mail messages, one by one.
site to Bob’s site using an MTA. Here two message transfer agents are needed: one
client and one server. POP3 has two modes: the delete mode and the keep mode. In the delete
mode, the mail is deleted from the mailbox after each retrieval. In the keep mode,
Like most client-server programs on the Internet, the server needs to run all the mail remains in the mailbox after retrieval.
the time because it does not know when a client will ask for a connection. The
client, on the other hand, can be triggered by the system when there is a message IMAP4:
TELNET:
Another mail access protocol is Internet Mail Access Protocol, version 4
(IMAP4). IMAP4 is similar to POP3, but it has more features; IMAP4 is more A server program can provide a specific service to its corresponding client
powerful and more complex. program. For example, the FTP server is designed to let the FTP client store or
retrieve files on the server site. However, it is impossible to have a client/server
POP3 is deficient in several ways. It does not allow the user to organize her pair for each type of service we need; the number of servers soon becomes
mail on the server; the user cannot have different folders on the server. In intractable which is not scalable.
addition, POP3 does not allow the user to partially check the contents of the mail
before downloading. Another solution is to have a specific client/server program for a set of
common scenarios, but to have some generic client/server programs that allow a
IMAP4 provides the following extra functions: user on the client site to log into the computer at the server site and use the
services available there.
A user can check the e-mail header prior to downloading.
For example, if a student needs to use the Java compiler program at her
A user can search the contents of the e-mail for a specific string of characters
prior to downloading. university lab, there is no need for a Java compiler client and a Java compiler
server. The student can use a client logging program to log into the university
server and use the compiler program at the university. We refer to these generic
A user can partially download e-mail. This is especially useful if bandwidth
is limited and the e-mail contains multimedia with high bandwidth client/server pairs as remote logging applications.
requirements.
One of the original remote logging protocols is TELNET, which is an
A user can create, delete, or rename mailboxes on the mail server.
abbreviation for TErminaL NETwork. Although TELNET requires a logging name and
password, it is vulnerable to hacking because it sends all data including the
password in plaintext (not encrypted).
A hacker can eavesdrop and obtain the logging name and password. Because
of this security issue, the use of TELNET has diminished in favor of another
protocol, Secure Shell (SSH).
1. The simple plaintext architecture of TELNET allows us to explain the issues and
challenges related to the concept of remote logging, which is also used in SSH
when it serves as a remote logging protocol.
When a user logs into a local system, it is called local logging. As a user
types at a terminal or at a workstation running a terminal emulator, the keystrokes
are accepted by the terminal driver.
The terminal driver passes the characters to the operating system. The
operating system, in turn, interprets the combination of characters and invokes the
desired application program or utility.
However, the characters cannot be passed directly to the operating system Since TCP is not a secured transport-layer protocol, SSH first uses a protocol
because the remote operating system is not designed to receive characters from a that creates a secured channel on top of the TCP. This new layer is an independent
TELNET server; it is designed to receive characters from a terminal driver. protocol referred to as SSH-TRANS.
The solution is to add a piece of software called a pseudoterminal driver, When the procedure implementing this protocol is called, the client and
which pretends that the characters are coming from a terminal. The operating server first use the TCP protocol to establish an insecure connection. Then they
system then passes the characters to the appropriate application program. exchange several security parameters to establish a secure channel on top of the
TCP. The services provided by this protocol are:
NVT uses two sets of characters, one for data and one for control. Both are
8-bit bytes. For data, NVT normally uses what is called NVT ASCII. This is an 8-bit 1. Privacy or confidentiality of the message exchanged.
character set in which the seven lowest order bits are the same as US ASCII and
2. Data integrity, which means that it is guaranteed that the messages exchanged
the highest order bit is 0.
between the client and server are not changed by an intruder.
To send control characters between computers (from client to server or vice
3. Server authentication, which means that the client is now sure that the server is
versa), NVT uses an 8-bit character set in which the highest order bit is set to 1.
the one that it claims to be.
Options: TELNET lets the client and server negotiate options before or
4. Compression of the messages, which improves the efficiency of the system and
during the use of the service.
makes attack more difficult.
User Interface:
SSH Authentication Protocol (SSH-AUTH):
The operating system (UNIX, for example) defines an interface with user-
After a secure channel is established between the client and the server and
friendly commands. An example of such a set of commands can be found in Table
the server is authenticated for the client, SSH can call another procedure that can
beow:
authenticate the client for the server. The client authentication process in SSH is
Command Name Meaning very similar to what is done in Secure Socket Layer (SSL).
open Connect to a remote computer
close Close the connections This layer defines a number of authentication tools similar to the ones used
display Show the operating parameters in SSL. Authentication starts with the client, which sends a request message to the
mode Change to line or character mode server. The request includes the user name, server name, the method of
Quit Exit TELNET authentication, and the required data. The server responds with either a success
send Send special characters message, which confirms that the client is authenticated, or a failed message,
which means that the process needs to be repeated with a new request message.
After the secured channel is established and both server and client are
authenticated for each other, SSH can call a piece of software that implements the
third protocol, SSHCONN.
A name space that maps each address to a unique name can be organized
Although SSH is often thought of as a replacement for TELNET, SSH is, in
in two ways: flat or hierarchical. In a flat name space, a name is assigned to an
fact, a general-purpose protocol that provides a secure connection between a client
address.
and server.
SSH for Remote Logging: A name in this space is a sequence of characters without structure. The
names may or may not have a common section; if they do, it has no meaning. The
Several free and commercial applications use SSH for remote logging. Among main disadvantage of a flat name space is that it cannot be used in a large system
them, we can mention PuTTy, by Simon Tatham, which is a client SSH program that such as the Internet because it must be centrally controlled to avoid ambiguity and
can be used for remote logging. Another application program is Tectia, which can duplication.
be used on several platforms.
In a hierarchical name space, each name is made of several parts. The first
SSH for File Transfer: part can define the nature of the organization, the second part can define the name
of an organization, the third part can define departments in the organization, and
One of the application programs that is built on top of SSH for file transfer is so on. In this case, the authority to assign and control the name spaces can be
the Secure File Transfer Program (sftp). The sftp application program uses one of decentralized.
the channels provided by the SSH to transfer files. Another common application is
called Secure Copy (scp). This application uses the same format as the UNIX copy A central authority can assign the part of the name that defines the nature of
command, cp, to copy files. the organization and the name of the organization. The responsibility for the rest of
the name can be given to the organization itself.
DOMAIN NAME SYSTEM (DNS):
The organization can add suffixes (or prefixes) to the name to define its host
Since the Internet is so huge today, a central directory system cannot hold or resources. The management of the organization need not worry that the prefix
all the mapping. In addition, if the central computer fails, the whole communication chosen for a host is taken by another organization because, even if part of an
network will collapse. address is the same, the whole address is different.
A better solution is to distribute the information among many computers in Domain Name Space:
the world. In this method, the host that needs mapping can contact the closest
computer holding the needed information. This method is used by the Domain To have a hierarchical name space, a domain name space was designed. In
Name System (DNS). this design the names are defined in an inverted-tree structure with the root at the
top. The tree can have only 128 levels: level 0 (root) to level 127 (see Figure 5.6).
Figure 5.5 shows how TCP/IP uses a DNS client and a DNS server to map a
name to an address. A user wants to use a file transfer client to access the
corresponding file transfer server running on a remote host. The user knows only
the file transfer server name, such as afilesource.com.
SNMP:
Several network management standards have been devised during the last
Figure 5.6: Domain name space few decades. The most important one is Simple Network Management Protocol
(SNMP), used by the Internet.
Label:
SNMP is a framework for managing devices in an internet using the TCP/IP
Each node in the tree has a label, which is a string with a maximum of 63 protocol suite. It provides a set of fundamental operations for monitoring and
characters. The root label is a null string (empty string). DNS requires that children maintaining an internet. SNMP uses the concept of manager and agent. That is, a
of a node (nodes that branch from the same node) have different labels, which manager, usually a host, controls and monitors a set of agents, usually routers or
guarantees the uniqueness of the domain names. servers (see Figure 5.9).
Domain Name:
Each node in the tree has a domain name. A full domain name is a
sequence of labels separated by dots (.). The domain names are always read from
the node up to the root.
The last label is the label of the root (null). This means that a full domain
name always ends in a null label, which means the last character is a dot because
the null string is nothing. Figure 5.7 shows some domain names. Figure 5.9: SNMP concept
Computer Networks
The manager can also make the router perform certain actions. For example,
a router periodically checks the value of a reboot counter to see when it should
reboot itself. It reboots itself, for example, if the value of the counter is 0. The
manager can use this feature to reboot the agent remotely at any time. It simply
sends a packet to force a 0 value in the counter.
Agents can also contribute to the management process. The server program
running on the agent can check the environment and, if it notices something
unusual, it can send a warning message (called a Trap) to the manager. In other
words, management with SNMP is based on three basic ideas:
Role of SNMP: SNMP has some very specific roles in network management.
It defines the format of the packet to be sent from a manager to an agent and vice
versa. It also interprets the result and creates statistics (often with the help of
other management software).
Role of SMI: To use SNMP, we need rules for naming objects. This is
particularly important because the objects in SNMP form a hierarchical structure.
Part of a name can be inherited from the parent. We also need rules to define the
types of objects.
Role of MIB: MIB creates a set of objects defined for each entity in a
manner similar to that of a database (mostly metadata in a database, names &
types without values).