CN Module1 23
CN Module1 23
Introduction to Networks
04/14/25
Classifying networks is scale
04/14/25
• PANs (Personal Area Networks) let devices communicate over
the range of a person. A common example is a wireless network
that connects a computer with its peripherals. Almost every
computer has an attached monitor, keyboard, mouse, and printer.
• Some companies got together to design a short-range wireless
network called Bluetooth to connect these components without
wires. The idea is that if your devices have Bluetooth, then you
need no cables.
04/14/25
• Bluetooth networks use the master-slave paradigm of
Fig. 1-7. The system unit (the PC) is normally the master,
talking to the mouse, keyboard, etc., as slaves.
• The master tells the slaves what addresses to use, when
they can broadcast, how long they can transmit, what
frequencies they can use.
• Bluetooth can be used in other settings, too. It is often
used to connect a headset to a mobile phone without
cords and it can allow your digital music player to
connect to your car merely being brought within range.
• A completely different kind of PAN is formed when an
embedded medical device such as a pacemaker, insulin
pump, or hearing aid talks to a user-operated remote
control.
04/14/25
Local Area Network
• A LAN is a privately owned network that operates within
and nearby a single building like a home, office or
factory.
• LANs are widely used to connect personal computers and
consumer electronics to let them share resources (e.g.,
printers) and exchange information.
• When LANs are used by companies, they are called
enterprise networks. Wireless LANs are very popular
these days, especially in homes, older office buildings,
cafeterias, and other places where it is too much trouble
to install cables.
• In these systems, every computer has a radio modem an
antenna that it uses to communicate with other computers.
04/14/25
AP (Access Point), wireless router, or base station, relays packets
between the wireless computers and also between them and the
Internet.
There is a standard for wireless LANs called IEEE 802.11,
popularly known as WiFi, which has become very widespread. It
04/14/25
runs at speeds anywhere from 11 to hundreds of Mbps.
• The topology of many wired LANs is built from point-to-
point links. IEEE 802.3, popularly called Ethernet, is, by
far, the most common type of wired LAN.
• Fig. 1-8(b) shows a sample topology of switched
Ethernet. Each computer speaks the Ethernet protocol and
connects to a box called a switch with a point-to-point
link. Hence the name.
• A switch has multiple ports, each of which can connect to
one computer. The job of the switch is to relay packets
between computers that are attached to it, using the
address in each packet to determine which computer to
send it to.
• Both wireless and wired broadcast networks can be
divided into static and dynamic designs, depending on
04/14/25
how the channel is allocated.
• A typical static allocation would be to divide time into discrete
intervals and use a round-robin algorithm, allowing each
machine to broadcast only when its time slot comes up.
• Static allocation wastes channel capacity when a machine has
nothing to say during its allocated slot, so most systems
attempt to allocate the channel dynamically (i.e., on demand).
• Dynamic allocation methods for a common channel are either
centralized or decentralized.
• In the centralized channel allocation method, there is a single
entity, for example, the base station in cellular networks,
which determines who goes next. It might do this by accepting
multiple packets and prioritizing them according to some
internal algorithm.
• In the decentralized channel allocation method, there is no
central entity; each machine must decide for itself whether to
transmit.
04/14/25
• If home network is considered as another LAN, it is more
likely to have different properties than other networks.
1. The networked devices have to be very easy to install.
2. The network and devices have to be foolproof in
operation.
3. Low price is essential for success.
4. It must be possible to start out with one or two devices
and expand the reach of the network gradually. This
means no format wars.
5. Security and Reliability will be very important.
04/14/25
Metropolitan Area Network
•A MAN covers a city. The best-known examples of MANs
are the cable television networks available in many cities.
04/14/25
• A WAN (Wide Area Network) spans a large geographical area, often a
country or continent.
04/14/25
•The WAN in Fig. is a network that connects offices in
Perth, Melbourne, and Brisbane. Each of these offices
contains computers intended for running user (i.e.,
application) programs and called as hosts.
•The rest of the network that connects these hosts is then
called the communication subnet, or just subnet for short.
The job of the subnet is to carry messages from host to
host, just as the telephone system carries words from
speaker to listener.
•In most WANs, the subnet consists of two distinct
components: transmission lines and switching elements.
Transmission lines move bits between machines. They can
be made of copper wire, optical fiber, or even radio links.
04/14/25
• Switching elements, or just switches, are specialized
computers that connect two 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 are called router is now
most commonly used.
• The routers will usually connect different kinds of
networking technology.
• WANs will in fact be internetworks, or composite networks
that are made up of more than one network.
04/14/25
• Virtual Private Network, a VPN has the usual advantage
of virtualization, which is that it provides flexible reuse of a
resource (Internet connectivity).
• A VPN also has the usual disadvantage of virtualization,
which is a lack of control over the underlying resources.
04/14/25
The second variation is that the subnet may be run by a different company.
The subnet operator is known as a network service provider and the offices
are its customers.
The subnet operator will connect to other customers too, as long as they can
pay and it can provide service.
The subnet operator will also connect to other networks that are part of the
Internet. Such a subnet operator is called an ISP (Internet Service Provider)
04/14/25
and the subnet is an ISP network.
• In most WANs, the network contains many transmission lines, each
connecting a pair of routers. If two routers that do not share a
transmission line wish to communicate, they must do this indirectly,
via other routers.
• There may be many paths in the network that connect these two
routers. How the network makes the decision as to which path to use
is called the routing algorithm.
• Other kinds of WANs make heavy use of wireless technologies. In
satellite systems, each computer on the ground has an antenna through
which it can send data to and receive data from to a satellite in orbit.
• All computers can hear the output from the satellite, and in some
cases they can also hear the upward transmissions of their fellow
computers to the satellite as well.
• The cellular telephone network is another example of a WAN that
uses wireless technology. This system has already gone through three
generations and a fourth one is on the horizon.
04/14/25
• The first generation was analog and for voice only.
• The second generation was digital and for voice
only.
• The third generation is digital and is for both voice
and data.
• Each cellular base station covers a distance much
larger than a wireless LAN, with a range measured
in kilometers rather than tens of meters.
• The base stations are connected to each other by a
backbone network that is usually wired.
• The data rates of cellular networks are often on the
order of 1 Mbps, much smaller than a wireless LAN
that can range up to on the order of 100 Mbps.
04/14/25
A collection of interconnected networks is called an internetwork or
internet. These terms will be used in a generic sense, in contrast to the
worldwide Internet (which is one specific internet), which we will
always capitalize.
The Internet uses ISP networks to connect enterprise networks, home
networks, and many other networks.
First, if different organizations have paid to construct different parts of
the network and each maintains its part, we have an internetwork rather
than a single network.
Second, if the underlying technology is different in different parts (e.g.,
broadcast versus point-to-point and wired versus wireless), we probably
have an internetwork.
The general name for a machine that makes a connection between two or
more networks and provides the necessary translation, both in terms of
hardware and software, is a gateway
04/14/25
• Why an application developer would ever choose to build an
application over UDP rather than over TCP. Isn’t TCP always
preferable, since TCP provides a reliable data transfer service, while
UDP does not?
• Many applications are better suited for UDP for the following
reasons:
– UDP immediately pass segment, where as TCP not
– No connection establishment
– No connection state. (like- buffers, congestion-control parameters, and sequence
and acknowledgment number parameters)
– Small packet header overhead: The TCP segment has 20 bytes of header
overhead in every segment, whereas UDP has only 8 bytes of overhead.
04/14/25
3.3.1 UDP Segment Structure
04/14/25
• The UDP header has only four fields, each consisting of two bytes
04/14/25
3.3.2 UDP Checksum
•The UDP checksum provides for error detection. That is, the checksum
is used to determine whether bits within the UDP segment have been
altered (for example, by noise in the links or while stored in a router) as
it moved from source to destination.
•UDP at the sender side performs the 1s complement of the sum of all
the 16-bit words in the segment, with any overflow encountered during
the sum being wrapped.
Example, suppose that we have the following three 16-bit words:
–0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0
–0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1
–1 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0
04/14/25
• The sum of first two of these 16-bit words is
0110011001100000
0101010101010101
-----------------------------------
1011101110110101
• At the receiver, all four 16-bit words are added, including the
checksum.
• If no errors are introduced into the packet, then clearly the sum
at the receiver will be 1111111111111111.
• If one of the bits is a 0, then we know that errors have been
introduced into the packet.
04/14/25
Chapter 3 outline
04/14/25
3.4 Principles of Reliable Data Transfer
04/14/25
04/14/25
04/14/25
04/14/25
Reliable data transfer: getting started
send receive
side side
• The sending side of the data transfer protocol will be invoked from
above by a call to rdt_send().
• It will pass the data to be delivered to the upper layer at the receiving
side.
04/14/25
3.4.1 Building a Reliable Data Transfer Protocol
04/14/25
• The event causing the transition is shown above the horizontal line
labeling the transition, and the actions taken when the event occurs
are shown below the horizontal line.
• When no action is taken on an event, or no event occurs and an
action is taken, we’ll use Λ the symbol below or above the
horizontal.
• The sending side of rdt simply accepts data from the upper layer via
the rdt_send(data) event, creates a packet containing the data (via the
action make_pkt(data)) and sends the packet into the channel.
• On the receiving side of rdt, receives a packet from the underlying
channel via the rdt_rcv(packet) event, removes the data from the
packet (via the action extract (packet, data)) and passes the data up to
the upper layer (via the action deliver_data(data)).
04/14/25
• Reliable Data Transfer over a Channel with Bit Errors: rdt2.0
04/14/25
04/14/25
04/14/25
04/14/25
04/14/25
Chapter 3 outline
04/14/25
TCP: Overview RFCs: 793,1122,1323, 2018,
2581
04/14/25
04/14/25
• Sequence Numbers and Acknowledgment Numbers
04/14/25
• Host A rcvd all bytes 0 to 535 (0-999) from B
• A is waiting for 536 byte to rcv
• Host A puts ack 536
04/14/25
3.5.3 Round-Trip Time Estimation and
Timeout
What is the length of the timeout interval?
Soln:
The timeout should be larger than the connection’s round-trip time
(RTT), that is, the time from when a segment is sent until it is
acknowledged. Otherwise, unnecessary retransmissions would be
sent.
0.125
04/14/25
Fig: RTT samples and RTT estimates
04/14/25
3.5.4 Reliable Data Transfer
04/14/25
04/14/25
TCP sender events:
data rcvd from app: timeout:
create segment with seq # retransmit segment that
seq # is byte-stream caused timeout
number of first data byte in restart timer
segment ack rcvd:
start timer if not already if ack acknowledges
running previously unacked
think of timer as for segments
oldest unacked segment update what is known to
expiration interval: be ACKed
TimeOutInterval start timer if there are
still unacked segments
04/14/25
TCP: retransmission
scenarios
Host A Host B Host A Host B
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeo
ACK=100
X
ut
ut
ACK=100
ACK=120
SendBase=120
X
ut
ACK=120
cumulative ACK
04/14/25
Fig: Retransmission due to a lost acknowledgment
04/14/25
Premature timeout
04/14/25
A cumulative acknowledgment avoids retransmission of the
first segment
04/14/25
Doubling the Timeout Interval
Each time TCP retransmits, it sets the next timeout interval to twice the
previous value, rather than deriving it from the last EstimatedRTT
Fast Retransmit
Retransmitting the missing segment before that segment’s timer expires.
04/14/25
04/14/25
3.5.5 Flow Control
• A speed-matching service.
04/14/25
LastByteRead
LastByteRcvd
04/14/25
• Because TCP is not permitted to overflow the allocated buffer, we
must have
LastByteRcvd – LastByteRead <= RcvBuffer
04/14/25
3.5.6 TCP Connection Management
04/14/25
04/14/25
04/14/25
Life cycle of a TCP connection
• During the life of a TCP connection, the TCP protocol running in
each host makes transitions through various TCP states.
• Figure 3.41 illustrates a typical sequence of TCP states that are
visited by the client TCP.
• The client TCP begins in the CLOSED state.
04/14/25
04/14/25
04/14/25
Principles of TCP Congestion Control
04/14/25
04/14/25
Scenario 2: Two Senders and a Router with Finite Buffers
04/14/25
04/14/25
Network-Assisted Congestion-Control Example:
04/14/25
04/14/25
04/14/25