Professional Documents
Culture Documents
T ENGINEERING COLLEGE
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS6551- COMPUTER NETWORKS
UNIT I
Define computer network.
Computer network is a connection of autonomous computers and network devices for:
Resource sharing (data/devices) in an efficient
manner Communication amongst them.
Compare simplex and duplex communication with example.
In simplex mode, the communication is unidirectional (Eg: keyboard, monitor).
In half-duplex mode, each station can both transmit and receive, but not
simultaneously (Eg. walkie-talkie).
In full-duplex (also called duplex), both stations can transmit and receive
simultaneously (Eg. telephone network).
Mesh
Star
Bus
Ring
Mesh: Each device has a dedicated point-to-point link to every other device. It is
robust and secure. Installation is difficult and expensive n(n-1) link for n node.
Star: Each device has a dedicated point-to-point link only to a central controller
called a hub. All communication goes via the hub. It is less expensive and robust.
A failure in the hub makes the network non-functional. Eg; LAN
Bus: It is multi-point and signal gets weak as it travels through the long cable that
Metropolitian Area Network (MAN) is a network with a size between a LAN and a
WAN. It normally covers the area inside a town or a city. It is designed for
customers who need a high-speed connectivity to the Internet, and have
endpoints spread over a city or part of city.
When two or more independent networks are connected, it becomes an
internetwork or internet.
Storage area network (SAN) is confined to a single room and connect the various
components of a large computing system. For example, fiber channel is used to
connect high-performance computing systems to storage servers.
List the advantages of layering.
It decomposes the problem of building a network into more manageable components.
It provides a more modular design. To add a new service, then it is only needed to
modify the functionality at one layer, reusing the functions at all the other layers.
Uses abstraction to hide complexity of network from application.
Define protocol.
The abstract objects that make up the layers of a network system are called
protocols. Each protocol defines two different interfaces.
o Service interface that specifies the set of operations
o Peer-to-peer interface for messages to be exchanged amongst peers
Protocol is a set of rules that govern communications between devices.
What is encapsulation.
As data passes through a layer, it attaches its header and then passes it to the next
layer. For the next layer, the data and header of the previous layer is encapsulated as
a unit. It then attaches its header and passes to the next layer and so on.
Discuss in detail about the layers of OSI model with a neat diagram.
The ISO defined a common way to connect computers, called the Open Systems
Interconnection (OSI) architecture. (eg. public X.25 network).
It defines partitioning of network functionality into seven layers.
The bottom three layers, i.e., physical, data link and network are implemented on
all nodes on the network including switches.
Physical Layer
It coordinates the functions required to carry a bit stream over a physical medium.
Representation of bitsTo be transmitted, bits must be encoded into signals,
electrical or optical. The physical layer defines the type of encoding.
Data rateIt defines the transmission rate (number of bits sent per second).
Physical topologyIt defines how devices are connected (mesh, star, ring, bus
or hybrid) to make a network.
Transmission modeThe physical layer also defines the direction of
transmission between two devices: simplex, half-duplex, or full-duplex
FramingThe bit stream is divided into manageable data units called frames.
Physical addressingA header is added to contain physical address of sender
and receiver of the frame.
Flow controlIf receiving rate is less than the transmission rate, data link layer
imposes a flow control mechanism to avoid overwhelming the receiver.
Error controlRedundant information is added as trailer to detect and retransmit
damaged/lost frames and to recognize duplicate frames.
Access controlWhen two or more devices are connected to the same link, link
layer protocols determines which device has control over the link at any given time.
Network Layer
It is responsible for source-to-destination delivery of a data unit called packet.
Logical addressingThe packet is identified across the network using the logical
addressing system provided by network layer and is used to identify the end systems.
Presentation Layer
It is concerned with syntax and semantics of the information exchanged between peers.
TranslationBecause different computers use different encoding systems, the
presentation layer is responsible for interoperability between these encoding methods.
Application Layer
The application layer enables the user, whether human or software, to access the network. It
provides user interface and support for services such as electronic mail, remote file
Features
Internet architecture is a four layered model, also known as TCP/IP architecture.
It evolved out of a packet-switched network called ARPANET.
TCP/IP does not enforce strict layering, i.e., applications are free to bypass
transport layer and can directly use IP or any of the underlying networks.
IP layer serves as focal point in the architecture.
o It defines a common method for exchanging packets to any type of network
o Segregates host-to-host delivery from process-to-process delivery.
For any protocol to be added to the architecture, it must also be accompanied by at
least one working implementation of the specification. Thus efficiency is ensured.
Layers
Subnetwork TCP/IP does not define any specific protocol for the lowest level.
o All standard and proprietary protocols such as Ethernet, FDDI, etc are supported.
o The protocols are generally implemented by a combination of
hardware/software. IP The major protocol in TCP/IP is Internetworking Protocol (IP).
Explain how framing is done using bit and byte oriented protocols.
Framing enables the message to reach the destination by adding physical
address of sender and destination.
When a message is divided into smaller frames, error affects only that small
frame. In fixed-size framing, there is no need for defining frame boundary.
In variable-size framing, receiver should be able to determine where a frame starts/ends.
BYTE-ORIENTED PROTOCOLS
. The two different approaches are sentinel and the byte-counting.
Sentinel approach
Binary Synchronous Communication (BISYNC) protocol developed by IBM.
Character stuffing
The problem with sentinel approach, is that the ETX character might appear in
the data. In such case, ETX is preceded with a DLE (data-link-escape) character.
If the data portion contains escape character, then it is preceded by another DLE.
The insertion of DLE character onto the data is known as character stuffing.
The receiver removes the additional escape characters and correctly interprets the frame. If
ETX field is corrupted, then it is known as framing error. Such frames are discarded.
Byte-Counting Approach
An alternative to detect end-of-frame is to include number of bytes in the frame
body as part of the frame header.
Digital Data Communication Message Protocol (DDCMP) uses the count approach.
The Count field specifies how many bytes are contained in the frames body.
If Count field is corrupted, then it is known as framing error. The receiver comes
to know of it when it comes across the SYN field of the next frame.
BIT-ORIENTED PROTOCOL
The bit-oriented protocols such as High-Level Data Link Control (HDLC) view the
frame as a collection of bits. The frame format
The beginning and end of a frame has a distinguished bit sequence 01111110
Sequence is also transmitted when link is idle for synchronization
Bit Stuffing
To prevent occurrence of bit pattern 01111110 as part of frame body, bit stuffing is
used. In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is
added.
This extra stuffed bit is eventually removed from the data by the receiver.
The real flag 01111110 is not stuffed by the sender and is recognized by the receiver If a
bit such as 01111111 arrives, then an error has occurred and the frame is discarded.
Clock-based Framing
Synchronous Optical Network (SONET) standard is clock-based framing of fixed
size. SONET runs on the carrier's optical network and offers rich set of services.
A SONET STS-1 frame is arranged as nine rows of 90 bytes each, shown below
The first 3 bytes of each row are overhead, with the rest being available
for data The first 2 bytes of the frame contain a special bit pattern
indicating start of frame. Bit stuffing is not employed here
The receiver looks for the special bit pattern once in every 810 bytes. If not so,
the frame is discarded.
The overhead bytes of a SONET frame are encoded using NRZ encoding. To
allow the receiver to recover senders clock, the payload bytes are scrambled.
SONET supports the multiplexing of multiple low-speed links. The links range
from 51.84 Mbps (STS-1) to 2488.32 Mbps (STS-48).
At STS-1 rates, a frame is 810 bytes long, while at STS-3 rates, each frame is
2430 bytes long. The multiplexing of three STS-1 frame onto one STS-3 is shown
STS-N signal can being used to multiplex N STS-1 frames. The payload from
STS-1 frames are linked together to form a STS-N payload, denoted as STS-Nc.
Burst error means that 2 or more bits in the data unit have changed
The length of the burst is measured from the first corrupted bit to the last corrupted bit.
The basic idea behind any error detection scheme is to add redundant information to
a frame that can be used to determine if errors have been introduced.
An efficient system should have k redundant bits for n data bits such that k << n
Two-Dimensional Parity
Data is divided into seven byte segments.
Even parity is computed for all bytes (Vertical Redundancy Check).
Even parity is also calculated for each bit position across each of the bytes
(Longitudinal Redundancy Check).
Thus a parity byte for the entire frame, in addition to a parity bit for each byte is sent.
The receiver recomputes the row and column parities. If parity bits are correct,
the frame is accepted else discarded.
Two-dimensional parity catches all 1, 2 and 3-bit errors, and most 4-bit errors.
Internet Checksum
The 16-bit checksum is not used at the link layer but by the upper layer protocols (UDP).
Sender
The data is divided into 16-bit words.
The initial checksum value is 0.
7
11
12
6
0111
1011
1100
0110
0111
1011
1100
0110
Initial Checksum
Sum
Carry
Sum
0000
100100
10
0110
Received Checksum
Sum
Carry
Sum
1001
101101
10
1111
Checksum
1001
New Checksum
0000
Sender
Receiver
Analysis
Checksum is well-suited for software implementation and is not strong as CRC.
If value of one word is incremented and another word is decremented by the same
amount, the errors are not detected because sum and checksum remain the same.
Cyclic Redundancy Check (CRC)
CRC developed by IBM uses the concept of finite fields.
A n bit message is represented as a polynomial of degree n - 1.
The message M(x) is represented as a polynomial by using the value of each bit in the
message as coefficient for each term. For eg., 10011010 represents x7 + x4 + x3+ x
For calculating a CRC, sender and receiver agree on a divisor polynomial, C(x) of degree
k such that k n 1
Sender
Multiply M(x) by xk i.e., append k zeroes. Let the modified poly be M'(x)
Divide M'(x) by C(x) using XOR operation. The remainder has k bits
Subtract the remainder from M'(x) using XOR, say T(x) and transmit T(x) with n + k bits.
Sender
Receiver
Receiver
Divide the received polynomial T(x) by C(x) as done in
sender If the remainder is non-zero then discard the frame
If zero, then no errors and redundant bits are removed to obtain data
Divisor Polynomial
The divisor polynomial C(x) should has the following error-detecting properties:
k
o All single-bit errors, as long as the x and x terms have nonzero coefficients.
o Any burst error for which the length of the burst is less than k bits.
o Any odd number of errors, as long as C(x) contains the factor (x + 1)
The versions of C(x) widely used in link-level protocols are CRC-8, CRC-10,
CRC-12, CRC-16, CRC-CCITT and CRC-32.
CRC algorithm is implemented in hardware using a k-bit shift register and
XOR gates. CRC is widely used in networks such as LANs and WANs.
The two ARQ are Stop and Wait ARQ and Sliding Window ARQ
Explain various flow control mechanism or reliable transmission.
Stop and Wait ARQ
The sender keeps a copy of the frame and then transmits it.
The sender waits for an acknowledgment before transmitting the next frame.
If acknowledgment does not arrive before timeout, the sender retransmits the frame.
Scenarios
a) ACK is received before the timer expires. The sender sends the next frame.
b) The frame gets lost in transmission. Sender eventually times out and retransmits frame.
c) ACK frame gets lost. The sender eventually times out and retransmits the frame.
d) The sender times out soon before ACK arrives and retransmits the frame.
Sequence number
In scenarios (c) and (d), since the receiver has acknowledged the received
frame, it treats the arriving frame as the next one. This leads to duplicate frames.
To address duplicate frames, the header for a stop-and-wait protocol includes a
1-bit sequence number (0 or 1) based on modulo-2 arithmetic.
Drawbacks
It allows the sender to have only one outstanding frame on the link at a time
Inefficient if the channel has a large bandwidth and the round-trip delay is long.
Sliding window
To improve efficiency, multiple frames must be in transition while waiting for an
acknowledgment. Sliding window protocol makes this possible.
The window defines range of sequence numbers for both sender and receiver to deal with.
The window position change (slides) due to transmission of frame and acknowledgement
Sender
The sender assigns a sequence number SeqNum to each frame.
A timer with each frame it transmits, and retransmits the frame on
timeout. It maintains three state variables:
o The send window size SWS gives the upper bound on the number of
outstanding frames that the sender can transmit.
o LAR denotes the sequence number of the last acknowledgment
received. o LFS denotes the sequence number of the last frame
sent.
o The invariant LFS LAR SWS is always maintained
Example
Lost/Corrupt frames
When frames are lost or corrupt, there is less data in transit, since the sender
cannot advance its window without an acknowledgement.
The receiver acknowledges a frame, only if all lower numbered frames have
arrived. The acknowledgement is cumulative.
The receiver buffers out of order frames but does not acknowledge.
It sends a negative acknowledgement (NAK) indicating to the sender to
retransmit the expected frame.
NAK speeds up retransmission of a frame before timer expires and improves performance.
Sequence Number
m
Sequence numbers are modulo 2 where m is the size of the sequence field in bits.
Sequence numbers wrap around and MaxSeqNum denotes number of available
sequence numbers.
To avoid the issue of identifying sequence numbers of different sets, SWS is defined as
SWS < (MaxSeqNum + 1) / 2
Advantages
It delivers frames reliably across an unreliable link using timeout and acknowledgement.
It preserves the order in which frames are transmitted. The receiver ensures that it does
not pass a frame to the upper layer until all lower numbered frames are passed.
It supports flow control. The receiver through acknowledgement informs the
sender about how many frames it can still receive.
Distinguish between Stop & Wait and Sliding window protocol.
Only one frame could be outstanding in Stop-and-Wait, whereas multiple frames
can be outstanding in sliding window, i.e., improved efficiency.
The Stop-and-Wait ARQ protocol is a special case of sliding window in which the
send window size is 1.
m
Frames are numbered as modulo-2 in sliding window whereas it is sequenced
as modulo-2 in stop and wait protocol.
What is concurrent logical channel?
When more than one logical channel is multiplexed onto a single point-to-point
link is known as concurrent logical channel.
Stop and wait is run on each of these logical channels.
The sender maintains 3-bit state information namely whether busy, sequence
number of next frame and sequence number of next frame expected.
When a node has frame to send, it is sent on the lowest idle channel.
Bandwidth is also based on how many times the software that implements the
channel has to handle.
Latency refers to how long it takes for the message to travel to the other end
(delay). It is a factor of propagation delay, transmission time and queuing delay
Latency = Propagation + Transmit
+ Queue Propagation =
Distance / SpeedOfLight Transmit
= Size / Bandwidth
8
o Speed
of light propagation varies on medium (2.3 10 m/s in copper, 2.0
8
10 m/s in optical fiber) and distance.
o Transmission time depends upon bandwidth and packet size
o Queuing delay occurs at switches and routers.
Round Trip Time (RTT) is a two-way latency.
For applications that have minimal data transfer, latency dominates performance
and for bulk data transfers, bandwidth dominates performance.
Delay Bandwidth Product
If receiver signals the sender to stop, it would still receive RTT bandwidth of data.
For example, for a cross-country fiber with 10 Gbps bandwidth, distance of 4000
km, the RTT is 40 ms and RTT bandwidth is 400 Mb.
High Speed Networks
High speed networks enhances the bandwidth for applications but latency remains fixed.
For example, when a 1 MB file is transmitted over a 1 Mbps link takes 80 RTTs, whereas
The Point-to-Point Protocol (PPP) is used to carry packets over point-topoint links. The flag field contains special character 01111110
The protocol field is used for multiplexing.
The payload is 1500 bytes by default.
bind operation attaches the socket to server host's IP address and port. Server
port number is well-known, i.e., 01024 (for example, web servers use port 80).
o listen operation specifies number of pending connections.
o accept operation blocks until a client establishes
connection
Client Process
Client processes perform active open, i.e., it establishes connection with the
server using connect operation.
int connect(int socket, struct sockaddr *address, int addr_len)
Client knows the remote server's logical address and port number and lets the
system fill in detail such as client IP address and ephemeral port number.
Communication
Communication between server and client process takes place after connection
establishment using send and recv operation.
int send(int socket, char *message, int msg
len, int ags) int recv(int socket, char *buffer,
int buf len, int ags)
o
send operation is used to send message over the socket and recv operation
is used to store the message received over the socket onto a buffer.
Chat Application
Chat application is a simple client/server program that uses the socket interface
to send messages over a TCP connection in half-duplex mode.
/* TCP Chat server program */
#include <stdio.h>
#include
<string.h>
#include
<netinet/in.h>
main()
{
int sd, bd, ad;
program */ #include
<stdio.h>
#include
<string.h>
#include
<netinet/in.h>
}
printf("Connection Terminated\n");
}
Client builds data structure required for the socket interface and opens an active
connection with the server.
Switch decides which packet is to be transmitted from the packets queued up,
according to queuing discipline such as FIFO.
Network provide logical channels and set of services required for process-toprocess communication.
Functionalities may include guaranteed delivery, in-order delivery, privacy, etc.
File access program such as FTP / NFS or sophisticated digital library application
require read and write operation performed either by client / server.
Two types of communication channels that could be provided are request/reply
and message stream channel
Request/reply channel guarantees delivery of message and ensures privacy and
integrity of data required in case of FTP or digital library.
Message stream channel does not guarantee delivery of all data but assures inorder delivery, required in applications like video conferencing.
Reliability
Reliability is an important characteristic to be provided by the network, i.e., it
should be possible for the network to recover from errors.
Single bit/ burst errors may occur during data transmission due to interference.
Such errors can be detected and retransmission sought for.
Packets can be dropped due to congestion or wrongly routed.
Links can fail or node can crash. In case of failed link, it should be possible to
route the packet along alternate path.
Manageability
Network needs troubleshooting to adapt to increase in traffic or to improve performance.
Managing network devices on the internet to work correctly is a challenging one.
Automating network management tasks is needed for scalability and cost-effectiveness.
Network nowadays is common and could be managed by consumers with little skill level.
UNIT II
What is CSMA?
In Carrier Sense Multiple Access (CSMA), each station first checks state of the
medium using one of the persistence methods before sending.
The possibility of collision still exists because of propagation delay. When a
station sends a frame, it takes time for the first bit to reach every station.
Define persistent methods 1-persistent, non-persistent and P-persistent.
1-Persistent
When a station finds the line idle, sends its frame immediately (with probability 1).
This method has the highest chance of collision because two or more stations
may find the line idle and send frames immediately.
Non-persistent
When a station senses the line to be idle, it sends immediately.
If the line is not idle, it waits a random amount of time and then senses the line again.
Reduces collision since it is unlikely that stations will wait same amount of time and retry
Less efficient because the medium remains idle when there may be frames to send.
p-Persistent
This method is used if channel has time slots equal to
propagation time. Reduces collision and improves efficiency.
With probability p, station transmits frame, else waits for next time slot and
checks again. If the line is busy, back off procedure is adopted.
What is CSMA/CD mechanism?
Carrier Sense Multiple Access with Collision Detection (CSMA/CD) method
handles collisions detected over a wired medium.
Station monitors the medium after it sends a frame
If a collision is detected during transmission, the station transmits a brief jamming
signal to alert all stations about collision and aborts transmission.
It waits for a random amount of time and attempts retransmission.
Explain IEEE 802.3 standard or Ethernet in detail.
Ethernet is standardized as IEEE 802.3
Standard Ethernet is the most successful LAN technology with a data rate of 10 Mbps. It
has evolved to Fast Ethernet (100 Mbps), Gigabit Ethernet (1 Gbps) and Ten-Gigabit
Hosts are tapped on to the Ethernet segment, each at least 2.5 m apart.
Access Protocol
Medium Access Control (MAC) regulates access to the shared Ethernet link.
Frame Format
Adaptor accepts the frame with destination address if it matches its address,
broadcast address (all 1s), multicast address, if it's part of that multicast group.
Frames are discarded, if it is not meant for that host.
Accepts all frames, if configured to run in promiscuous
mode. Ethernet does not acknowledge received frames.
List the advantages and disadvantages of Ethernet.
Easy to administer, maintain and relataively
inexpensive. Produces better output only under lightly
loaded conditions. It is an unreliable medium.
Why the minimum frame length in Ethernet should be at least 64 bytes?
Consider the following worst case scenario in which hosts A and B are at either ends.
In DSSS for each data bit, the sender transmits the XOR of that bit and n random
bits (chipping code) from pseudorandom number generator.
Only the intended receiver can interpret the signal. For other nodes, it appears as a noise.
802.11b runs in 2.4 GHz frequency band with a data rate of 11 Mbps.
802.11a/g runs in 5-GHz band using orthogonal FDM with a max rate of 54
Mbps. 802.11n is latest standard that uses multiple antennas and offers up to
100 Mbps.
802.11 defines maximum bit rate for a/b/g/n. Optimal bit rate for transmission is
chosen based on signal-to-noise ratio in the environment.
Collision Avoidance
Collision detection is not feasible, since all nodes are not within the reach of each other.
Hidden Node
Exposed Node
Hidden Node
Suppose node B is sending data to A. At the same time, node C also wishes to
send to A. Since node B is not within the range of C, C finds the medium free and
transmits to A. Frames from nodes B and C sent to A collide with each other.
Thus nodes B and C are hidden from each other.
Exposed Node
Suppose node A is transmitting to node B and node C has some data to be sent to node D.
Node C finds the medium busy, since it hears the transmission from node A and refrains
transmission duration.
Nodes that receive RTS frame are close to sender and wait for CTS to be transmitted
back. Receiver acknowledges and sends a CTS frame containing sender address and
duration. Nodes that receive CTS remain silent for the upcoming data transmission.
Nodes that receive RTS but not CTS, is away from the receiver and is free to transmit.
Receiver sends an ACK frame to the sender after successfully receiving a data frame.
If RTS frames from two or more nodes collide, then they do not receive CTS. Each node
waits for a random amount of time and then tries to send RTS again (back-off
procedure).
Distribution System
In wireless network, nodes are mobile and the set of reachable nodes change with time.
Mobile nodes are connected to a wired network infrastructure called access points (AP)
Access points are connected to each other by a distribution system (DS) such as ethernet.
Nodes communicate directly with each other if they are reachable (eg, A and C)
Communication between two nodes in different APs occurs via two APs (eg, A and
E)
The technique for selecting an AP is called active scanning. It is done whenever
a node joins a network or switches over to another AP.
o The node sends a Probe frame.
o All APs within reach reply with a Probe Response frame.
o The node selects one of the APs and sends an Association
Request frame. o The AP replies with an Association Response
frame
APs also periodically send a Beacon frame that advertises its features such as
transmission rate. This is known as passive scanning.
Frame Format
Control contains subfields that includes 6-bit frame type i.e., management,
control (RTS, CTS, ACK) or data, and pair of 1-bit fields ToDS and FromDS.
Duration specifies duration of frame transmission.
Addresses
The four address fields depend on value of ToDS and FromDS
subfields.
ToDS FromDS
Addr1
0
0
Destination
0
Destination
Receiving
AP
Receiving
AP
Addr2
Source
Sending
AP
Source
Sending
AP
Addr3
Addr4
Description
Sent directly
Frame is coming from
Source
a distribution system
Frame is going to a
Destination
distribution system
Frame is going from
Destination Source one AP to another
AP
Uses low power transmission, operates in 2.45 GHz band with data rate up to 3 Mbps.
Bluetooth Special Interest Group has specified a set of profiles for a range of application.
Bluetooth network is known as piconet. A piconet can have up to eight stations, one of
which is called the master and the rest are called slaves.
Slaves do not directly communicate with each other, but via the master.
Bluetooth uses FHSSS and synchronous TDM for transmission. Master transmits in
odd-numbered slots, whereas slave transmits to master in even-numbered slots.
Slaves in parked or inactive state cannot communicate, until it is activated by the
master. Maximum of 255 devices can be in parked state.
Piconet
Compare the different wireless technologies.
Bluetooth
IEEE standard 802.15.1
Link length
10 m
Bandwidth
2.1 Mbps (shared)
Usage
Link a peripheral
to a computer
WiFi
802.11
100 m
54 Mbps (shared)
Link a computer
to a wired base
WiMax
802.16
10 km
70 Mbps
Link a building
to a wired tower
3G
Tens of km
384 Kbps
Link a cell phone
to a wired tower
Setup Request
Acknowledgement
Setup Request
Switch 1 receives connection setup request frame from host A.
o It knows that frames for host B should be forwarded on port 3.
o The switch creates an entry in its VC table for the new connection with
incoming port=1 and outgoing port=3.
o Chooses an unused VCI for frames to host B, say 14 as incoming VCI.
< The outgoing VCI is unknown (left blank) and the frame is forwarded to switch 2.
Similarly entries are made at other switches as frame is forwarded to destination.
Source host A uses 14 as its outgoing VCI for data frames to be sent to destination B.
Source Routing
All information about network topology that is required to route a packet across
the network to the destination is provided by the source host.
Header contains ordered list of intermediate hosts, through which packet must traverse.
For each packet, the header carries a pointer to the current next port entry, with each
A bridge is a multi-input, multi-output node between two LANs that runs in promiscuous
mode, accepts frames transmitted from either sides and forwards them to the other.
Bridge implements collision detection mechanism on all its interfaces.
LANs connected by one or more bridges is called extended LAN.
Bridged network
Forwarding Table
When station A sends a frame to station D:
o The bridge has no entry for either station D or A
From source address, the bridge learns that station A is located on the LAN
connected to port 1, i.e., frames destined for A must be sent out through port 1.
0 The bridge appends entry to the table and floods the frame on all
other ports. When station E sends a frame to station A:
o The bridge has an entry for station A, so it forwards the frame only to port 1.
o It adds source address of the frame, i.e., E, to the
table. When station B sends a frame to station C:
0 The bridge has no entry for station C.
o It floods the network and adds one more entry to the table.
The system stabilizes in a while, with the selection of root bridge and designated
bridges. o Thereafter, root bridge alone generates configuration messages.
o The designated bridge forwards those messages.
Root Bridge
Initially each bridge considers itself to be the root and broadcasts configuration
message with distance 0.
When a bridge receives a BDPU, it compares with its own. Discards its own and
saves the received BDPU, if the received BDPU has:
o a root with a smaller id.
o a root with an equal id but with a shorter distance.
o the root id and distance are equal, but the sending bridge has a smaller id.
Once a bridge receives a configuration message indicating that it is not the root, it
Loop-less topology at B3
Bridges forward all broadcast frames, which is not liked in a large environment.
Bridges support networks that have the same address format. For example,
ethernet and token ring but not ethernet and ATM.
Write short notes on VLAN.
Virtual LAN (VLAN) increases the scalability of extended LAN.
VLAN partitions a single extended LAN into several separate LANs.
VLAN is defined as a local area network configured by software, not by physical wiring.
VLANs group stations belonging to one or more physical LANs into broadcast domains.
Stations in a VLAN communicate with one another as though they belonged to the same
Each VLAN is assigned an identifier and packets can only travel from one
segment to another if both segments have the same identifier.
Example
Hosts W and X are configured as VLAN 100, hosts Y and Z as VLAN 200.
When a packet sent by host X arrives at bridge B2, the bridge inserts a VLAN
header between Ethernet header and its payload with VLAN ID as 100.
Bridge forwards the packet, only on interfaces that is part of VLAN 100.
Packet is forwarded to bridge B1, which forward the packet to host W but not to Y.
List the advantages using VLAN.
Cost and Time Reduction VLANs reduce the migration cost of stations going
from one group to another. Physical reconfiguration takes time and is costly.
Creating Virtual Work Groups VLANs can be used to create virtual work groups.
This can reduce traffic if the multicasting capability of IP was previously used.
Security In VLANs people belonging to the same group can send broadcast messages with
the guaranteed assurance that users in other groups will not receive these messages.
o Record Route used to record the routers that handle the datagram.
o Strict Source Route used by the source to predetermine a route for the datagram.
Discuss Internetworking Protocol in detail.
Internet Protocol (IP) is used to build scalable, heterogeneous internetworks.
Ability of IP to run over any networking technology is its strength.
HLen defines length of the datagram header in 4-byte words. When there are no
options, the value is 5 (5 4 = 20).
TOS allows packets to be placed on separate queues based on parameters
delay, throughput, reliability and cost.
Length specifies total packet length (header + data), which is restricted to
65,535 bytes. Ident a 16-bit identifier that uniquely identifies a datagram
packet.
Flags It is a 3-bit field. The first bit is reserved. The second bit D is called the do
not fragment bit. The third bit M is called the more fragment bit.
Offset shows relative position of this fragment with respect to the whole datagram. It
is offset of the data in the original datagram measured in units of 8 bytes.
TTL defines lifetime of the datagram (default value 64) in hops. Each router
decrements TTL by 1 before forwarding. If TTL is zero, the datagram is
discarded.
Protocol specifies the higher-level protocol (e.g., 6 for TCP, 17 for UDP, 1 for
ICMP). Checksum contains 16-bit internet checksum for the packet header.
SourceAddr/ DestinationAddr 32-bit address of the source and destination host.
Fragmentation and Reassembly
Each physical network has Maximum Transmission Unit, i.e., largest IP datagram
that can be contained in a frame. For example, MTU for Ethernet is 1500, etc.
If the datagram payload is greater than MTU, then it is fragmented by the router to fit the
link-layer frame. The fragmented packets are each of size MTU, except the last one.
If D flag bit is set, then datagram is not fragmented and if exceeding MTU, it is discarded.
When the router fragments a datagram (of MTU size, except last one), fields affected are:
o Sets the M bit in the flags field for all fragments, except the last one.
o The Offset field contains 8-byte count (first fragment is set to 0).
o Sets Length equal to number of bytes in each fragment.
Reassembling is done by the destination host using Ident field.
IP does not attempt to recover from missing fragments and discards all fragments arrived.
Example
Fragmentation at R2
Suppose host H5 sends a datagram to host H8 with a payload of 1400 bytes.
Datagram goes through Ethernet and FDDI network without any fragmentation.
When the packet arrives at router R2, which has an MTU of 532 bytes, it is
fragmented with a maximum payload of 512 (plus 20 bytes for IP header).
o The Ident field value x, which is copied onto all fragments. o
The first fragment has Offset field set to 0 and M bit set to
1.
o The second fragment has Offset field set to 64 (64 8 = 512) and M bit set to 1. o
The third fragment has Offset set to 128 (128 8 = 1024), whereas M bit set to 0.
Three fragments are forwarded by router R3 through Ethernet to the destination host.
Global Addressing
IP addresses are hierarchical, i.e., it corresponds to hierarchy in the
internetwork. IP addresses consist of two parts, network id and host id.
Network id identifies physical network to which the host is attached. Hosts
attached to a network have the same network id in their IP address.
Host id is used to uniquely identify a host on that network.
Router that connects networks has a unique address on each of its interface.
32
IPv4 address in human readable form is expressed as four octets (in the range
0255) in dotted decimal notation (eg. 172.16.15.161).
IPv4 Classful Addressing
In classful addressing, the address space is divided into five classes: A, B, C, D and E. IP
address class is identified by MSBs in binary or first byte in decimal representation.
Class
A
B
C
D
E
Binary
0
10
110
1110
1111
Decimal
0127
128191
192223
224239
240255
Application
WAN
Campus Network
LAN
Class A
Class B
Class C
Datagram Forwarding
Destination address is used by routers to forward packets in a connectionless
manner. Forwarding table at a router is a list of (NetworkNum, NextHop)
pairs.
Algorithm
if (NetworkNum of destination = NetworkNum of any of its
interface) then Deliver packet to destination over that interface
else
if (NetworkNum of destination is in forwarding table) then
R3 forwards the datagram directly to H8, since both are on the same network.
R2 Forwarding Table
Detail the process of determining the physical address of a destination host (ARP).
A host or router to send an IP datagram, needs to know both the logical and
physical address of the destination.
Address Resolution Protocol (ARP) enables a source host to know the physical
address of another node when the logical address is known.
ARP relies on broadcast support from physical networks such as ethernet, token ring, etc.
ARP enables each host on a network to build up a mapping table between IP address and
physical address.
Packet Format
0
16
HardwareType
HLen
PLen
31
Protocol Type
Operation
SourceHardwareAddr
SourceProtocolAddr
TargetHardwareAddr
TargetProtocolAddr
HardwareType defines type of the physical network (e.g., 1 for
ethernet). ProtocolType specifies the value of upper-layer protocol
(e.g., 8 for IPv4).
HLen specifies length of the physical address in bytes (e.g., 6 for Ethernet
address). PLen specifies length of the logical address in bytes (e.g., 4 for IPv4
address).
Operation defines the type of ARP (1 for request, 2 for
reply). SourceHardwareAddr contains physical address of
the sender. SourceProtocolAddr contains logical address
of the sender.
TargetHardwareAddr contains physical address of the
target. TargetProtocolAddr contains logical address of the
target.
Address Translation
The host checks its ARP table with destination IP address. If an entry exists, then
corresponding physical address is used to send a datagram.
Otherwise, source host finds physical address of the destination using ARP.
Each host takes note of sender's logical and physical address. All nodes except
the destination host discard the packet.
Destination host constructs an ARP reply packet with Operation field
set to 2. ARP reply is unicast and sent back to the sender.
Sender stores target logical-physical address pair in its ARP table from reply packet.
If target node does not exist on the same network, then ARP request is sent to the
default router, which then forwards it to the next hop router and so on till destination.
Define RARP.
A diskless workstation booted from its ROM or newly booted workstation does
not know its IP address as it is assigned by the network administrator.
Reverse Address Resolution protocol (RARP) allows a host to find its IP address
using RARP request (broadcasted) and RARP reply.
RARP is replaced by protocols such as BOOTP and DHCP.
Discuss the automatic configuration of IP address to hosts using DHCP.
Operating systems allow system administrator to manually configure IP address,
which is tedious and error-prone.
Dynamic Host Configuration Protocol (DHCP) enables auto configuration of IP
address to hosts using DHCP server.
DHCP is derived from Bootstrap Protocol (BOOTP) and is connectionless.
DHCP server sends and receives message using UDP over ports 67 and 68 respectively.
DHCP provides both static (manual) and dynamic (automatic) address allocation.
options contains information such as lease duration, default route, DNS server,
etc.
DHCP server response is sent to relay agent, which is sent back to the client.
Time Exceeded Router discards a datagram when TTL field becomes 0 and a
time-exceeded message is sent to the source host.
Parameter Problem If a router discovers ambiguous or missing value in any field of the
datagram, it discards the datagram and sends parameter problem message to source.
Redirection Redirect messages are sent by the default router to inform the source
host to update its forwarding table when the packet is routed on a wrong path.
Query Messages
Echo Request & Reply The combination of echo-request and echo-reply
messages determines whether two systems can communicate at the IP level.
Timestamp Request & Reply Two machines can use the timestamp request and
timestamp reply messages to determine the round-trip time (RTT).
Address Mask Request & Reply A host to obtain its subnet mask, sends an address mask
request message to the router, which responds with an address mask reply message.
IPv4 address space is exhausted by assigning an IP address for each physical network.
At most 253 addresses can go unused in a class C network whereas over 64,000 addresses
can go unused in a class B network, i.e., inefficient usage of available address space.
Thus all nodes have the same subnet number, i.e., hosts on different physical
network share a single network number.
Subnetted IP address contains 3 parts namely network, subnet and host.
All host on the same network as H1 have the same subnet number.
Routing
Entries in routing table are of the form (SubnetNumber, SubnetMask, NextHop)
When a host wants to send a packet to another host, it performs a bitwise AND
between its own subnet mask and the destination IP address.
If result equals its own subnet number, then packet is delivered directly over the subnet.
Otherwise a lookup is done by doing a AND (destination address, SubnetMask) for
each
Restrictions
Addresses in a block must be contiguous.
Number of addresses in a block must be a power of 2.
First address must be evenly divisible by the number of addresses.
CIDR uses a new type of notation to represent network numbers or prefixes as
/x. Prefix can be of any length. For example, 192.4.16/24
Protocol such as BGP is required to support classless addressing.
Example
If a switch or link fails, the connection is teardown and a new one is setup.
UNIT III
Distinguish between forwarding and routing table.
A forwarding table contains mapping between network number and outgoing
interface as well as physical address of the next hop.
A routing table contains mapping between network number and logical address
of next hop. It is built by routing algorithm.
Define autonomous system or domain.
A domain or autonomous system is an internetwork in which all routers are under
a single administrative control (eg. University campus, Service provider network).
Routing within a domain is known as intra-domain routing whereas routing
between domains is known as inter-domain routing.
Distance vector routing (RIP) and Link state routing (OSPF) are intra-domain
routing protocols, whereas Path vector (BGP) is inter domain routing.
Explain distance vector routing (or) Routing Information Protocol with an example.
Distance vector routing is distributed, i.e., algorithm is run on all nodes.
Each node knows the distance (cost) to each of its directly connected neighbors.
Infinite cost is assigned if link is down.
Each node constructs a vector (Destination, Cost, NextHop) to reach all other
nodes and distributes the vector to its neighbors.
Nodes compute routing table of minimum distance to every other node via
NextHop using information obtained from its neighbors.
Initial State
E
1
E
F
1
F
G
Node A's initial table
Destinatio
n
Cost NextHop Destination Cost NextHop
A
1
A
A
1
A
B
1
B
B
C
0
C
C
D
1
D
D
E
E
F
F
0
F
G
G
1
G
Node C's initial table
Node F's initial table
Triggered Update
Link failure is assumed, if a node does not receive periodic updates from its neighbor.
When a node's routing table changes, it updates its neighbors, neighbors update
their neighbors and so on. This is known as triggered update.
Assume that node F detects that its link to G has failed.
o Node F sets distance to G as and shares its table
with A. o Node A updates its distance to G as .
o Meanwhile, node A receives periodic update from C with distance to
G as 2 hops. o Node A updates its distance to G as 3 hops via C.
o Eventually node F is updated to reach G via A in 4 hops.
Loop Instability
Suppose link from node A to E goes down.
Node A advertises a distance of to E, meanwhile B and C advertise a distance of 2 to E.
o Node B updated by C, concludes that E can be reached in 3 hops via C.
o
o
Sequence number and Time to live fields are used in flooding whereas the other
two fields are used for route calculation.
Reliable Flooding
Each node sends its LSP out on each of its directly connected links.
Transmission of LSPs between adjacent routers is made reliable using acknowledgment.
When a node receives LSP of another node, checks if it has one for that node.
o If not, it stores and forwards the LSP on all other links except the incoming one.
Thus recent LSP of a node eventually reaches all nodes, i.e., reliable flooding.
LSP is generated either periodically or when there is a change in the topology.
o Time to live When TTL reaches 0, the node re-floods that LSP, which signals
nodes to delete their stored LSP for that ID.
Route Calculation
Each node knows the entire topology, once it has LSP from every other node.
Routing table is determined from the LSPs using a variation of Dijkstra algorithm
called forward search algorithm
Each node maintains two lists namely Tentative and Confirmed with entries of
the form (Destination, Cost, NextHop).
Forward Search algorithm
Initialize the Confirmed list with an entry for the Node and Cost = 0.
The node just added to Confirmed list, is called Next and select its LSP.
For each neighbor of Next, calculate cost to reach each neighbor as Cost(Node to
Next) +
Cost(Next to Neighbor).
o If Neighbor is currently on neither Confirmed nor Tentative list, then
add (Neighbor, Cost, NextHop) to Tentative list.
p If Neighbor is currently on Tentative list, and the Cost is less than currently
listed cost for Neighbor, then replace the entry with (Neighbor, Cost,
NextHop).
If Tentative list is empty then Stop, otherwise select least cost entry from
Tentative list and move it to Confirmed list. Go to Step 2.
For the given network, the process of building routing table for node D is tabulated
Step
1
2
3
4
5
6
Confirme
d
Tentative Comment
D is moved to Confirmed list initially
(D, 0, )
(D, 0, )
(B, 11, B) Based on D's LSP, its immediate neighbors B and C are
(C, 2, C) added to Tentative list
The lowest-cost member C of Tentative list is moved
(D, 0, )
(B, 11, B) onto
Confirmed list. C's LSP is to be examined next.
(C, 2, C)
(D, 0, )
(B, 5, C) Cost to reach B through C is 5, so the entry (B,11,B) is
(C, 2, C)
(A, 12, C) replaced. C's neighbor A is also added to Tentative list
The lowest-cost member B is moved to the Confirmed
(D, 0, )
(A, 12, C) list.
(C, 2, C)
B's LSP is to be examined next
(B, 5, C)
(D, 0, )
(A, 10, C) Since A could be reached B at a lower cost than the existing
one, the Tentative list entry (A,12,C) is replaced to
(C, 2, C)
(A,10,C).
(B, 5, C)
The lowest-cost and only member A is moved to
(D, 0, )
Confirmed
(C, 2, C)
list. Processing is over.
(B, 5, C)
(A, 10, C)
advertising to reach every host with cost 0. Such disasters are averted by
mandating routing updates to be authenticated.
Additional hierarchy Domain is partitioned into areas, i.e., a router need not
know the complete network, instead only its area.
o Load balancing Allows multiple routes to the same place to be assigned the
same cost for traffic to be distributed evenly.
OSPF Header
o
o
Stub AS is connected to only one another autonomous system and can carry local
Each AS have a border router (gateway), by which packets enter and leave that
AS. In above figure, R3 and R4 are border routers.
One of the nodes in each autonomous system is designated as BGP speaker.
BGP Speaker exchange reachability information with other BGP speakers,
known as external BGP session.
BGP advertises complete path as enumerated list of AS (path vector) to reach a
particular network. Paths must be without any loop, i.e., AS list is unique.
o For example, backbone network advertises that networks 128.96, 192.4.153,
192.4.32, and 192.4.3 can be reached along the path <AS1, AS2, AS4>.
o AS3 receiving advertisement from AS1, advertises that to AS2 as <AS3, AS1,
AS2, AS4>. Since AS2 is part of the path, i.e., loop, it is not used by AS2.
If there are multiple routes to a destination, BGP speaker chooses one based on
policy. Speakers need not advertise any route to a destination, even if one exists.
Advertised paths can be cancelled, if a link/node on the path goes down. This
negative advertisement is known as withdrawn route.
Attributes in a path can be well known or optional.
Designed for classless addressing with prefix of any
length. TCP is used by BGP to ensure reliability.
Routes are not repeatedly sent. If there is no change, keep alive messages are sent.
Prefix
00...
0
(128 bits)
00...
1
(128 bits)
1111 1111
1111 1110 10
1111 1110 11
Everything else
Usage
Unspecified
Loopback
Multicast addresses
Link local use addresses
Site local use addresses
Global unicast
0 Site local allows valid local address for use in a isolated site with several
subnets. Reserved addresses start with prefix of eight 0s. It is classified into
o unspecified address is used when a host does not know its address
o loopback address is used for testing purposes before connected to network
o compatible address is used when IPv6 hosts communicate through IPv4 network o
mapped address is used when a IPv6 host communicates with a IPv4 host.
Address Notation
Standard representation of IPv6 is x:x:x:x:x:x:x:x where x is a 16-bit
hexadecimal address separated by colon (:)
47CD:1234:4422:ACO2:0022:1234:A456:0124
IPv6 address with contiguous 0 bytes can be written compactly. For example,
47CD:0000:0000:0000:0000:0000:A456:0124 47CD::A456:0124
IPv4 address can be mapped to IPv6 address by prefixing the 32-bit IPv4 address
with 2 bytes of 1s and then zero-extending the result to 128 bits. For example,
128. 96.33.81 ::FFFF:128.96.33.81
Address Aggregation
Goal of IPv6 address allocation plan is to provide aggregation of routing
information to reduce the burden on routers.
Aggregation is done by assigning prefixes at continental level.
For example, if all addresses in Europe have a common prefix, then routers in
other continents would need one routing table entry for all networks in Europe.
Format for provider-based unicast address aggregation is:
Advanced Capabilities
Longer address format helps in providing auto or stateless configuration of IP
address to hosts without the need for a server.
Anycast addressing in IPv6 is used to specify topological entity such as backbone
provider. Packet with anycast address is delivered to only one member of anycast group.
Reverse-Path Multicasting
Multicasting is achieved by pruning networks that do not have members for a
group G. This is done in two stages.
Step 1: Identify a leaf network which has only one router (parent).
Leaf network is monitored to determine if it has any members for group G,
by having hosts periodically announce to which group it belongs to.
0 Router uses information from hosts to decide whether or not to forward
packets addressed to group G over that LAN.
Step 2: Propagate the information "no members of G here" up the shortest path tree.
o
Routers augment the (Destination, Cost) pairs it sends to its neighbors with the
set of groups for which the leaf network is interested in receiving multicast
packets.
PIM sparse mode (PIM-SM) is widely used multicast routing protocol. PIM does
not rely on any type of unicast routing protocol, hence protocol independent.
Routers explicitly join and leave multicast group using PIM Join and Prune
messages.
A router is designated as rendezvous point (RP) for each group in a domain to
receive PIM messages.
Routers in the domain know the IP address of RP for each group.
A multicast forwarding tree is built as a result of routers sending Join messages to RP.
Initially the tree is shared by multiple senders and depending on traffic it may be
source-specific to a sender.
Shared Tree
When a router sends Join message for group G to RP, it goes through a set of
routers. o Join message is wildcarded (*), i.e., it is applicable to all senders.
Router create an entry (*, G) in its forwarding table for the shared tree.
o Interface on which the Join arrived is marked to forward packets for that group.
o Forwards Join towards RP on an interface where packets for that group arrive.
Eventually, the message arrives at RP. Thus a shared tree with RP as root is formed.
Example
Join from R4
Join from R5
Source-specific tree.
RP can force routers to know about group G, by sending Join message to the
sending host, so that tunneling can be avoided.
Intermediary routers create sender-specific entry (S, G) in their tables. Thus a
source-specific route from R1 to RP is formed.
If there is high rate of packets sent from a sender to a group G, then shared-tree is
replaced by source-specific tree with sender as root.
Example
Analysis
PIM is protocol independent because, tree maintenance is based on Join
messages that come via the shortest path.
Shared trees are more scalable than source-specific trees.
Source-specific trees enable efficient routing than shared trees.
PIM-SM protocol is used within a domain, not across domains.
Define IP multicasting.
IP multicast supports both source-specific multicast (one-to-many) and any source
multicast (many-to-many), where each group has its own IP multicast address.
Hosts that are members of a group receive copies of any packet sent to that
groups multicast address.
IP multicast allows any host to send multicast traffic, it neednt even be a
member. IP multicast is more scalable because it eliminates redundant traffic.
What is multicast addressing?
Range of IP address is reserved for multicasting (Class D in IPv4).
Multicast addresses are associated with an abstract group, whose members are dynamic. If
not for multicast addressing, a host would have to send a separate packet with the
Special area known as backbone area is denoted as area 0. Routers R1, R2 and
R3 are part of backbone area.
Routers in backbone area are also part of non-backbone areas. Such routers
are known as area border routers (ABR).
Link-state advertisement is exchanged between routers in a non-backbone area, but do
not see LSAs of other areas. For example, routers in area 1, is not aware of LSA in area
3 ABR router advertises routing information in their area to other areas. For example, R2
advertises area 2 routing which is spread to other areas through ABRs.
Thus, all routers learn how to reach all networks in the domain.
4 4 switch
Ports contain buffers to hold packets before it is forwarded.
Fabric that switches packet by using information in the packet header is
known as self-routing.
Input port receives stream of packets, analyzes the header, determines the
output port and passes the packet onto the fabric.
Simple input buffering such as FIFO can lead to head-of-line blocking.
If packets at several input ports are to be put on to a single output port,
then only one of them is forwarded.
o Thus packets at the front prevent packets queued up from being forwarded. o
To avoid this problem, majority of switches use pure output buffering.
Head-of-line blocking
Buffer space also determines the QoS characteristics of a switch.
A switch fabric moves packets from input ports to output ports with minimal
delay and meets the throughput goals of the switch.
Fabric type may be either shared bus / shared memory / cross bar / self routing.
Control processor is responsible for running the algorithm to build forwarding tables.
Write short notes on routing metrics in ARPANET.
Assigning uniform cost to all links (say 1 hops) have the following drawbacks:
o Latency on a link is not considered. For example, links with different
latency say 250 ms and 1 ms are not distinguished.
Bandwidth of the link is not considered. For example, links with different
capacity such as 10 Kbps and 45 Mbps are treated in a similar manner.
0 Current load is not considered, i.e., routing around overloaded links is
impossible Original ARPANET routing metric measured queue length on each link.
o
Higher cost was assigned for links with large queue than one with short queue.
o Thus packets were moved towards short queues, not towards destination.
0 Bandwidth and latency was not considered.
ARPANETs new routing mechanism was as follows:
UNIT IV
Transport layer
Responsible for process-to-process delivery
Host IP, port number is required for delivery
Flow control is not done
Support for multicasting is embedded
UDP Header
UDP packets known as user datagrams, have a fixed-size header of 8 bytes.
UDP is suitable for a process with internal flow and error control
mechanisms such as Trivial File Transfer Protocol (TFTP).
With a neat architecture, explain TCP in detail.
Transmission Control Protocol (TCP) offers connection-oriented, bytestream service. Guarantees reliable, in-order delivery of message.
TCP is a full-duplex protocol.
Like
UDP,
TCP
provides
process-to-process
communication. Has built-in congestion-control mechanism.
Some well-known TCP ports are 21FTP, 23 TELNET, 25SMTP, 80HTTP, etc.
Sending TCP buffers bytes in send buffer and transmits data unit as segments.
Segments are stored in receive buffer at the other end for application to read.
TCPs demux key is given by the 4-tuple < SrcPort, SrcIPAddr, DstPort,
DstIPAddr >
Segment Format
Data unit exchanged between TCP peers are called segments.
SrcPort and DstPort port number of source and destination process.
SequenceNum contains sequence number, i.e. first byte of data segment.
It is twice as big as window size and does not wrap around.
Acknowledgment specifies byte number of segment, the receiver
expects next. HdrLen specifies length of TCP header as 4-byte words.
o
o
Connection Termination
Connection termination or teardown is symmetric. It can be done in two ways
Three-way closeBoth client and server close simultaneously.
o Client sends a FIN segment. The FIN segment can include last
chunk of data. o Server responds with FIN + ACK segment to inform
its closing.
o Finally, client sends an ACK segment.
Half-CloseOne end can stop sending while still receiving data, known as
half-close. o Client half-closes the connection by sending a FIN segment.
o Server accepts the half-close by sending the ACK segment. Data
transfer from client to the server stops.
o After sending all data, server sends a FIN segment to the client, which is
acknowledged by the client.
State Transition Diagram
States involved in opening and closing a connection is shown above and
below ESTABLISHED state respectively.
Operation of sliding window is hidden in the
ESTABLISHED state Events that trigger a state
transition is:
Opening
1. Server invokes a passive open on TCP, which causes TCP to move to LISTEN state
2. Later, the client does an active open, which causes its end of the connection
to send a SYN segment to the server and to move to the SYN_SENT state.
3. When SYN segment arrives at the server, it moves to SYN_RCVD state and
When TCP receives a segment with URG bit set, it delivers urgent data out
of order to the receiving application.
What is push operation in TCP?
Receiving TCP buffers the data and delivers when process is ready.
When a process issues Push operation, the sending TCP sets the PUSH
flag, which forces the TCP to create a segment and send it immediately.
When TCP receives a segment with PUSH flag set, it is delivered immediately.
Distinguish between connection-less and connection-oriented protocol in transport layer.
UDP (Connection-less)
Datagram model (connection-less)
Unreliable delivery
No flow control
No congestion control
Light overhead
Data is collected in order of receipt
TCP (Connection-oriented)
Byte-stream service (connection-oriented)
Reliable delivery using acknowledgement
Supports flow control
Built-in congestion control mechanism
Heavy overhead
Segments are ordered using sequence number
Receiver advertises its window size to the sender using AdvertisedWindow field.
Sender thus cannot have unacknowledged data greater than AdvertisedWindow.
Send Buffer
Receive Buffer
Send Buffer
Sending TCP maintains a send buffer, divided into 3 segments namely
acknowledged data, unacknowledged data and data to be transmitted.
Send buffer maintains three pointers LastByteAcked, LastByteSent,
and
LastByteWritten such that:
LastByteAcked LastByteSent LastByteWritten
A byte can be sent only after being written and only a sent byte can be acknowledged. Bytes
to the left of LastByteAcked are not kept as it had been acknowledged.
Receive Buffer
Receiving TCP maintains receive buffer to hold data even if it arrives out-of-order.
Receive buffer maintains three pointers namely LastByteRead,
NextByteExpected, and LastByteRcvd such that:
LastByteRead < NextByteExpected LastByteRcvd + 1
A byte cannot be read until that byte and all preceding bytes have been received.
If data is received in order, then NextByteExpected = LastByteRcvd + 1
Bytes to the left of LastByteRead are not buffered, since it is read by the
application.
Flow Control
Size of send and receiver buffer is MaxSendBuffer and MaxRcvBuffer
respectively. Sending TCP prevents overflowing of send buffer by maintaining
Receiver advertises a window of size 0, thus sender cannot transmit as it gets blocked.
When receiving process reads some data, those bytes are acknowledged and
AdvertisedWindow expands.
When an acknowledgement arrives for x bytes, LastByteAcked is
incremented by x and send buffer space is freed accordingly to send further
data.
What is silly window syndrome? When should TCP transmit a segment?
TCP sends a segment if:
o Maximum Segment Size (MSS) bytes are ready, where MSS
= MTU. o Sending process invokes a push operation
p On timeout
If AdvertisedWindow < MSS, TCP aggressively decides to transmit a
small segment, since delay affects interactive applications.
Receiver acknowledges those bytes, thus small segments (< MSS) are introduced into the
system remains indefinitely, since they do not combine with adjacent segments.
Nagles Algorithm
Nagle suggested an elegant self-clocking solution that provides a simple,
unified rule for deciding when TCP should transmit data.
When the application produces data to send
if both the available data and the
sample.
EstimatedRTT = EstimatedRTT + (1 ) SampleRTT
where is the smoothening factor with value ranging between 0.8
0.9 Timeout is determined as twice the value of EstimatedRTT .
TimeOut = 2 EstimatedRTT
Karn/Partridge Algorithm
The flaws discovered in TCP original algorithm after years of use was that
an ACK segment, acknowledges receipt of data, not a transmission.
When an ACK arrives after retransmission, it is impossible to decide,
whether to pair it with original or retransmission segment, for SampleRTT
estimation.
o
If ACK is associated with original one, then SampleRTT becomes too
large
o
A source is thus not allowed to send faster than network or destination host.
MaxWindow = MIN(CongestionWindow,
AdvertisedWindow)
EffectiveWindow = MaxWindow (LastByteSent
LastByteAcked)
Congestion control mechanisms are:
1. Additive Increase / Multiplicative Decrease (AIMD)
2. Slow Start
3. Fast Retransmit and Fast Recovery
Additive Increase/Multiplicative Decrease (AIMD)
Initially, TCP source sets CongestionWindow based on the level of
congestion it perceives to exist in the network.
Source increases CongestionWindow when level of congestion goes down
and decreases CongestionWindow when level of congestion goes up.
TCP interprets timeouts as a sign of congestion and reduces the rate of transmission. On
timeout, source reduces its CongestionWindow by half. This is known as
Additive Increase
CongestionWindow Trace
Analysis
AIMD decreases its CongestionWindow aggressively but increases
conservatively.
Small CongestionWindow results in less probability of packets being
dropped. Thus congestion control mechanism becomes stable.
Since timeout indicates congestion, TCP needs the most accurate timeout mechanism.
AIMD is appropriate only when source is operating close to network capacity.
Slow Start
Slow start is used to increase CongestionWindow exponentially from a
cold start. Source TCP starts by setting CongestionWindow to one
packet.
TCP doubles the number of packets sent every RTT on successful transmission.
o When ACK arrives for first packet TCP adds 1 packet to
CongestionWindow and sends two packets.
o When two ACKs arrive, TCP increments CongestionWindow by 2
packets and sends four packets and so on.
Initially TCP has no idea about congestion, henceforth it increases
CongestionWindow rapidly until there is a timeout.
On timeout:
p TCP decreases CongestionWindow by half (multiplicative
decrease).
o CongestionThreshold is assigned the current value of
CongestionWindow.
CongestionWindow=1PKT
Slow start is done till 17KB and additive increase thereafter till congestion occurs.
Exponential Increase
CongestionWindow Trace
Analysis
Slow start provides exponential growth and is designed to avoid bursty nature of TCP. TCP
loses more packets initially, because it attempts to learn the available bandwidth
Sending TCP waits for three duplicate ACK to confirm that packet is lost, before
retransmitting the lost packet. This is called fast retransmit before regular timeout.
When packet loss is detected using fast retransmit, the slow start phase is replaced by
additive increase, multiplicative decrease method. This is known as fast recovery.
Duplicate ACK
CongestionWindow Trace
Analysis
Long periods with flat congestion window and no packets sent are eliminated.
TCP's fast retransmit can detect up to three dropped packets per window.
If less than 50% of ACK have DECbit set, then source increases its congestion
window by 1 packet, otherwise decreases the congestion window by 87.5%.
Increase by 1, decrease by 0.875 rule was based on AIMD for stabilization.
if AvgLen MaxThreshold
drop the arriving
packet
When AvgLen exceeds MinThreshold, a small percentage of packets are dropped, forces
TCP connections to reduce their window sizes, which in turn reduces the rate at which
packets arrive at the router. Thus, AvgLen decreases and congestion is avoided.
RED thresholds
TCP Vegas
Throughput increases as congestion window increases. Increase in window size
beyond available bandwidth, results in packets queuing at the bottleneck router.
TCP Vegas goal is to measure and control the right amount of extra data in transit.
Extra data refers to amount of data that source would have refrained from
sending so as to not exceed the available bandwidth.
A flows BaseRTT is set to RTT of the packet when flow is not congested.
BaseRTT = MIN(RTTs)
CongestionWindow is assumed as total number of bytes in transit.
Expected throughput without overflowing the connection is
Thresholds and are defined and corresponds to less data and too much
extra data in the network, such that < .
TCP uses difference in rates and adjusts CongestionWindow accordingly.
o If Diff < , CongestionWindow is linearly increased during the next
RTT o If Diff > , CongestionWindow is linearly decreased during
the next RTT
Black line (actual throughput), color line (expected throughput) and threshold (shaded region)
Applications such as Telnet, FTP, email, Web browsing, etc., that can work
without timely delivery are termed as elastic.
Real-time applications are classified based on how they handle packet loss.
Robot control program can malfunction (intolerant) due to loss of a packet,
whereas loss of an audio sample will have less effect on audio quality (tolerant).
Real-time applications can also be classified based on their adaptability.
An audio application adapts to delay experienced in the network by buffering,
whereas video coding algorithms are rate adaptive with quality based on bandwidth.
RSpec defines resources that flow needs to reserve (buffer, bandwidth, etc).
TSpec
Bandwidth of real-time application varies constantly and exceeds their average rate.
Varying bandwidth characteristic of a flow is described using token bucket filter.
Token bucket is used to control the amount and rate of traffic sent to the
network. Two parameters used by the filter are token rate r and bucket depth
B.
Flow A generates data at a steady rate of 1 Mbps. It is described using a token bucket with
rate r = 1 Mbps and depth B = 1 byte. Flow A does not need depth to store tokens Flow B
sends at rate of 0.5 Mbps for 2 secs and then 2 Mbps for 1 sec. It is described using a token
bucket with rate r = 1 Mbps and depth B = 1 MB. Flow B uses depth of 1 MB to accumulate
tokens while sending 0.5 Mbps (2 0.5 = 1 MB) and uses those
RSVP Messages
Sender sends a PATH message to all receivers containing its TSpec every 30 seconds. A
PATH message contains necessary information for downstream receivers.
Each router uses PATH message to determine the reverse path for sending
reservation from receiver back to the sender.
Receiver sends a reservation request RESV message back to the sender
(upstream), containing sender's TSpec and receiver's requirement RSpec.
Each router on the path looks at the RESV request and tries to allocate
necessary resources and passes RESV onto the next router.
If allocation is not feasible, the router sends an error message to the receiver
In case of link failure, a new path is discovered between sender and the receiver.
Routers reserve resources as long as it receives RESV message, otherwise released.
For example, receiver B has already made a request for 3 Mbps. If A comes
with a new request for 2 Mbps, then no new reservations are made.
Admission Control
Admission control refers to mechanism used by a router to accept or reject a
flow based on flow specifications.
When a flow requests a level of service, its TSpec and RSpec are examined.
A flow is admitted, if desired service can be provided with currently available
resources without degrading service of previously admitted flows, otherwise denied.
Issues
Scalability IntSrv requires router to maintain information for each flow, which
is not feasible for today's internet growth
Service type limitation Only two types of services are provided. Certain
applications may require more than the offered services.
Discuss Differentiated Services QoS mechanism.
Differentiated Services (DiffServ) is a class-based QoS model designed for
IP. Default best-effort model is enhanced as a new class called premium.
Premium packets have bits set in the header by the gateway or ISP router.
IETF has defined a set of behaviors for routers known as per-hop behaviors
(PHB). TOS / TrafficClass field is replaced with 6-bit DiffServ Code Points
(DSCP).
The out curve has a lower MinThreshold than in curve, therefore under low
levels of congestion, only packets marked out will be discarded.
If the average queue length exceeds Minin, packets marked in are also
dropped.
Combination of profile meter at the edge router and RIO in all routers, assures (but
does not guarantee) the customer that packets within the profile will be delivered
RIO does not change the delivery order of in and out packets.
RIO generalized to provide more than two drop probability is known as
weighted RED (WRED).
DSCP code can be used to classify packets for WFQ scheduler. Weight for
premium queue is chosen as:
Bpremium = Wpremium / (Wpremium + Wbest-effort)
For example, if Wpremium = 1 and Wbest-effort = 4, then Bpremium = 0.2, i.e., 20%
How limitations of integrated services are handled in differentiated services?
1. The main processing was moved from the core of the network to edge of the network
(scalability). Thus routers need not store information about flows. The applications
define the type of service they need each time when a packet is sent.
2. Per-flow service is changed to per-class service. Router routes the packet
based on class of service defined in the packet, not the flow. Different types
of classes (services) are based on the needs of applications.
Define equation-based congestion control.
TCPs congestion-control algorithm is not appropriate for real-time applications.
A smooth transmission rate is obtained by ensuring that flows behavior
adheres to an equation that models TCPs behavior.
Variable bit rateDivided into two sub-classes, real-time and non-real time.
Varying traffic is described using a token bucket.
3. Unspecified bit rateBest-effort delivery without any guarantee.
4. Available bit rateDefines a set of congestion-control mechanism.
2.
List the issues in sliding window algorithm when used over internet.
Single link always connects the same two hosts, whereas TCP allows
processes running on any two hosts to be connected.
TCP connections have varying RTTs, whereas over a single link, RTT is fixed.
Packets may be reordered over internet, whereas on a link it is impossible.
Single link supports delay bandwidth product, whereas in TCP its flow control.
Congestion is not possible on a link, whereas TCP connection is not aware
of what links it will traverse and their capacities.
UNIT V
Different applications might be use the same protocol. For example, web
browsers use HTTP to retrieve web pages from a web server.
Discuss the components of an email system and the protocols used.
o Forward
facilitates forwarding message to a third party.
o Mailboxes
two mailboxes for each user namely inbox and outbox.
Message Format
RFC 822 defines email message with two parts namely header and body.
Each header line contains type and value separated by a colon (:).
Some are: o From identifier sender of the message.
o To mail address of the recipient(s).
o Subject says about purpose of the message.
o Date timestamp of when the message was transmitted.
E-mail address is userid@domain where domain is hostname of the mail server.
Body contains the actual message. Header is separated from the body by a blank line.
Multipurpose Internet Mail Extension (MIME)
Email system was designed to send messages only in NVT 7-bit ASCII format.
o
Languages such as French, German, Chinese, Japanese, etc are not supported.
Description
Service closing transmission channel
Request completed
Start mail input
Example
In each exchange, client posts a command and server responds with a code.
HELO cs.princeton.edu
250 Hello
daemon@mail.cs.princeton.edu
MAIL
FROM:<bob@cs.princeton.edu>
250 OK
RCPT TO:<alice@cisco.com>
250 OK
DATA
354 Start mail
input See u at
conference 250
OK
QUIT
221 Closing connection
Message Access Agent (MAA) / Mail Readers
MAA or mail reader allows user to retrieve messages in the mailbox from a
remote host, so that user can perform actions such as reply, forwarding, etc.
MAA protocols used are Post office protocol and Internet message access protocol
SMTP is a push type protocol whereas POP and IMAP are pop type protocol.
Request Message
Request Line
Request Header : Value
Body (optional)
Request Line
Request line contains three fields namely Request type, URL and HTTP
version. HTTP version specifies current version of the protocol i.e., 1.1
Request type specifies methods that operate on the URL. Some are:
Method
GET
HEAD
PUT
TRACE
DELETE
CONNECT
Description
retrieve document specified as URL
retrieve meta-information about the URL document
store document under specified URL
Loopback request message (echoing).
delete specified URL
Used by proxies
Request Header
Headers defined for request message include:
Request Header Description
Authorization
specifies what permissions the client has
From
specifies e-mail address of the user
Host
specifies host name and port number of the server
If-modifiedsince
server sends the URL if it is newer than specified date
Referrer
specifies URL of the linked document
User-agent
specifies name of the browser
For example, request message to retrieve file index.html on host cs.princeton.edu is:
GET index.html
HTTP/1.1 Host:
www.cs.princeton.edu
Response Message
Status Line
Response Header : Value
Body
Status Line
Status line contains three fields namely HTTP version, status code and status phrase.
3-digit status code classifies HTTP result based on leading digit (1xxInformational,
2xx Success, 3xxRedirection, 4xxClient error and 5xxServer error).
Status phrase gives brief description about status code. Some are:
Code Phrase
Description
100 Continue
Initial request received, client to continue process
200 OK
Request is successful
Moved
301 permanently
Requested URL is no longer in use
404 Not found
Document not found
Internal server
500 error
An error such as a crash, at the server site
Response Header
Provides additional information to the client. Some are:
Content-type
specifies the medium type
Expires
gives date and time up to which the document is valid
Last-modified
gives date and time when the document was last updated
Location
specifies location of the created or moved document
For example, response for a moved page is:
HTTP/1.1 301 Moved Permanently
Location: http://www.princeton.edu/cs/index.html.
TCP Connection
HTTP 1.1 uses persistent connection, i.e., client and server exchange multiple
messages over the same TCP connection. The advantages are:
o Eliminates connection setup overhead and additional load on the server.
o
Congestion window is very efficient by avoiding slow start phase for each page.
Caching
Caching enables the client to retrieve document faster and reduces load on the server.
Caching is implemented at places such as ISP router, Proxy server, Browser.
Server sets expiration date (Expires header), beyond which the page is not cached.
Cache document is verified whether it is a recent copy using If-ModifiedSince header. A page must not be cached if no-cache directive is specified.
Define Uniform Resource Identifiers (URI).
URI is a string that identifies resources such as document, image, service, etc. It
is of the form scheme:scheme-specific
Scheme identifies a resource type, such as mailto for mail address, file for file name,
etc. and scheme-specific is a resource identifier. Example is mailto:
skvijaianand@gmail.com
REST treats individual web services as WWW resources, identified by URI and
accessed via HTTP.
Web Service Description Language (WSDL)
WSDL is an operation model, where a web interface is a set of named operations
that represents interaction between client and web service.
Each operation specifies a message exchange pattern (MEP) that provides the
sequence in which the messages are to be transmitted.
Commonly used MEPs are In-Only (a message from client to service) and InOut (request from a client and corresponding reply from the service).
Message formats are defined as an abstract data model using XML Schema.
Concrete part specifies how MEPs are mapped onto it (binding). Predefined
bindings exist for HTTP and SOAP-based protocols.
Specification of a web service may contain multiple WSDL documents, and these
documents could be used in other web service.
Each WSDL document specifies URI of the target XML namespace.
A WSDL document can incorporate components of another by
Each header block specifies a role. A node processes header blocks that specify
a role assumed by the node and forwards the message.
A SOAP fault is generated if a node does not understand the blocks it should process.
REpresentational State Transfer (REST)
REST web services architecture is based on re-applying the model underlying
the WWW architecture.
In REST model, complexity is shifted from protocol to the payload.
Payload is a representation of the abstract state of a resource. For example, a
GET returns a representation of current state of the resource.
Message size is reduced by transmitting parts of a state by reference or URI.
XML and JSON are widely used as presentation language to define document structure.
REST uses infrastructure deployed to support the Web. For example, proxies can enforce
security mechanism.
Web supports intermediary nodes as in SOAP. For example, since GET is readonly, nodes can cache the response.
Compare SOAP/WSDL and REST protocol.
WSDL/SOAP integrates application via protocols customized to each application
protocol whereas REST adopts generic approach by using WWW architecture.
WSDL has user-defined operations, whereas REST uses HTTP methods GET and
POST. Interoperability in SOAP depends on the agreement with the underlying protocol,
SOAP, and SOAP be bound exclusively to HTTP and use HTTP POST method.
WS-I Basic Security Profile adds security constraints to basic profile by
specifying how SSL/TLS layer is to be used.
Explain the role of DNS on a computer network.
Naming service maps user-friendly names to router-friendly address, i.e., middle-ware.
Domain Hierarchy
Domain Naming System (DNS) includes:
o namespace to define domain names without any
collision, o binds domain names to IP address and
o name server to lookup IP address for a given name.
DNS implements hierarchical name space for domains in the Internet.
DNS names are processed from right to left and use periods (.) as separator.
DNS hierarchy is represented as a tree, where each node is a domain and leaves are hosts.
Six top level domains (TLD) are .edu .com .gov .mil .org and .net. TLD also exists for
Name field specifies the domain/zone name. It is used as primary search key.
o Type field indicates what kind of record it is. Commonly used types
are: NS Value field contains address of a name server
CNAME Value field contains alias name for the
host. MX Value field contains a mail server.
A Value field contains an IP address
o Class field is always IN for internet domain names.
o TTL field gives an indication of how long the resource record is valid.
Hierarchy of CS Nameserver
Resource Records
Root name server contain a NS record for each TLD name server and an A
record that translates TLD into corresponding IP address.
< edu, a3.nstld.com, NS, IN >
< a3.nstld.com, 192.5.6.32, A, IN >
Each TLD name server has a NS record for each zone-level name server and an
A record that translates zone name into corresponding IP address.
Resource records for TLD edu name server looks like:
2 princeton.edu, dns.princeton.edu, NS, IN >
3 dns.princeton.edu, 128.112.129.15, A, IN >
Third-level name server cs.princeton.edu contains A records for all hosts on that network.
Name Resolution
Client does not know address of root name server, therefore it sends query about
penguins.cs.princeton.edu to the local name server.
q Local NS sends a query containing penguins.cs.princeton.edu to the root server.
r Root server finds no exact match for query. Best match is NS record for edu that point to
p
s
t
TLD server a3.nstld.com. Therefore returns A record for a3.nstld.com to local NS.
Local NS resends the query to 192.5.6.32 since it has not got IP address for the query.
TLD edu server returns A record (128.112.129.15) for the best zone match
princeton.edu
NIC updates hosts.txt and mails it to all hosts. Thus a host comes to know
about IP address of other hosts.
Internet grew in the 80's, after which hosts.txt approach failed and DNS evolved.
Distinguish between host name and IP address.
Host on a network is uniquely identified by its IP address. It is numeric with fixed
length and suitable for processing by routers.
Host names are of variable-length and mnemonic. It is easier to remember than
an IP address, but does not help in locating a host on the network.
Explain how SNMP is used to manage nodes on the network
Simple Network Management Protocol (SNMP) is an application layer protocol
that monitors and manages routers, distributed over a network.
SNMP uses the concept of manager and agent. Manager is a host that runs SNMP
client program (GUI), whereas agent is a router that runs SNMP server program.
SNMP uses services of UDP on two well-known ports: 161 (agent) and 162 (manager).
SNMP is supported by two protocols: Structure of Management Information (SMI) and
MIB Groups
Each agent has its own MIB, which is a collection of objects to be managed.
SNMP objects are located under mib-2 object, identifiers beginning with
1.3.6.1.2.1 MIB-II (version 2) classifies objects under ten groups. Some
are:
o
sys (system
at (address translation
ip
mib-2 Groups
MIB variables
MIB variables are of two types namely simple and table.
Simple variables are accessed using group-id (1.3.6.1.2.1.7) followed by variable-id
and
0 (instance suffix). For example, udpInDatagrams is accessed as
1.3.6.1.2.1.7.1.0
Tables are ordered as column-row rules, i.e., column by column from top to bottom.
Leaf elements are only accessible in a table type, with group id followed by table id, leaf
element
and
instance
suffix.
For
example,
udpLocalAddress
id
is
1.3.6.1.2.1.7.5.1.1.3
UDP variables
Protocol Data Unit (PDU)
SNMP is request/reply protocol that supports various operations using
PDUs: o GET used by manager to retrieve value of agent variable.
o GET-NEXT used by manager to retrieve next entries in a
agent's table. o SET used by manager to set value of an agent's
variable.
o RESPONSE sent from an agent to manager in response to GET/GETNEXT that contains value of variables.
o TRAP sent from agent to the manager to report an event such as reboot.
When administrator selects a piece of information, manager puts identifier for the
MIB variable and sends request message to the agent.
Agent maps the identifier, retrieves value of the variable, and sends encoded
value back to the manager.