CS6551
CS6551
Ring: Each device has a dedicated point-to-point connection with the devices on either
side of it. A break in the ring can disable the entire network due to unidirectional traffic.
Classify LAN, WAN, MAN, SAN and Internetwork.
Local Area Network (LAN) is privately owned and links the devices in a single office,
building, or campus. The LAN size is limited to a few kilometers. A LAN will use only
one type of transmission medium. The speed of LAN is in the range 10–1000 Mbps.
Wide Area Network (WAN) provides long-distance transmission of data, image, audio,
and video over large geographic areas that may comprise a country / continent.
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 a protocol graph?
The suite of protocols that make up a network system is represented as a protocol graph.
The nodes correspond to protocols and edges represent a depends-on relation.
Define network architecture.
Set of rules governing form and content of protocol graph is called network architecture.
Network architecture guides the design and implementation of computer networks.
Two commonly used architecture are
o OSI Architecture
o Internet or TCP/IP architecture
What purpose do header and trailer serve?
A layer communicates control information to its peer, instructing it how to handle the
message when it is received by attaching a header in front of the message.
The trailer usually contains error control information.
A header/trailer is a small data structure consists of a few bytes.
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 bits—To be transmitted, bits must be encoded into signals, electrical or
optical. The physical layer defines the type of encoding.
Data rate—It defines the transmission rate (number of bits sent per second).
Physical topology—It defines how devices are connected (mesh, star, ring, bus or hybrid)
to make a network.
Transmission mode—The physical layer also defines the direction of transmission
between two devices: simplex, half-duplex, or full-duplex
Framing—The bit stream is divided into manageable data units called frames.
Physical addressing—A header is added to contain physical address of sender and
receiver of the frame.
Flow control—If receiving rate is less than the transmission rate, data link layer imposes
a flow control mechanism to avoid overwhelming the receiver.
Error control—Redundant information is added as trailer to detect and retransmit
damaged/lost frames and to recognize duplicate frames.
Access control—When 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 addressing—The packet is identified across the network using the logical
addressing system provided by network layer and is used to identify the end systems.
Routing—The connecting devices (routers or switches) prepare routing table to send
packets to their destination.
Transport Layer
Transport layer is responsible for process-to-process delivery of the entire message.
Service-point addressing—It includes a service-point address or port address so that a
process from one computer communicates to a specific process on the other computer.
Segmentation and reassembly—A message is divided into transmittable segments, each
containing a sequence number. These numbers enable the transport layer to reassemble
the message correctly at the destination and to identify which were lost/corrupt.
Connection control—Protocols can be either connectionless or connection-oriented.
Session Layer
It establishes, maintains, and synchronizes interaction among communicating systems.
Dialog control—It allows two systems to enter into a dialog and communication between
two processes to take place in either half-duplex / full-duplex mode.
Synchronization—The session layer allows a process to add checkpoints to a stream of
data. In case of a crash data is retransmitted from the last checkpoint.
Binding—binds together the different streams that are part of a single application. For
example, audio and video stream are combined in a teleconferencing application.
Presentation Layer
It is concerned with syntax and semantics of the information exchanged between peers.
Translation—Because different computers use different encoding systems, the
presentation layer is responsible for interoperability between these encoding methods.
Encryption—To carry sensitive information, a system ensures privacy by encrypting the
message before sending and decrypting at the receiver end.
Compression—Data compression reduces the number of bits contained in the
information. It is particularly important in multimedia transmission.
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
access, shared database management and several types of distributed services.
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).
o It supports the interconnection of multiple networking technologies into a logical
internetwork.
o It is an unreliable and connectionless protocol.
o IP sends data in packets called datagrams, each of which is transported separately
and independently.
o Other protocols supported in this layer are ARP, RARP, ICMP and IGMP.
Transport layer is responsible for delivery of a message from one process to another
process. The two protocols supported in this layer are:
o Transmission Control Protocol (TCP) for connection-oriented reliable byte-
stream channel.
o User Datagram Protocol (UDP) for connectionless unreliable datagram delivery
channel.
Application supports a wide range of protocols such as FTP, TFTP, Telnet (remote
login), SMTP, etc., that enables the interoperation of popular applications.
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.
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 frame’s 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 sender’s 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 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.
All words (incl. checksum) are summed using one's complement arithmetic.
Carries (if any) are wrapped and added to the sum.
The complement of sum is known as checksum and is sent with data
Receiver
The message (including checksum) is divided into 16-bit words.
All words are added using one's complement addition.
The sum is complemented and becomes the new checksum.
If the value of checksum is 0, the message is accepted, otherwise it is rejected.
7 0111 0111
11 1011 1011
12 1100 1100
6 0110 0110
Initial Checksum 0000 Received Checksum 1001
Sum 100100 Sum 101101
Carry 10 Carry 10
Sum 0110 Sum 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:
o All single-bit errors, as long as the xk and x0 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.
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
When an acknowledgment arrives, the sender moves LAR to the right, thereby allowing
the sender to transmit the subsequent frames.
The sender buffers up to SWS frames (for retransmission), until they are acknowledged.
Receiver
Similarly the receiver maintains three state variables:
o The receive window size RWS gives the upper bound on number of out-of-order
frames that the receiver is willing to accept.
o LAF denotes acceptable frame with the largest sequence number
o LFR denotes sequence number of the last frame received
o The invariant LAF LFR RWS is always maintained.
A frame numbered SeqNum is accepted if LFR < SeqNum LAF, otherwise discarded.
Frames can arrive out of order and may be buffered.
If all frames, say with sequence number SeqNumToAck have arrived, the receiver
acknowledges frame SeqNumToAck. The variables updated are:
o LFR = SeqNumToAck
o LAF = LFR + RWS
Window size
SWS depend on how many frames are expected to be outstanding on the link. It is based
on delay × bandwidth product.
RWS is either set to 1 or the value of SWS.
o If RWS = 1, then receiver does not buffer frames.
o If RWS = SWS, receiver buffers out-of-order frames, but does not acknowledge.
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
Sequence numbers are modulo 2m 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.
Frames are numbered as modulo-2m 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
o Speed of light propagation varies on medium (2.3 × 108 m/s in copper, 2.0 × 108
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
The Point-to-Point Protocol (PPP) is used to carry packets over point-to-point links.
The flag field contains special character 01111110
The protocol field is used for multiplexing.
The payload is 1500 bytes by default.
Explain the socket API for implementing network application.
Network protocols are implemented as part of operating system and interface provided is
known as network application programming interface (API).
Network APIs provide syntax through which protocol services are invoked.
The socket interface from Berkley Unix is widely used.
Abstraction of the socket interface is called socket. Socket is an endpoint on the
communication link between applications running on the network.
Operations defined are socket creation, binding socket to network, send / receive
messages and finally close the socket.
Socket Creation
Socket is created using socket interface. A handle is returned on successful creation.
int socket(int domain, int type, int protocol)
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
main()
{
int sd, bd, ad;
/* Passive Open */
bd = bind(sd, (struct sockaddr*)&servaddr, sizeof(servaddr));
listen(sd, 5);
printf("Server is running\n");
ad = accept(sd, (struct sockaddr*)&cliaddr, &clilen);
printf("Client connection established\n");
while(1)
{
/* Receive message from client */
recv(ad, buff, sizeof(buff), 0);
printf("Received from the client: %s", buff);
if (strcmp(buff, "bye") == 0)
break;
Header file <netinet/in.h> defines IPv4 socket address structure called sockaddr_in
Socket data structure is constructed using a port number that is not used for any internet
service, say 5555.
Server's IP address is set as INADDR_ANY to accept connections on any of the host’s IP
addresses.
After passive open, server exchanges messages with the client.
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
/* Active Open */
cd = connect(sd, (struct sockaddr*)&servaddr, sizeof(servaddr));
Client builds data structure required for the socket interface and opens an active
connection with the server.
If server's IP address is not given as command line argument, then server process is
running on the same localhost.
The client uses sentinel value (bye) to terminate the connection.
Switch decides which packet is to be transmitted from the packets queued up, according
to queuing discipline such as FIFO.