cs6551 computer networks · 2019-11-22 · cs6551 – computer networks page 4 o the protocols are...

70
DEPARTMENT OF INFORMATION TECHNOLOGY Study Material CS6551 COMPUTER NETWORKS for B.Tech III Year / V Semester Academic Year (2018-2019) Prepared by Dr.A.Nirmal Kumar

Upload: others

Post on 16-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

DEPARTMENT OF INFORMATION TECHNOLOGY

Study Material

CS6551 – COMPUTER NETWORKS

for

B.Tech – III Year / V Semester

Academic Year (2018-2019)

Prepared by

Dr.A.Nirmal Kumar

Page 2: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 1

CS6551 - COMPUTER NETWORKS

UNIT –I FUNDAMENTALS AND LINK LAYER

Building a network – Requirements – Layering and Protocols – Internet architecture –

Network software – Performance; Link layer services – Framing – Error detection – Flow

control

Layers of OSI model (or) Layering and Protocol. ISO defines a common way to connect computers, called Open Systems Interconnection

(OSI) architecture. (eg. public X.25 network).

OSI partitions network functionality into seven layers namely: Physical, Data Link, Network, Transport, Session, Presentation and Application.

Bottom three layers are implemented on all nodes in the network including switches.

1. Physical Layer It coordinates the functions required to carry a bit stream over a physical medium.

Encoding—Bits are encoded into signals (electrical or optical) for transmission.

Data rate—Defines the transmission rate (number of bits sent per second).

Physical topology—How devices are connected (mesh, star, ring, bus or hybrid)

Transmission mode—Direction of transmission (simplex or duplex).

Page 3: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 2

2. Data Link Layer

The data link layer transforms a raw transmission facility to a reliable link.

Framing—Bit stream is divided into manageable data units called frames.

Physical addressing—Header contains physical address of sender and receiver

Flow control—mechanism that avoids sender overwhelming the receiver with frames.

Error control—Redundant information is put as trailer to detect corrupt frames.

Access control—Protocol that determines which device has control over the shared link.

3. Network Layer

It is responsible for source-to-destination delivery of a data unit called packet.

Logical addressing—A packet is identified across the network using logical addressing

provided by network layer and is used to identify the end systems.

Routing—Routers prepare routing table to send packets to their destination.

5. Transport Layer

Transport layer is responsible for process-to-process delivery of the entire message.

Port addressing—Processes communicates with each other using through ports.

Segmentation and reassembly—A message is divided into transmittable segments, with a sequence number. Segments belonging to a message are reassembled at the other end.

Connection control—Protocols can be either connectionless or connection-oriented.

6. Session Layer

It establishes, maintains, and synchronizes interaction among communicating systems.

Dialog control—Enables two systems to enter into a dialog and communicate

Synchronization—Adds checkpoints to a stream of data, used when system crashes.

Binding—Binds different streams (audio & video stream in videoconference application).

7. Presentation Layer

It is concerned with syntax and semantics of information exchanged between peers.

Translation—Facilitates interoperability when end nodes use different encoding systems.

Encryption—Ensures privacy by encrypting the message before sending.

7. Compression—Data compression reduces bandwidth requirements (eg. Multimedia).

Application Layer Enables the user, whether human or software, to access the network.

Provides user interface and support for services such as electronic mail, remote file

access, shared database management and several types of distributed services.

Composes a host of application protocols such as HTTP, FTP, SMTP, etc.

Page 4: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 3

Layers of TCP/IP (or) Internet architecture. 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

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.

Trailer usually contains error control information.

A header/trailer is a small data structure consists of a few bytes. The different types of addressing are:

o unicast (one-to-one communication), o multicast (communicating to all members of a group) and

o broadcast (sending to all nodes on the network).

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 Defines a common method for exchanging packets to any type of network o Segregates host-to-host delivery from process-to-process delivery.

Protocol can be added, if it provides at least one working implementation. 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.

Page 5: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 4

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.

Application on the Internet. Internet provides two major class of applications on the internet

1. Web page delivery in a browser using a URL, i.e. a simple file transfer using TCP. For e.g. http://www.google.co.in

2. Streaming audio and video in a continuous manner. For example, Video on

demand (YouTube) and Internet Radio. VoIP applications using Skype or

Videoconferencing have timing constraints.

The socket API for implementing network application.

Network protocols are 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.

Unix socket interface is widely used. 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 usingsocketinterface. A handle is returned on successful creation.

socket( domain, type, protocol ) o domain argument specifies protocol family (PF_INET for Internet family,

PF_PACKET for direct access to network, etc) o type argument specifies stream (SOCK_STREAM for byte stream, SOCK_DGRAM

for message-oriented service, SOCK_RAW for raw sockets) o protocol argument specifies the protocol used (default value 0).

Server Process Server processes perform passive open, i.e., it waits for client requests by invoking the

following operations:

Page 6: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 5

bind( socket, address, addr_len ) listen(socket, backlog ) accept( socket, address, addr_len )

o bind operation attaches the socket to server host's IP address and port. Server port

number is well-known, i.e., 0–1024 (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.

connect( socket, address, 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.

Flow control mechanism or reliable transmission Flow Control. Flow control is a set of procedures that tells the sender how much data it can transmit

before it must wait for an acknowledgment from the receiver.

It prevents a fast sender from overwhelming a slow receiver with frames.

Acknowledgement.

An acknowledgment (ACK) is a small control frame that a protocol sends back to the

sender acknowledging the receipt of a frame.

Frames are delivered in a reliable manner using acknowledgement

Automatic Repeat Request When a corrupt frame arrives at the receiver, it is discarded.

If the sender does not receive an acknowledgment within a specified period (timeout), it

retransmits the original frame. This is known as automatic repeat request (ARQ).

The two ARQ are

1.Stop and Wait ARQ

2.Sliding Window ARQ

1. Stop and Wait ARQ

Sender keeps a copy of the frame and then transmits it.

Waits for an acknowledgment before transmitting the next frame.

If acknowledgment does not arrive before timeout, sender retransmits the previous frame.

Page 7: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 6

(a) (b) (c) (d) Scenarios

a) ACK is received before the timer expires. The sender sends the next frame.

b) 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) Sender times out soon before ACK arrives and retransmits the frame.

Sequence number

Scenarios (c) and (d) leads to duplicate frames at the receiver’s end.

Therefore header includes a 1-bit sequence number (0 or 1) based on modulo-2 arithmetic Inefficient since there can be only one outstanding frame, i.e., bandwidth is wasted.

2. Sliding Window

Sliding window improves efficiency by allowing multiple frames to be in transit. window defines range of sequence numbers for both sender and receiver to deal with.

Window position changes (slides) due to transmission of frames and ACKs.

The two variants of sliding window protocol. The two variants of sliding window protocol are Selective Repeat and Go Back N.

1. Selective Repeat Size of RWS is same as SWS.

When an out-of-order frame arrives, receiver sends a negative acknowledgement (NAK)

forcing the sender to retransmit the expected frame. This is known as Selective Repeat.

NAK speeds up retransmission of a frame before timer expires and improves performance

2. Go-Back-N In Go-Back-N sliding window protocol, the size of receiver window is 1.

Page 8: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 7

The receiver accepts only the expected frame and discards any other frame that arrives.

Sender eventually timeout and retransmits all outstanding frames.

Not suited for noisy channels. Sender Sender assigns a sequence number SeqNum to each frame.

A timer is associated with each frame it transmits, and retransmits the frame on timeout. It maintains three state variables:

o Sender window size SWS gives the upper bound on number of outstanding frames.

SWS is based on delay × bandwidth product. o LAR denotes the sequence number of the last acknowledgment

received. o LFS denotes the sequence number of the last frame sent. o Invariant LFS − LAR≤ SWS is always maintained

When an acknowledgment arrives, LAR moves to the right, allowing the sender to

transmit the subsequent frames.

Sender buffers up to SWS frames (for retransmission), until they are acknowledged. Receiver

Similarly the receiver maintains three state variables: o Receiver 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 Invariant LAF − LFR ≤ RWS is always maintained.

A frame numbered SeqNum is accepted if LFR < SeqNum ≤ LAF, otherwise discarded.

Frames that arrive out of order is buffered but not acknowledged.

If all preceding frames up to SeqNumToAck has arrived, then receiver acknowledges

frame SeqNumToAck. The acknowledgement is cumulative. Variables updated are:

o LFR = SeqNumToAck

o LAF = LFR + RWS .Sequence Number

Sequence numbers are modulo 2m

where m is the size of sequence field and wrap around.

Page 9: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 8

To avoid the issue of identifying sequence numbers of different sets, SWS is defined as

SWS < (MaxSeqNum + 1) /2 Example

The advantages of sliding window flow control. Delivers frames reliably across an unreliable link using timeout and acknowledgement.

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.

Supports flow control. The receiver through acknowledgement informs the sender about how many frames it can still receive.

Difference 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.

Frames are numbered as modulo-2m

in sliding window whereas it is sequenced as modulo-2 in stop and wait protocol.

Stop-and-Wait ARQ protocol is a special case of sliding window in which the sender

window size is 1.

Error detection methods Bit errors are introduced into frames because of electrical interference or thermal noise.

This interference can change the shape of the signal, i.e. bit inversion.

The types of error

The two types of error are single-bit error and burst error

Single-bit error means that only 1 bit of a given data unit is changed. Single-bit errors are the least likely type of error in serial data transmission.

Page 10: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 9

Burst error means that 2 or more bits in the data unit have changed

Differentiate error detection and error correction. Error detection—Receiver uses redundant information to detect whether the received data

contains error or not. If an error is detected, the data is discarded and sender retransmits.

Methods are Two dimensional parity, Internet checksum, CRC

Error correction—Receiver uses the redundant bits to determine which bits are corrupted

and original data is restored by the receiver. No retransmission is required. Methods are

Hamming code, Reed Solomon, etc.

Error detection methods Error detection is only to see if data is corrupted or not. A single-bit or burst error is

immaterial.

Sender adds k redundant bits for n data bits (k << n) to a frame, which is used by the receiver to determine if errors are there or not.

1. Two-Dimensional Parity

Data is divided into rows of 7 bits each.

Even parity is computed for each row (Vertical Redundancy Check).

Even parity is also computed for each column (Longitudinal Redundancy Check).

Thus a parity byte for the entire frame, in addition to a parity bit for each byte is sent.

Data : 1100111 1011101 0111001 0101001

1 1 0 0 1 1 1 1

Pari

ties

1 0 1 1 1 0 1

1

0 1 1 1 0 0 1 0

Ro

w

0 1 0 1 0 0 1 1

0 1 0 1 0 0 1 1 Column Parities

Transmitted Data : 11001111 10111011 01110010 0101001101010011 Receiver computes row and column parities for data bits. If all parity bits and parity byte

match, then the frame is accepted else discarded.

Two-dimensional parity catches all 1, 2 and 3-bit errors, and most 4-bit errors.

2. Internet Checksum 16-bit Internet checksum is widely used by UDP and not in data link layer.

Page 11: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 10

Sender

Given data is divided into 16-bit words.

All words are added using one's complement arithmetic.

Carries (if any) are wrapped and added to the sum.

Complement of sum is known as checksum and is sent with data Receiver

All words including checksum 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 7 0111

11 1011 11 1011

12 1100 12 1100

6 0110 6 0110

Received Checksum 1001

Sum 100100 Sum 101101

Carry 10 Carry 10

Sum

Sum

0110 1111

Checksum 1001 New Checksum 0000

Sender

Receiver

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.

3. Cyclic Redundancy Check (CRC) CRC uses the concept of finite fields.

A n bit message is represented as a polynomial of degree n - 1.

Message M(x) is represented as a polynomial by using the value of each bit as coefficient

for each term. For example, 10011001 is represented as x7 + x

4 + x

3+ 1

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 polynomial 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.

Page 12: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 11

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 Divisor polynomialC(x) should has the following error-detecting properties:

o All single-bit errors, as long as the xk and x

0 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)

It is implemented in hardware using a k-bit shift register and XOR gates.

Widely used in networks such as LANs and WANs.

Different versions of CRC are CRC-8, CRC-10, CRC-12, CRC-16, and CRC-32.

Page 13: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 12

OTHER IMPORTANT QUESTIONS

1.Discuss the factors that affect performance of the network. 1. Bandwidth and Latency Bandwidth refers to number of bits that can be transmitted over the network within a

certain period of time (throughput).

Bandwidth also determines how long it takes to transmit each bit. For example, each bit on a 1-Mbps link is 1µs wide, wh ereas each bit on a 2-Mbps link is 0.5µs wide .

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

Speed of light propagation depends on medium and distance.

Propagation = Distance / SpeedOfLight

Transmission time depends upon bandwidth and packet size.

Transmit = Size / Bandwidth

Queuing delay occurs at switches and routers, since packets are stored before forwarded.

For applications that have minimal data transfer, latency dominates performance, whereas for bulk data transfers, bandwidth dominates performance.

2. Delay × Bandwidth Product Consider a pipe, in which bandwidth is diameter and delay corresponds to length.

Delay × bandwidth product specifies the number of bits in transit. It corresponds to how

much the sender should transmit before the first bit is received at the other end.

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.

3. 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 same file over a 1 Gbps links falls short of 1 RTT.

Effective end-to-end throughput that can be achieved is given as Throughput = TransferSize / TransferTime

TransferTime includes latency as well as setup time.

Page 14: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 13

4. Application Performance Needs Applications generally require as much bandwidth provided by the network.

Average bandwidth of flow rates could be estimated, but instantaneous bursty traffic should also be handled.

Latency varying from packet to packet is known as jitter. If receiver knows the latency that video packets may experience, then it delays playing first frame.

2.Discuss the requirements for building a computer network. 1. Perspectives

Application programmer—list the services based on application needs. For example, a

guarantee that each message will be delivered without error or within a certain time.

Network operator—lists the characteristics of a system that is easy to administer and

manage. For example, fault isolation, adding new devices, easy to account for usage, etc.

Network designer—lists the properties of a cost-effective design. For example, efficient

utilization of network resources, fair allocation to users, etc.

2. Scalable Connectivity A system that is designed to support growth to an arbitrarily large size is scalable.

End nodes can be connected through a set of forwarding nodes called switches to build networks. Switching could be either circuit or packet switching.

Each node on the network is assigned a unique address.

Packet switching networks uses store-and-forward method, i.e. the switch receives a packet, stores in its buffer and later forwards onto another link.

Independent networks are connected to form internetwork or internet. A node that connects two or more networks is known as router.

Process of forwarding message from source to destination is known as routing. Messages may be unicasted, multicasted or broadcasted.

3. Cost-Effective Resource Sharing Hosts share network resources using the concept of multiplexing. For example, multiple

flows can be multiplexed onto a single physical link using FDM / TDM.

Synchronous time-division multiplexing (STDM) divides time into equal slots and flows use the slots in a round-robin manner.

Statistical multiplexing is same as STDM but packets are transmitted from each flow on demand, rather than on predetermined slot.

Page 15: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 14

Packets multiplexed at one end, is demultiplexed at the other switch.

Switch process the packets queued up using queuing discipline such as FIFO. 4. Support for Common Services Since applications have common services, network must provide logical channels and set

of services such as guaranteed delivery, in-order delivery, privacy, etc.

Two types of communication channels provided are request/reply and message stream.

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 in-order delivery, required in applications like video conferencing.

5. Manageability Network needs troubleshooting to adapt to increase in traffic or to improve performance.

Automating network management tasks is needed for scalability and cost-effectiveness.

Network nowadays is common and should be managed by consumers with less skill level

Page 16: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 15

UNIT-II MEDIA ACCESS AND INTERNETWORKING

Media Access Control – Ethernet (802.3) – Wireless LAN (802.11) – Bluetooth – Switching

and bridging – Basic Internetworking (IP, CIDR, ARP, DHCP, ICMP)

IEEE 802.3 standard or Ethernet or CSMA/CD Ethernet was standardized as IEEE 802.3

Standard Ethernet is the most successful LAN technology with a data rate of 10 Mbps. It has evolved into Fast Ethernet (100 Mbps) and Gigabit Ethernet (1Gbps, 10Gbps).

the mechanism used in CSMA/CD? CSMA with collision detection (CSMA/CD) handles collisions over a wired medium.

Station monitors the medium as it sends a frame

If a collision is detected, it aborts transmission and broadcasts a jamming signal.

Stations hearing jamming signal, refrain from transmitting frames.

It waits for a random amount of time and attempts retransmission.

Physical Properties

Hosts are tapped on to the Ethernet segment, each at least 2.5 m apart.

Transceiver is responsible for transmitting/receiving frames and collision detection.

Protocol logic is implemented in the adaptor.

Ethernet can support a maximum of 1024 hosts.

Maximum length of Ethernet is 2500 m.

Manchester encoding scheme is used with digital signaling at 10 Mbps.

Various forms of Standard Ethernet are 10Base5 (thick ethernet), 10Base2 (thin ethernet), 10Base-T (twisted-pair) and 10Base-F (fiber-optic).

Ethernet segments can be connected using repeater or a hub.

Media Access Control (MAC) Ethernet MAC protocol regulates access to the shared Ethernet link.

Frame Format

Preamble—alternating 0s and 1s that alerts the receiving node.

Destination address—physical address of the destination host.

Source address—physical address of the sender.

Type—contains either type of upper layer protocol or frame length.

Page 17: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 16

Body—data (46–1500 bytes).

CRC—error detection information (CRC-32).

Addressing

Each host on the Ethernet network has its own network interface card (NIC).

NIC provides a globally unique 6-byte physical address. For example, Transmitter

Ethernet is a working example of CSMA/CD.

Minimum frame length of 64 bytes is required for operation of CSMA/CD.

Signals placed on the Ethernet propagate in both directions and is broadcasted.

Ethernet is a 1-persistent protocol. When there is a frame to be sent:o If link is idle, the frame is transmitted immediately. o If link is busy, it waits till it becomes idle and then transmits immediately.

When two or more nodes transmit frame simultaneously collision occurs.

CSMA/CD works as follows:o Current transmission is aborted. o A 96-bit runt frame (64-bit preamble + 32-bit jamming sequence) is sent. o Other nodes refrain from transmission on receiving runt frame. o Retransmission is attempted after back-off procedure (k × 51.2µ s, k = 1,2,3…16)

o After 16 attempts, retransmission is given up. Receiver

Each frame transmitted on an Ethernet is received by every adaptor on that network.

A frame is accepted if destination address:o matches its address, o contains broadcast address (FF:FF:FF:FF:FF:FF), o multicast address, if it's part of that multicast group.

Frames are discarded, if it is not meant for that host.

All frames are accepted, if configured in promiscuous mode.

Ethernet does not acknowledge received frames.

The minimum frame length in Ethernet should be at least 64 bytes (512 bits). Consider the following worst case scenario in which hosts A and B are at either ends.

Host A begins transmitting a frame at time t (fig a).

It takes link latency d for the frame to reach host B. Thus, the first bit of A’s frame arrives at

B at time t + d (fig b)

Suppose an instant before host A’s frame arrives, B senses it idle and begins to transmit.

B’s frame collides with A’s frame, and this collision will be detected by host B (fig c)

Host B aborts its transmission and sends a runt frame.

Page 18: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 17

Host A knows about collision only when runt frame reaches it, at time t + 2d (fig d)

RTT for Ethernet with maximum distance (2500 m) is 51.2µ s. It corresponds to 512 bits

(64 bytes) on 10 Mbps standard Ethernet. Thus frame length of 512 bits is required for a

host to detect collision before it transmits the last bit of that frame.

Advantages and disadvantages of Ethernet. Easy to administer and maintain.

Relataively inexpensive.

Produces better output only when lightly loaded (< 200 hosts).

It is an unreliable medium.

The function of a repeater A repeater is a device that connects LAN segments and extends length of the LAN.

It reconstructs a weak digital signal and forwards on all outgoing segments.

Utmost four repeaters can be placed between a pair of hosts.

It operates in the physical layer.

Exponential back-off. When collision is detected, the node waits random amount of time and tries again.

Each time it fails to transmit, the adaptor doubles the amount of time it waits for each reattempt. This is known as exponential back-off.

The features of 10Base5, 10Base2, 10BaseT and 10BaseF.

10Base5—uses thick coax cable up to 500 m with bus topology (Thick Ethernet)

10Base2—uses thin coax cable up to 200 m with bus topology (Thin Ethernet)

10BaseT—uses twisted-pair cable up to 100 m with star topology (Switched Ethernet)

10BaseF—uses fiber-optic cable up to 2000 m with star topology.

Wireless LAN or IEEE 802.11 Wireless LAN (WLAN) or Wi-Fi is designed for use in a limited area (office, campus, etc).

It is standardized as IEEE 802.11Physical Properties WLAN runs over free space based on FHSS (frequency hopping over 79 1-MHz-wide

frequency bandwidth) and DSSS (11-bit chipping sequence).

Variants of 802.11 are:

4. 802.11b operates in 2.4-GHz frequency band with data rate of 11 Mbps.

o 802.11a/g runs in 5-GHz band using orthogonal FDM (OFDM) at 54 Mbps o 802.11n uses multiple antennas (multiple input/output) and offers up to 100 Mbps

Optimal bit rate for transmission is based on signal-to-noise ratio (SNR) in environment.

Distribution System

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.

Page 19: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 18

Nodes communicate directly if they are reachable (A and C), else through APs (A

and E). Hidden / Exposed Node Problem All nodes are not within the reach of each other.

Carrier sensing may fail because of hidden node and exposed node problem.

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 from sending to node D, even though its transmission to D would not interfere.

Thus node C is exposed to transmission from node A to B Multiple Access with Collision Avoidance (MACA) Nodes exchange control frames to reserve access, so that nearby nodes avoid transmission

during duration of a data frame.

Control frames used to avoid collision are Request to Send (RTS) and Clear to Send (CTS).

Both RTS and CTS contain source & destination address and transmission duration.

Source sends RTS frame to destination

Nodes that receive RTS frame are close to source and wait for CTS to be transmitted back.

Destination node sends back a CTS frame as acknowledgement.

Nodes that receive CTS remain silent for the upcoming data transmission.

Nodes that receive RTS but not CTS, is away from the destination and is free to transmit.

Destination sends an ACK frame finally after successfully receiving data frames.

Page 20: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 19

Frame Format

Control―indicates frame type (RTS, CTS, ACK or data) and 1-bit ToDS / FromDS

Duration―specifies duration of frame transmission.

Addresses―The four address fields depend on value of ToDS and FromDS subfields.

Sequence Control―defines sequence number of the frame.

Body―contains a maximum of 0–2312 bytes. CRC―contains CRC-32 error detection sequence.

Bluetooth Bluetooth technology, standardized as IEEE 802.15.1 is a personal area network (PAN).

It is used for short-range wireless communication, maximum of 10m, between mobile phones, PDAs, notebook and other peripheral devices.

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 protocols for a range of application, known as profiles. For instance, a profile synchronizes PDA and PC.

Bluetooth network configuration 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 FHSS (79 channels, each 625 µs) for transmission. Master transmits in odd-numbered slots, whereas slaves respond in even 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.

Piconets can be combined to form scatternet. A node can be a part of two piconets, i.e., it can be slave in one and master in another piconet.

Hardware and software is simple and inexpensive. Hence it is popular and widely used

Adhoc network Adhoc or wireless mesh network has no base station. All nodes are peers.

Messages are forwarded through peers in a chain formation.

Mesh topology is very robust and fault-tolerant.

Page 21: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 20

List and compare the features of any two wireless technologies. Bluetooth WiFi WiMax 3G

IEEE standard 802.15.1 802.11 802.16

Link length 10 m 100 m 10 km Tens of km

Bandwidth 2.1 Mbps (shared) 54 Mbps (shared) 70 Mbps 384 Kbps

Usage Link a peripheral Link a computer Link a building Link a cell phone to a computer to a wired base to a wired tower to a wired tower

Switching and Bridging Datagram Datagram approach is a connectionless network. No connection state is maintained.

Resources such as bandwidth are not reserved but allocated on demand.

Each packet is routed independently. A switch or link failure does not have adverse effect

Each switch has a forwarding table that contains destination address and output port.

When a switch examines a packet, the destination address is looked-up in the table to determine the corresponding output port, onto which the packet is forwarded.

Example Network Forwarding table for Switch-2

Virtual Circuit Switching Virtual-circuit is a connection-oriented model. A virtual connection from source to the

destination is established before any data is sent.

Resources are reserved, therefore QoS is guaranteed by the network.

Each switch contains VC table with fields, Incoming port & VCI, Outgoing port & VCI.

In large networks, hosts create virtual circuit through signaling, known as Switched Virtual Circuit (SVC). It consist of two phases: Setup Request and Acknowledgement

Page 22: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 21

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 Creates a VC table entry with incoming port=1 and outgoing port=3. o Chooses an unused VCI for frames to host B, say 14 as incoming VCI. o 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 host B. Acknowledgment Host B picks an unused VCI, say 77, for frames from host A. It sends an ACK to switch 3

The ACK frame carries source & destination addresses and chosen VCI by host B. Switch 3 uses this VCI, i.e., 77 as outgoing VCI and completes VC table entry.

Switch 3 forwards the ACK containing its incoming VCI (22) to switch 2. Thus incoming

VCI of a switch becomes outgoing VCI for the next switch.

Finally switch 1 sends an acknowledgment to source host A containing VCI as 14.

Source host A uses 14 as its outgoing VCI for data frames to be sent to destination B.

Data transfer starts after connection establishment.

Source Routing All information about network topology required to route a packet to the destination is

provided by the source host.

Header contains ordered list of intermediate hosts, through which packet must traverse.

Headers can be handled either by rotation or stripping or pointer-based approach.

Source routing is classified as either strict or loose.o In strict source routing, only given set of nodes are visited o In loose source routing, other nodes including specified set of nodes is also visited

Page 23: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 22

Rotation Stripping Pointer

VCI. Virtual Circuit Identifier (VCI) is an identifier that has link local scope.

VCI and interface on which it was received, uniquely identifies a virtual connection.

Incoming and outgoing VCI for a connection is always distinct.

Permanent Virtual Circuit Virtual circuit table at each switch is configured by the network administrator.

If a packet arrives on incoming interface with designated VCI value in its header, then the packet is sent on outgoing interface with outgoing VCI value as specified in VC table.

PVC is used for small-sized network only.

Disadvantage of virtual circuit network. One RTT delay before data is sent due to setup request and acknowledgement.

Overhead for a data packet is less, since VCI is a small number.

If a switch or link fails, the connection is teardown and a new one is setup.

Bridge. 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.

Static bridge Bridge is configured with a forwarding table during setup by the administrator manually.

When a frame arrives, the bridge performs a look-up on the table.

Outgoing port for the destination is obtained and the frame is sent on that port.

Table must be updated manually when stations are added or removed. Learning (or) transparent bridge builds forwarding table. Learning bridges builds forwarding table gradually by learning from frame movements.

Bridge uses source address to add entries and destination address to forward frames.

Source address and incoming port is appended to the table, if an entry does not exist.

Forwarding table is looked up for destination address: o If source and destination are from same LAN, then the frame is dropped. o If an entry exists, then frame is forwarded on the corresponding port.

o Otherwise, the frame is flooded on all other ports.

Learning process continues as bridge forwards frames and optimizes forwarding decision.

Page 24: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 23

Example

Bridged network Forwarding Table

When host A sends a frame to D: Bridge has no entry for hosts D and A o 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. o Bridge appends entry to the table and floods the frame on all other ports.

When host E sends a frame to A:o Bridge has an entry for host 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 host B sends a frame to C:o Bridge has no entry for station C.

It floods the network and adds one more entry to the table. When does learning bridge fail? Learning bridge works fine as long as there is no loop.

Loops are formed when redundant bridges are introduced to improve reliability.

When loop exists, multiple copies of the frame exists as they are flooded by bridges.

Internetworking Protocol (or) IPv4 Internet Protocol (IP) is used to build scalable, heterogeneous internetworks.

Addressing scheme is used to identify all hosts uniquely in the internetwork.

Best-effort, connectionless service is used by IP to deliver a datagram

IP provides neither error control nor flow control. It is an unreliable service. Packet Format

IPv4 has a variable-length packet (20-65,535 bytes) consisting of header and data.

Header is 20–60 bytes long and contains information essential to routing and delivery

Page 25: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 24

Version―version of IPv4 protocol, i.e. 4.

HLen―length of the header in 4-byte words (default 5).

TOS―allows packets to be placed on separate queues based on QoS required.

Length―total packet length (header + data), which is restricted to 65,535 bytes.

Ident―a 16-bit identifier that uniquely identifies a datagram packet.

Flags―contains D (do not fragment) bit and M (more fragment) bit.

Offset―shows relative position of the fragment in units of 8 bytes.

TTL―defines lifetime of the datagram (default 64 hops).

Protocol―specifies upper layer protocol (UDP / TCP).

Checksum―16-bit internet checksum for the packet header.

SourceAddr / DestinationAddr―32-bit IP address of source and destination host. Global Addressing

IPv4 uses 32-bit addresses, i.e., approximately 4 billion addresses (232

). IP addresses consist of two parts, network id and host id.

IP address is written in dotted notation, with each byte 0–255 (eg, 172.16.15.161)

IPv4 address space is divided into five classes: A, B, C, D and E. Class of an IP address is identified by MSBs (in binary) or first byte (in decimal).

Class Binary Decimal Addressing Application

A 0 0–127 Unicast WAN

B 10 128–191 Unicast Campus Network

C 110 192–223 Unicast LAN

D 1110 224–239 Multicast

E 1111 240–255 Reserved

Classes A, B and C are used for unicast addressing.

Class D was designed for multicasting and class E is reserved.

Classes A, B, C have certain bits for network part and rest for host part i.e., networks

Page 26: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 25

belonging to a class and number of hosts attached to it are limited

o Class A—up to 126 networks and 16 million hosts per network

o Class B—up to 214 networks and 65,534 hosts per network

o Class C—up to 221 networks and 254 hosts per network

Class A Class B Class C Datagram Forwarding

Routers maintain forwarding table which is a list of (NetworkNum, NextHop) pairs. It

uses destination address to lookup in the table to forward packets. 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

Deliver packet to NextHop router else

Deliver packet to default router

Example Suppose H5 sends a datagram to H8, then forwarding is as follows:

H5 sends datagram to its default router R1, since it cannot deliver directly.

R1 sends datagram to its default router R2, since none of its interface matches H8.

R2 forwards the datagram to R3 based on its forwarding table (NextHop).

R3 forwards the datagram directly to H8, since both are on the same network.

Page 27: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 26

NetworkNum NextHop 1 R1 4 R3

R2 Forwarding Table

Fragmentation If the datagram payload is greater than MTU, then it is fragmented by the router to fit the

link-layer frame. If D flag bit is set, then datagram is not fragmented and discarded. When the router fragments a datagram, fields affected are:

Copies Ident field contents onto all fragments.

o Sets M bit for all fragments, except the last one.

o Offset field contains 8-byte count (0 for the first fragment) Sets Length equal to number of bytes in the fragment (equal to MTU except last)

Reassembling is done by the destination host using Ident field. Example

Suppose host H5 sends a datagram to host H8 with a payload of 1400 bytes.

Datagram goes through WLAN and Ethernet network without any fragmentation.

Next it goes through point-to-point link that has MTU of 512 bytes. Datagram has to be fragmented at R2, each with a maximum payload of 512 bytes.

o Ident field value x is copied onto all fragments.

2. First fragment has Offset = 0, M = 1 and Length = 512. o Second fragment has Offset = 64 (64 × 8 = 512), M = 1 and Length = 512. o

Third fragment has Offset = 128 (128 × 8 = 1024), M = 0 and Length = 376. 3 fragments are forwarded by router R3 through Ethernet to the destination host.

First Fragment Second Fragment Last Fragment Drawback of class-based addressing in IPv4

In c1assful addressing, a large part of the available addresses were wasted, since Class A

and B were too large for most organizations.

Class C is suited only for small organization and therefore class B was opted.

Page 28: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 27

Reserved addresses were sparingly used. Parts of an IP address

IP addresses consist of two parts, network id and host id. Eg. 172.16.13.222

Network id identifies physical network to which the host is attached.

Hosts attached to a network have the same network id (172.16).

Host id is used to uniquely identify a host on that network (13.222).

Significance of TTL field. TTL means time-to-live. It specifies lifetime of a packet with default 64 hops.

Each router decrements TTL by 1 before forwarding.

If TTL becomes 0, then datagram is discarded. It avoids looping of a packet. Use of option field in IPv4. Options in IPv4 can be specified up to 40 bytes. In such case, HLen > 5.

Record Route―used to record the routers (path) the datagram traverses.

Strict Source Route―used by the source to predetermine a route for the datagram.

Maximum Transmission Unit (or) MTU. Each physical network has Maximum Transmission Unit, i.e., largest IP datagram that can

be contained in a frame. MTU for Ethernet is 1500 bytes, for WLAN it is 2312 bytes.

Subnets Consider a large campus with a set of networks and each should be connected to Internet.

Class B addresses is sought after in anticipation of 255 or more hosts.

Available 214

Class B address space is insufficient to connect over 4 billion hosts. Subnetting Subnetting reduces network numbers required for an organization.

Each physical network is referred to as subnet and must be adjacent to each other.

All nodes on a subnet are configured with a subnet mask. For example,

255.255.255.0

Subnet number is bitwise AND of IP address and its subnet mask. For example,

IP address 128. 96. 34. 15 Subnet mask 255.255.255.128 Subnet number 128. 96. 34. 0

All nodes thus 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.

Subnets are hidden to external world and only gateway router is publicly known.

Gateway router forwards packets to the correct subnet internally.

Page 29: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 28

Routing

To support subnetting, routing table entries are (SubnetNumber, SubnetMask, NextHop).

Router performs bitwise AND of SubnetMask and destination IP address for each entry.

If it matches SubnetNumber, then packet is forwarded onto corresponding NextHop.

SubnetNumber SubnetMask NextHop

Forwarding table for Subnetted network

CIDR or Superneting. Subnetting does not prevent an organization opting for Class B. Address efficiency for

Class B can be as low as 0.39% (256 / 65535).

If Class C addresses were given instead of Class B, then routing tables gets larger.

Classless Interdomain Routing (CIDR) balances between minimize the number of routing table entries and handling addresses space efficiently.

CIDR aggregates routes, by which an entry in forwarding table is used to reach multiple networks. It collapses multiple addresses into a single supernet, i.e., supernetting.

Supernetting

Consider an organization that requires 16 Class C networks.

Instead of providing 16 addresses at random, a block of contiguous Class C address is

given. For example, from 192.4.16 to 192.4.31

Bitwise analysis show 20 MSBs (11000000 00000100 0001) are same. Thus a 20-bit

network number is created, i.e., range between Class B and C network.

Higher address efficiency is achieved by providing small chunks of address, smaller than

Class B network. Thus a single network prefix is used in forwarding table.

CIDR uses a new type of notation to represent network numbers or prefixes.

It is represented as /X, where X is the prefix length in bits. For example, 192.4.16 / 20

Addresses in a block must be contiguous and number of addresses must be powers of 2. Example

When different customers are connected to a service provider, prefixes can be assigned such that they share a common, further aggregation can be achieved.

Consider an ISP providing internet connectivity to customers.

Page 30: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 29

Since all customers are reachable through the same provider network, a single route is advertised by ISP with common (say 21-bit) prefix that all customers share.

Difference between subnetting and supernetting. Subnetting splits a classful address among multiple subnets, whereas CIDR collapses

several classful addresses into a single supernet.

Subnetting follows classful addressing whereas CIDR does away with classes.

Subnetting helps in address assignment, whereas CIDR solves addresses space inefficiency and aggregates routing table entries.

Process of determining the physical address of a host using ARP. To deliver a packet, physical address of the destination must be known.

Address Resolution Protocol (ARP) enables a source host to know the physical address of a node when the logical address is known.

ARP relies on broadcast support from physical networks such as Ethernet.

ARP enables each host to build a table of IP address and corresponding physical address. Packet Format

HardwareType―type of the physical network (e.g., 1 for ethernet).

ProtocolType―value of upper-layer protocol (e.g., 8 for IPv4).

HLen―length of the physical address in bytes (e.g., 6 for Ethernet address).

PLen―length of the logical address in bytes (e.g., 4 for IPv4 address).

Operation―ARP type (1 for Request, 2 for Response).

SourceHardwareAddr / SourceProtocolAddr―physical & logical address of the sender.

TargetHardwareAddr / TargetProtocolAddr―physical & logical address of target node.

0 8 16 31

HardwareType Protocol Type

Hlen PLen Operation SourceHardwareAddr SourceProtocolAddr

TargetHardwareAddr TargetProtocolAddr

Address Translation Host checks its ARP table. If an entry for destination does not exists, then source finds

physical address using ARP.

Source host creates a ARP Request packet with value for fields:

o Operation = 1. o TargetHardwareAddr = 0s.

ARP request is encapsulated in IP packet and broadcasted over the physical network.

All nodes except the destination discard the packet but update their ARP table.

Page 31: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 30

Destination host constructs an ARP Response packet with Operation = 2.

ARP Response is unicast and sent back to the source host.

Source stores target logical & physical address pair in its ARP table from ARP Response.

If target node does not exist on same network, ARP request is sent to default router. Define RARP. A diskless workstation or newly booted workstation does not know its IP address.

Reverse Address Resolution protocol (RARP) allows a host to find its IP address by

broadcasting RARP request.

RARP is replaced by protocols such as BOOTP and DHCP.

The automatic / dynamic configuration of IP address to hosts using DHCP Administrator can manually configure IP address, which is tedious and error-prone.

Dynamic Host Configuration Protocol (DHCP) enables auto configuration of IP address to hosts dynamically using DHCP server.

DHCP server sends and receives message using UDP over ports 67 and 68.

DHCP provides dynamic (automatic) address allocation when host connects to a network. Packet Format

Operation―specifies type of DHCP packet.

Xid―specifies the transaction id.

ciaddr―specifies client IP address in a DHCPREQUEST packet

yiaddr―your IP address filled by DHCP server in DHCPOFFER packet

siaddr―contains IP address of the DHCP server.

giaddr―contains IP address of the Gateway or relay agent.

chaddr―contains hardware (physical) address of the client.

options―contains information such as lease duration, default route, DNS server, etc.

Page 32: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 31

Dynamic Address Allocation DHCP server is configured with range of addresses to be assigned to hosts on demand.

To contact DHCP server, client broadcasts a DHCPDISCOVER message using special IP

address 255.255.255.255 with its physical address placed in chaddr field

DHCP server selects an unassigned IP address for yiaddr field and adds an entry to

dynamic database paired with client's physical address.

Server sends DHCPOFFER message containing client's IP address, lease period, etc.

Client sends a DHCPREQUEST message, requesting the offered address.

Based on transaction id, the DHCP server acknowledges with a DHCPACK message.

When lease period expires, client attempts to renew. It’s up to server to accept or reject it. DHCP relay DHCP is an application layer protocol, i.e., server/client need not be on the same network

DHCP relay receives client message, stores its address in giaddr and forwards to server.

Response from server is sent back to client through relay agent.

Error reporting using ICMP. Internet Control Message Protocol (ICMP) is used to report error messages to source

host and diagnose network problems.

ICMP forms the basis for debugging tools such as ping and traceroute. Error Reporting

Destination Unreachable―When a router cannot route a datagram, the datagram is

discarded and sends a destination unreachable message to source host.

Source Quench―When a router or host discards a datagram due to congestion, it sends a

source-quench message to the source host. This message acts as flow control.

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―Combination of echo request and reply messages determines

Page 33: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 32

whether two systems communicate or not.

Timestamp Request & Reply―Two machines can use the timestamp request and 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.

Router Advertisement―A host broadcasts a router solicitation message to know about

the router. Router broadcasts its routing information with router advertisement message.

Functioning of Token Ring Token ring was developed by IBM and later became standard IEEE 802.5

A token ring network consists of stations connected in a ring-based topology.

Data flow is unidirectional in a ring.

It is based on a small frame called token that circulates around the ring.

A station can transmit data only if it has a token.

In a ring topology, any link or station failure would render the whole network useless.

Therefore each station is connected to the ring using an electromechanical relay. o When the station is healthy, relay is open and the station is included in the ring. o If the station goes down, relay closes and the ring bypasses the station.

The data rate is 4 or 16 Mbps and uses differential Manchester encoding.

Twisted-pair is widely used as the physical medium.

A maximum of 250 stations can be included in the ring.

Normal operation Failure of primary ring FDDI

Fiber Distributed Data Interface (FDDI) network consists of two independent rings primary and secondary, designed to transmit data in opposite directions.

The secondary ring is used to transmit data, only if the primary fails.

Page 34: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 33

FDDI network is fault tolerant to a single link or station failure.

It is a 100-Mbps network.

At most 500 stations can exist with a maximum distance of 2 km between stations.

4B/5B encoding is used.

Network is limited up to 200 km of fiber.

Fiber-optic cable is mostly used as the physical medium in FDDI.

Page 35: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 34

UNIT-III ROUTING

Routing (RIP, OSPF, metrics) - Switch basics - Global Internet (Areas, BGP, IPv6),

Multicast - addresses -multicast routing (DVMRP, PIM)

Distance vector routing (DVRP) (or) routing information protocol (or)

bellman-ford algorithm Each node knows the distance (cost) to each of its directly connected neighbors.

Nodes construct a vector (Destination, Cost,NextHop) and distributes it to neighbors.

Nodes compute routing table of minimum distance to every other node via NextHop

using information obtained from its neighbors.

Initial State

In the given example network, cost of each link is assumed to be 1 hop.

Each node sets a distance of 1 (hop) to its immediate neighbor and cost to itself as 0.

Distance for non-neighbors is marked as unreachable with value ∞ (infinity).

Destination Cost NextHop Destination Cost NextHop Destination Cost NextHop

A 0 A A 1 A A 1 A

B 1 B B 1 B B ∞ ―

C 1 C C 0 C C ∞ ―

D ∞ — D 1 D D ∞ ―

E 1 E E ∞ ― E ∞ ―

F 1 F F ∞ ― F 0 F

G ∞ ― G ∞ ― G 1 G

Node A's initial vector Node C's initial vector Node F's initial vector

For nodeA, nodesB,C,EandFarereachable, whereasDandGareunreachable.

Sharing & Updation

Each node exchanges its routing table with neighbors periodically i.e., every 30 seconds.

Node A sends its table to nodes B, C, E & F and receives tables from nodes B, C, E & F. Each node updates its routing table by comparing with each of its neighbor's table

For each destination, Total Cost is computed as:

TotalCost = Cost (Node to Neighbor) + Cost (Neighbor to Destination) IfTotalCost<Costthen

Page 36: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 35

Cost = TotalCost and NextHop = Neighbor NodeA learnsfromC's table to reach nodeDand fromF's table to reach nodeG.

p Total Cost to reach node D via C = Cost (A to C) + Cost(C to D) = 1 + 1 = 2.

Since 2 < ∞, entry for destination D in A's table is changed to (D, 2, C) Total Cost to reach node G via F = Cost(A to F) + Cost(F to G) = 1 + 1 = 2

Since 2 < ∞, entry for destination G in A's table is changed to (G, 2, F) Each node builds complete routing table after few exchanges amongst its neighbors.

Destination Cost NextHop

A 0 A

B 1 B

C 1 C

D 2 C

E 1 E

F 1 F

G 2 F

Node A's final routing table

Global View Distance vector routing is distributed, i.e., algorithm is run on all nodes.

System stabilizes when all nodes have complete routing information, i.e., convergence.

A B C D E F G

A 0 1 1 2 1 1 2

B 1 0 1 2 2 2 3

C 1 1 0 1 2 2 2

D 2 2 1 0 3 2 1

E 1 2 2 3 0 2 3

F 1 2 2 2 2 0 1

G 2 3 2 1 3 1 0 Routing Information Protocol (RIP) RIP is an intra-domain routing protocol based on distance-vector algorithm.

Routers advertise the cost of reaching networks. Cost of reaching each link is 1 hop.

Infinity is defined as 16, i.e., any route cannot have more than 15 hops. Therefore RIP

can be implemented on small-sized networks only.

RIP2 (version 2) packet format contains (network address, distance) pairs.

Page 37: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 36

Link state routing (or) OSPF protocol (or) shortest path (or) Dijkstra’s

algorithm. Each node knows state of link to its neighbors and cost.

Nodes create an update packet called link-state packet (LSP) that

contains: o ID of the node

o List of neighbors for that node and associated cost

o 64-bit Sequence number

o Time to live

Link-state routing relies on two mechanisms:

o Reliable flooding−dissemination of LSP to all other nodes o Forward Search algorithm−Route calculation from accumulated LSPs.

Reliable Flooding Each node generates its LSP periodically (in hours) and floods it on each of its links.

Transmission of LSPs between adjacent routers is acknowledged.

When a node receives a LSP of another node, it is stored and forwarded on all other links except the incoming one.

Thus LSP of a node eventually reaches all nodes, i.e., reliable flooding. Forward Search (Dijkstra’s) algorithm Nodes maintain Tentative and Confirmed list with entries (Destination, Cost, NextHop)

Each node builds routing table using forward search algorithm as follows: 8. Initialize the Confirmed list with an entry for the Node (Cost = 0).

9. Node just added to Confirmed list is called Next. Its LSP is examined. 10. For each neighbor of Next, calculate cost to reach each neighbor:

Cost (Node to Next) + Cost (NexttoNeighbor). 11. If Neighbor is not in any list, then add (Neighbor, Cost, NextHop) to Tentative list. 12. If Neighbor is in Tentative list, then retain entry with the least cost.

Page 38: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 37

13. If Tentative list is empty then Stop, 14. Move least cost entry from Tentative list to Confirmed list. Go to Step 2.

Step Confirmed Tentative Comment

1 (D,0, –) D is moved to Confirmed list initially

2 (D,0, –) (B,11,B) Based on D's LSP, its immediate neighbors B and C are

(C,2,C) added to Tentative list

3 (D,0, –) (B,11,B) Lowest cost entry C in Tentative list is moved to Confirmed

(C,2,C) list. C's LSP is to be examined next.

4 (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

5 (D,0, –) (A,12,C) Lowest cost entry B is moved to Confirmed list. B's LSP is

(C,2,C) examined next.

(B,5,C)

Page 39: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 38

Step Confirmed Tentative

6 (D,0, –) (A,10,C) (C,2,C)

(B,5,C)

7 (D,0, –)

(C,2,C)

(B,5,C)

(A,10,C)

Comment Since A could be reached through B at a lower cost than the

existing one, the Tentative list entry (A, 12, C) is replaced to

(A, 10, C) Node A is moved to Confirmed list. Process completed,

since tentative list has no entries.

Page 40: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 39

Open Shortest Path First Protocol (OSPF) OSPF is a non-proprietary link-state routing protocol.

Routing updates are authenticated to avoid malicious nodes from providing false

costs.

Domain is partitioned into areas, i.e., OSPF is more scalable.

Traffic is evenly distributed by assigning uniform cost to various routes to a

destination

Version―represents the current version, i.e., 2. Type―represents the type (1–5) of OSPF message.

SourceAddr―identifies the sender

AreaId―32-bit identifier of the area in which the node is located

Checksum―16-bit internet checksum

Authentication type―1 (simple password), 2 (cryptographic authentication). Authentication―contains password or cryptographic checksum

How is overhead due to flooding of LSPs reduced? LSP flooding creates traffic and overhead for the network.

Timer―using long timers (in hours) for periodic generation of LSPs.

Flooding is done only when necessary, i.e., due to topological changes.

The steps in link state routing to ensure that recent information is flooded. Sequence number―Highest sequence numbers indicate latest LSP for a node.

Time to live―When TTL reaches 0, nodes delete the stored LSP.

The packet format for Link State Advertisement

LS Age―is incremented at each node until it reaches a maximum

Type―defines type of LSA. Type1 LSAs advertise the cost of links between

routers.

Link-state ID―32-bit identifier that identifies the router. LS sequence number―used to detect old or duplicate packets

Page 41: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 40

LS checksum―covers all fields except LSAge Length―length of the LSA in bytes

Link ID and Link Data―identify a link

Metric―specifies cost of the link.

LinkType―specifies type of link (for example, point-to-point)

TOS―allows OSPF to choose different routes based on the value in TOS field

Multicast Routing To support multicasting, routers additionally build multicast forwarding tables.

Multicast forwarding table is a tree structure, known as multicast distribution

trees.

Internet multicast is implemented on physical networks that support

broadcasting.

Major multicast routing protocols are:

Distance-Vector Multicast Routing Protocol (DVMRP)

Protocol Independent Multicast Sparse Mode (PIM-SM)

Interdomain Multicast (MSDP) Bidirectional Trees (BIDR-PIM)

Distance vector multicast routing protocol (DVMRP).

Each router maintains (Destination, Cost, NextHop) for all destination.

Multicasting is added to distance-vector routing in two stages. 1. Reverse Path Broadcast floods packets to all networks 2. Reverse Path Multicasting prunes end networks that do not have hosts

belonging to a multicast group. DVMRP is known as flood-and-prune protocol. Routing is expensive and not

scalable

Reverse-Path Broadcasting

Router on receiving a multicast packet from source S to a Destination through

NextHop, forwards the packet on all other links, since it comes from the shortest

path.

Page 42: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 41

Packet is flooded but not looped back to S. The drawbacks are:

1. It floods a network, even if there are no members for that group.

2. Packets are forwarded by each router connected to a LAN, i.e., duplicate

flooding

Duplicate flooding is avoided as follows:

1. Router that has the shortest path to source S, is selected as parent router. 2. Only parent router forwards multicast packets from source S to that

LAN.

Thus shortest path to source (reverse) is considered for forwarding decisions.

Reverse-Path Multicasting Multicasting is achieved by pruning networks that do not have members for a

group G.

Step 1: Identify a leaf network which has only one router. o 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. o Router thus decides whether or not to forward group G packets over that

LAN. Step 2: Propagate "no members of G here" up the shortest path tree.

o Routers augments (Destination, Cost) pairs with set of groups for which

the leaf network is interested in receiving multicast packets.

o Information is propagated amongst routers so that a router knows for what groups it should forward on each of its links.

Protocol independent multicast sparse mode (PIM - SM) using an example. PIM sparse mode is not based on any unicast routing protocol, i.e., protocol

independent.

Routers participate in multicasting by sending Join messages.

A router is designated as rendezvous point (RP) for each group to receive messages.

Multicast forwarding tree is built as a result of routers sending Join messages to

RP.

Tree is either shared by senders or it may be source-specific to a sender.

Shared Tree

When a router sends Join message to RP for group G, it is wild carded, i.e., all

senders.

Each router along the path creates an entry (*, G) in its forwarding table for shared tree.

Interface on which the Join arrived is marked to forward packets for group G.

Forwards Join towards RP.

Finally it reaches RP. Thus a shared tree with RP as root is formed.

Example Router R4 sends Join message for group G to RP.

R2 receives Join message and makes an entry (*, G) in its table and forwards it

to RP.

When R5 sends Join message for group G, R2 does not forwards the Join. It

Page 43: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 42

adds an outgoing interface to the forwarding table created for that group.

As routers send Join message for a group, branches are added to the tree, i.e.,

shared.

Suppose router R1, receives a message to group G.

Since R1 has no state for group G, the multicast packet is tunneled along the

way to RP.

RP decapsulates the packet and sends multicast packet onto the shared tree,

towards R2.

R2 forwards the multicast packet to routers R4 and R5 that have members for group G.

Join from R4 Join from R5 Multicast message to group G

Source-specific tree. RP can force routers to know about group G, by sending Join message to avoid

tunneling.

Routers between RP and sender host 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 (say R4) to group G, then shared-tree is replaced by source-specific tree with sender as root.

Example

Source-specific Join from RP Routers switch to Source tree

PIM Source-Specific Multicast (PIM-SSM). Hosts specify both group and source in an IGMP membership Report message

Page 44: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 43

to router.

Router then sends a PIM-SM source-specific Join message toward the source.

Since the tree is source-specific, only the designated source can send packets on that tree.

Interdomain Multicast (MSDP) PIM-SM protocol is used only within a domain, but not between domains.

Multicast Source Discovery Protocol (MSDP) is used to extend multicast across domains by connecting RPs of different domains.

Page 45: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 44

UNIT-IV TRANSPORT LAYER

Overview of Transport layer - UDP - Reliable byte stream (TCP) - Connection

management - Flow control - Retransmission - TCP Congestion control -

Congestion avoidance (DECbit, RED) - QoS – Application requirements

UDP User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol. Adds process-to-process communication to best-effort service provided by IP. Simple demultiplexer allows multiple processes on each host to communicate. Does not provide flow control / reliable / ordered delivery.

UDP is suitable for a process that requires simple request-response communication with little concern for error control.

UDP Header UDP packets are known as user datagram. It has a 8-byte header.

SrcPort and DstPort—Source and destination port number.

Length—total length of the user datagram, i.e., header plus data. Checksum—computed over UDP header, data and pseudo header. Pseudo header

consists of IP fields (Protocol, SourceAddr, DestinationAddr) and UDP Length field. Ports Processes (server/client) are identified by an abstract locator known as port.

Server accepts message at well known port. Some well-known UDP ports are 7–

Echo, 53 (DNS), 111 (RPC), 161(SNMP), etc.

< port, host > pair is used as key for demultiplexing. Ports are implemented as a message queue.

o When a message arrives, UDP appends it to end of the queue. o When queue is full, the message is discarded. o When a message is read, it is removed from the queue.

Page 46: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 45

Applications Used for management processes such as SNMP. Used for route updating protocols such as RIP. It is a suitable transport protocol for multicasting. UDP is suitable for a process with internal flow and error control such as TFTP

Features of TCP and TCP segment format Transmission Control Protocol (TCP) is a connection-oriented, byte-stream service. TCP is a full-duplex protocol and provides process-to-process communication. Guarantees reliable, in-order delivery of message. Has built-in congestion-control mechanism. Ensures flow control, as sliding window forms heart of TCP operation.

Some well-known TCP ports are 21 (FTP), 25(SMTP), 80(HTTP), 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.

TCP’s demux key is < SrcPort, SrcIPAddr, DstPort, DstIPAddr >

Segment Format Data unit exchanged between TCP peers are calledsegments.

SrcPort and DstPort―port number of source and destination process.

SequenceNum―contains. first byte number of the data segment.

Acknowledgment― byte number of segment, the receiver expects next. HdrLen― length of TCP header as 4-byte word.

Flags―contains six control bits. o URG—segment contains urgent data. o ACK—value of acknowledgment field is valid.

o PUSH—sender has invoked the push operation.

o RESET—receiver wants to abort the connection. o SYN—synchronize sequence numbers during connection

establishment.

o FIN—terminates the TCP connection.

AdvertisedWindow―defines receiver’s window size and acts as flow control.

Checksum―It is computed over TCP header, Data, and pseudo header containing

IP fields (Length, SourceAddr & DestinationAddr).

Page 47: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 46

UrgPtr―specifies first byte of normal data contained in the segment, if URG bit is set.

TCP connection management (or) TCP architecture (or) working of

TCP protocol Client performs an active connection to establish connection with a passive

open server, prior to data communication Finally connection is terminated after data transmission.

Connection Establishment Connection establishment in TCP is athree-way handshaking.

Client sends a SYN segment to the server containing its initial sequence number (Flags =SYN, SequenceNum= x)

Server responds with a segment that acknowledges client’s segment and specifies its

initial sequence number (Flags = SYN+ACK,Ack = x + 1 SequenceNum = y).

Finally, client responds with a segment that acknowledges server’s sequence number (Flags = ACK, Ack = y + 1).

Connection Termination Connection termination is normally done using a three-way close.

o Client sends a FIN segment to the server for connection termination.

o Server responds with FIN + ACK segment to inform its closing.

o Finally, client sends an ACK segment. Resources provided for the connection are released.

State Transition Diagram States involved in opening and closing a connection is shown above and below the

ESTABLISHED state.

Sate transition occurs either due to arrival of a segment or when an TCP operation is invoked by the application.

Operation of sliding window is hidden in the ESTABLISHED state. Opening

Server invokes a passive open on TCP, which causes TCP to move to LISTEN state. Client does an active open, which causes its TCP to send a SYN segment to the

server and move to SYN_SENT state.

When SYN segment arrives at the server, it moves to SYN_RCVD state and responds

with a SYN + ACK segment. Arrival of SYN + ACK segment causes the client to move to ESTABLISHED state and

sends an ACK to the server.

Page 48: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 47

Closing Client / Server can close the connection independently or simultaneously.

Transitions from ESTABLISHED to CLOSED state are:

One side closes: ESTABLISHED→FIN_WAIT_1→FIN_WAIT_2→TIME_WAIT→CLOSED

Other side closes: ESTABLISHED → CLOSE_WAIT → LAST_ACK → CLOSED

Simultaneous close: ESTABLISHED→FIN_WAIT_1→CLOSING→TIME_WAIT→ CLOSED Half-way close in TCP connection Half-Close—Client stops sending but receives data. This is known as half-

close. o Client half-closes the connection by sending a FIN segment.

o Server sends an ACK segment. Data transfer from client to the server stops.

o After sending all data, server sends FIN segment to client, which is acknowledged by the client.

Urgent data delivered in TCP A process may send urgent data. For example, abort a process by Ctrl+C keystroke.

Sending TCP inserts the urgent data at beginning of the segment and sets URG flag.

When TCP receives a segment with URG bit set, it delivers urgent data out of order to the receiving application.

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.

Page 49: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 48

TCP flow control (or) adaptive flow control (or) TCP Sliding window TCP uses a variant of sliding window known as adaptive flow control

that:o guarantees reliable and ordered delivery of data to receiver o enforces flow control at the sender

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 send buffer which contains three segments: 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

and data in correct order but still not read by the application.

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 ofsendandreceivebuffer isMaxSendBufferandMaxRcvBufferrespectively. Sending TCP prevents overflowing of send buffer by maintaining

LastByteWritten − LastByteAcked ≤ MaxSendBuffer

Receiving TCP avoids overflowing its receive buffer by maintaining

LastByteRcvd − LastByteRead≤ MaxRcvBuffer

Page 50: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 49

Receiver throttles the sender by having AdvertisedWindow based on its free space.

AdvertisedWindow = MaxRcvBuffer − ((NextByteExpected − 1) − LastByteRead)

Sending TCP adheres to AdvertisedWindow by computing EffectiveWindow that limits how much data it should send.

EffectiveWindow = AdvertisedWindow − (LastByteSent − LastByteAcked) Fast Sender vs Slow Receiver If data is read as fast as it arrives then AdvertisedWindow = MaxRcvBuffer

As data arrives, LastByteRcvd moves to its right and AdvertisedWindow shrinks.

If sender transmits at a higher rate, receiver's buffer gets filled up fastly. Hence,

AdvertisedWindow is slowly reduced to 0. When receiver advertises a window of size 0, sender cannot transmit i.e., blocked.

AdvertisedWindow expands when bytes have arrived in order and read by the application.

When an acknowledgement arrives for x bytes, LastByteAcked is incremented by x. Thus send buffer space is freed accordingly to send further data.

Explain adaptive retransmission algorithms. (or) How is timeout estimated in TCP? TCP ensures reliability through retransmission, if ACK does not arrive before timeout

Timeout is based on RTT, but it is highly variable for any two hosts on the internet.

Smaller timeout leads to unnecessary retransmission. Hence appropriate timeout is chosen using adaptive retransmission.

Original Algorithm SampleRTT is the duration between sending a segment and arrival of its ACK. EstimatedRTT is weighted average of previous estimate and current sample.

EstimatedRTT = α × EstimatedRTT + (1 − α)× SampleRTT (where α is known as smoothening factor, such that 0.8 ≤ α ≤ 0.9)

Timeout is determined as twice the value of EstimatedRTT .

TimeOut = 2 × EstimatedRTT

In original TCP, timeout is thus computed as function of running average of RTT. Karn / Partridge Algorithm Flaw discovered in TCP original algorithm was that an ACK segment,

acknowledges receipt of data, not a transmission.

Large SampleRTT Small SampleRTT

Page 51: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 50

When an ACK arrives after retransmission, it is impossible to decide, whether to pair

it with original or retransmitted segment.

o If ACK is associated with original one, then SampleRTT becomes too large

o If ACK is associated with retransmission, then SampleRTT becomes too small

Karn and Partridge proposed that: p SampleRTT should be taken for segments that are sent only once, i.e,

segments that are retransmitted should not be considered. Each time TCP retransmits, timeout is doubled, since loss of segments is

mostly due to congestion. Jacobson / Karels Algorithm Jacobson and Karel discovered that problem with original algorithm was variance in

SampleRTT was not considered. The computations are: Difference=SampleRTT EstimatedRTT=EstimatedRTT + (δ× Difference)

Deviation=Deviation + δ (|Difference| (where 0 ≤ δ ≤ 1)

TimeOutis computed as a function of bothEstimatedRTTandDeviationas: TimeOut = μ× EstimatedRTT +φ× Deviation (where μ = 1 and φ = 4)

Whenvarianceis small,TimeOutis close toEstimatedRTTand it can be trusted.

TCP congestion control mechanisms Congestion occurs if load (number of packets sent by sources) is greater than

capacity of the network / link (number of packets that can be handled).

When load exceeds capacity, queues become full and routers have to discard some packets. Hence throughput declines sharply.

TCP provides both congestion control and avoidance mechanisms.

TCP learns capacity of the network after packets are dropped by routers due to

congestion. It uses ACKs as signal for sending further packets. Congestion control mechanisms are:

Additive Increase / Multiplicative Decrease (AIMD) Slow Start Fast Retransmit and Fast Recovery

Page 52: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 51

Distinguish between flow control and congestion control. Flow control prevents a fast sender from overrunning the capacity of slow receiver.

Congestion control prevents too much data from being injected into the network, thereby causing switches or links overloaded beyond its capacity.

Flow control is an end-to-end issue, whereas congestion control is interaction between hosts and network.

CongestionWindow. TCP maintains a state variable CongestionWindow for each connection. It places a

limit on how much data the sender can have in transit.

A source is not allowed to send faster neither than network nor destination host.

MaxWindow=MIN(CongestionWindow, AdvertisedWindow) EffectiveWindow

= MaxWindow − (LastByteSent − LastByteAcked)

Additive Increase / Multiplicative Decrease (AIMD) TCP source initializes CongestionWindow based on congestion level in the network.

Source increases CongestionWindow when ACKs arrive (i.e., no congestion) and decreases it when ACKs do not arrive (i.e. packets dropped due to congestion).

When an ACK arrives, CongestionWindow is incremented marginally, i.e., additive increase.

Increment = MSS × (MSS/CongestionWindow) CongestionWindow += Increment

For example, when ACK arrives for 1 packet, 2 packets are sent. When ACK for both packets arrive, 3 packets are sent and so on.

TCP interprets timeout as a sign of congestion and reduces the rate of transmission.

On timeout, source reduces its CongestionWindow by half, i.e., multiplicative decrease.

For example, if CongestionWindow = 16 packets, after timeout it is 8.

Additive Increase CongestionWindow Trace

CongestionWindow increases and decreases throughout lifetime of the connection. It results in a saw tooth pattern as shown.

AIMD decreases its CongestionWindow aggressively but increases conservatively.

Small CongestionWindow results in less probability of packets being dropped.

Slow Start

Slow start is used to increase CongestionWindow exponentially from a cold start.

Source TCP initializes CongestionWindow to one packet.

TCP doubles the number of packets sent every RTT on successful transmission.

Page 53: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 52

When ACK arrives for first packet TCP adds 1 packet to CongestionWindow and sends two packets.

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:

CongestionThreshold = CongestionWindow/ 2 CongestionWindow = 1

Slow start is repeated until CongestionWindow reaches CongestionThreshold and thereafter 1 packet per RTT.

Example Initial slow start causes increase in CongestionWindow up to 34 KB,

Congestion occurs at 0.4 seconds and packets are lost. ACK does not arrive and therefore trace of CongestionWindow becomes flat.

Timeout occurs at 2 sec: CongestionThreshold=17KB, CongestionWindow=1PKT

Slow start is done till 17KB and increases linearly thereafter till congestion.

Exponential Increase CongestionWindow Trace

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 quickly through exponential increase.

If connection goes dead while waiting for timer to expire, slow start phase is used only up to

current value of CongestionWindow.

Fast Retransmit and Fast Recovery Fast retransmit is a heuristic approach that triggers retransmission of a dropped packet sooner than

the regular timeout mechanism. It does not replace regular timeouts.

When a packet arrives out of order, receiving TCP resends the same acknowledgment (duplicate ACK) it sent last time.

When three duplicate ACK arrives at the sender, it infers that corresponding packet may be lost due to congestion and retransmits that 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.

Slow start is only used at the beginning of a connection and after regular timeout. At other times, it follows a pure AIMD pattern.

Page 54: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 53

Long periods with flat congestion window (no packets sent) are eliminated. TCP's fast retransmit can detect up to three dropped packets per window. Fast retransmit / recovery increases throughput by 20%.

Example

Duplicate ACK CongestionWindow Trace Inexample, packet3gets lost.

o Receiver sends a duplicate ACK for packet 2 when packets 4, 5 and 6 arrive. Sender receives three duplicate ACKs and retransmits packet 3. o When packet 3 is received, receiver sends cumulative ACK up to packet 6.

In example trace, slow start is used at beginning and during timeout at 2 sec. o Fast recovery replaces slow start from 3.8 to 4 sec with additive increase.

TCP congestion avoidance algorithms. Congestion avoidance mechanisms prevent congestion before it actually occurs. Congestion-avoidance mechanisms are:

o DECbit o Random Early Detection (RED) o Source-based congestion avoidance

DECbit Each router monitors its load and explicitly notifies the end node when congestion is likely to

occur. Source reduces its transmission rate and congestion is avoided. A binary congestion bit called DECbit is added to the packet header.

Router sets DEC bit in packets that flow through, if its average queue length is 1.

Average queue length is measured dividing the curve area over time interval that includes last busy + last idle cycle + current busy cycle.

Page 55: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 54

Destination host copies the DECbit onto ACK and sends it back to the source.

Source checks how many ACK has DECbit set for the packets sent. 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%. Random Early Detection (RED) Router monitors its queue length. It drops a few packets if congestion is likely to occur, rather

than later due to congestion. Average queue length is computed as a weighted running average:

AvgLen = (1 − Weight) × AvgLen + Weight × SampleLen (where

0 < Weight < 1)

Queue length thresholds defined by RED are MinThreshold and MaxThreshold. When a

packet arrives, router compares AvgLen with these thresholds as follows:

if AvgLen≤ MinThreshold Queuethe

packet

if MinThreshold < AvgLen < MaxThreshold Calculateprobability P

Dropthe arriving packet with probability P

ifAvgLen≥MaxThreshold Dropthe arriving packet

If AvgLen is within MinThreshold, packets are queued. If it exceeds MaxThreshold, router

operates in tail drop mode, i.e., all packets are dropped.

When AvgLen is between thresholds, packets are dropped randomly based on drop probability.

Drop probability P is computed as a function of AvgLen. P=MaxP × (AvgLen − MinThreshold) /(MaxThreshold − MinThreshold)

Drop probability increases slowly when AvgLen is between thresholds. On reaching

MaxP, it jumps to unity.

RED Thresholds Drop Probability function Receiver sends duplicate ACKs to the sender when packets arrive out of order.

Thus sender’s TCP reduces its CongestionWindow, which in turn limits the rate at which packets

arrive at the router. Thus, AvgLen decreases and congestion is avoided. Source-Based Congestion Avoidance (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

Page 56: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 55

refers to amount of data that source would have refrained from sending so as to not exceed the available bandwidth.

A flow’s BaseRTT is set to RTT of a packet when the flow is not congested.

Expected throughput is computed as: ExpectedRate = CongestionWindow/BaseRTT

ActualRate, i.e., sending rate for a packet is based on bytes transmitted during a RTT.

ActualRate= ByteTransmitted / SampleRTT

ExpectedRate and ActualRate are compared. Diff = ExpectedRate – ActualRate

Thresholds α and β are defined and corresponds to less data and 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 o If α < Diff < β, CongestionWindow is unchanged

Black line (actual throughput), color line (expected throughput) α and β threshold (shaded region)

When actual and expected rates vary significantly, it indicates congestion in the network. β

threshold triggers decrease in sending rate. When actual and expected rate is almost the same, there is available bandwidth that goes

wasted. α threshold triggers increase in sending rate.

Overall goal of TCP Vegas is to keep between α and β extra bytes in the network.

Page 57: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 56

UNIT-V APPLICATION LAYER

Traditional applications -Electronic Mail (SMTP, POP3, IMAP, MIME) - HTTP - Web

Services - DNS - SNMP

Architecture of an email system and its message format

An email system involves: o Message format (RFC 822) and its companion protocol (MIME)

o Message transfer protocol (SMTP)

o Mail Readers (IMAP / POP)

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.

Date when the message was transmitted. E-mail address is userid@domain where domain is hostname of the mail server.

Header is separated from the body by a blank line.

Multipurpose Internet Mail Extension (MIME) Email system was designed to send messages only in ASCII format.

o Languages such as French, Chinese, etc., are not supported.

o Image, audio and video files cannot be sent.

MIME is a protocol that converts non-ASCII data to ASCII and vice-versa. Headers defined in MIME are:

Page 58: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 57

o MIME-Version―current version, i.e., 1.1

p Content-Type―message type (text/html, image/jpeg, application/pdf, etc). If the

message contains multiple data types, then MIME type is multipart/mixed.

Content-Transfer-Encoding―message encoding scheme (default 7bit). To support encoding of binary data such as images, base64 is used.

o Content-Id―unique identifier for the message.

o Content-Description―describes type of the message body. If Content-Type is multipart/mixed, then each part has its own Content-Type and

Content-Transfer-Encoding headers. Example

MIME-Version: 1.1 Content-Type: multipart/mixed; boundary="---A1234---"

From: [email protected] To: [email protected]

Subject: Profile photo Date: Wed, 08 Mar 2017 14:00 ---A1234--- Content-Type: text/html

Content-Transfer-Encoding:

7bit PFA photo for profile ---A1234--- Content-Type: image/jpeg Content-

Transfer-Encoding: base64

Simple Mail Transfer Protocol(SMTP) Mail daemon (sendmail) is used to send email on hosts having mailbox.

Mail passes through a sequence of gateways before it reaches the recipient mail server. Each gateway stores and forwards the mail using Simple mail transfer protocol (SMTP).

SMTP defines communication between MTAs over TCP on port 25.

In an SMTP session, sending MTA is client and receiver is server. In each exchange, client posts a command and server responds with a code and explanation.

Some commands and its description are:

Page 59: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 58

Command Description

HELO Sender's host name

MAIL FROM Sender of the message

RCPTTO Recipient of the message

DATA Body of the mail

QUIT Terminate

Few response codes and its description are:

Code Description

221 Closing connection

250 Request completed

354 Start mail input

452 Insufficient storage

550 Mailbox not available Example Client is identified using HELO command and verified by the server

After a set of exchanges, body is sent after DATA command.

Message is terminated by a line with only single period (.) in it.

Eventually client terminates the connection.

HELO princeton.edu

250 Hello

MAIL FROM:

<[email protected]> 250 OK

RCPT TO:

<[email protected]> 250 OK

DATA

354 Start mail input

See u at conference

.

250 OK

QUIT

221 Closing connection Mail readers Mail readers or Message Access Agent (MAA) allows user to retrieve messages in the

mailbox from a remote host, so that user can perform actions such as reply, forward, etc.

Two major access protocols are:

Post Office Protocol (POP3)

Internet Message Access Protocol (IMAP4)

Page 60: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 59

Internet Message Access Protocol (or) IMAP. IMAP is a client/server protocol running over TCP on port 143. Current version is 4.

Client authenticates itself in order to access the mailbox. Server responds with a greeting.

LOGIN, AUTHENTICATE, SELECT, EXAMINE, CLOSE, LOGOUT, FETCH, STORE, DELETE, etc., are some commands issued by the client.

Server responses are OK, NO (no permission), BAD (incorrect command), etc.

When user wishes to FETCH a message, server responds in MIME format.

Message attributes such as size are also exchanged.

Flags (Seen, Answered, Deleted, Recent) enable client and server to be synchronized.

For example, when user expunges all deleted message, client issues EXPUNGE

command and server removes previous deleted mails from mailbox.

Connection without preauthentication (OK greeting)

Preauthenticated connection (PREAUTH greeting)

Rejected connection (BYE greeting)

Successful LOGIN or AUTHENTICATE command

(5) Successful SELECT or EXAMINE command

(6) CLOSE command, or failed SELECT / EXAMINE command

(7) LOGOUT command, server shutdown, or connection

closed

Final delivery of email to the end user using Post Office Protocol (or) POP3. POP is simple and limited in functionality. Current version is POP3.

POP client is installed on the recipient computer and POP server on the mail server.

Client opens a connection to the server using TCP on port 110.

Client sends username and password to access mailbox and to retrieve messages. POP works in two modes namely, delete and keep mode.

o In delete mode, mail is deleted from the mailbox after retrieval

In keep mode, mail after reading is kept in mailbox for later retrieval.

Page 61: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 60

List the advantages of IMAP over POP. IMAP is more powerful and more complex than POP.

o User can check the e-mail header prior to downloading.

o User can search e-mail for a specific string of characters prior to downloading.

o User can download partially, very useful in case of limited bandwidth.

o User can create, delete, or rename mailboxes on the mail server.

The functions of an user agent. User agent (UA) is software (eg. Microsoft Outlook, Netscape) that

facilitates:o Compose―create message by providing template with built-in editor. o Read―read mail and provide sender, subject, flag (read, new) information.

o Reply―allows user to reply (send message) back to sender

o Forward― facilitates forwarding message to a third party.

o Mailboxes―two mailboxes for each user namely inbox and outbox.

Hypertext Hypertext is a text that contains embedded URL known as links.

When hypertext is clicked, browser opens a new connection, retrieves file from the server and displays the file.

World Wide Web (or) HTTP protocol or URL WWW is a distributed client/server service, in which a client (Browsers such as IE,

Firefox, etc.) can access services at a server (Web server such as IIS, Apache).

HyperText Transfer Protocol (HTTP) is a stateless request/response protocol that governs

client/server communication using TCP on port 80.

Page 62: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 61

Uniform Resource Locator (URL) provides information about its location on the

Web http://www.domainname/filename

When user enters URL, browser forms a request message and sends it to the server.

Web server retrieves the requested URL and sends back a response message.

Web browser renders the response in HTML or appropriate format.

Request Message Request message consists of Request line, Request header and body (optional). Header

and body is separated by a blank line. General form is:

Request Line

Request Header

Body (optional) Request Line

Request line contains three fields:

Request type URL HTTP version

HTTP version specifies current version of the protocol i.e., 1.1

Request typespecifies methods that operate on the URL. Some are:

Request Type Description

GET Retrieve the URL filename

HEAD Retrieve meta-information about the URL filename

PUT Store document under specified URL

TRACE Loopback request message.

DELETE Delete specified URL

CONNECT Used by proxies

Page 63: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 62

Request Header Headers defined for request message include:

Request Header Authorization Host If-modified-since User-agent

Description specifies what permissions the client has host name of the server server sends the URL if it is newer than specified date name of the browser

For example, request message to retrieve file result.php on host annauniv.edu is:

GET result.php HTTP/1.1

Host: www.annauniv.edu Response Message Response message consists of Status line, Response header and body. Header and body

is separated by a blank line. General form is:

Status Line

Response Header

Body Status Line

Status line contains three fields:

HTTP version Status code Status phrase 3-digit status code classifies HTTP result based on leading digit (1xx–Informational, 2xx–

Success, 3xx–Redirection, 4xx–Client error and 5xx–Server 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

301 Moved permanently Requested URL is no longer in use

404 Not found Document not found

500 Internal server error An error such as a crash, at the server site

Page 64: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 63

For example, response for a moved page is:

HTTP/1.1 301 Moved Permanently

Location: http://www.princeton.edu/cs/download.html TCP Connection HTTP 1.1 uses persistent connection, i.e., client and server exchange multiple files over a

single 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. o Server closes the connection on timeout. Caching Caching enables the client to retrieve document faster and reduces load on the server.

Caching is implemented at Proxy server, ISP router and Browser.

Server sets expiration date (Expires header) for each page, beyond which it is not cached.

Cached document is used only if it is an updated copy by checking against If-Modified-Since header. If cache is out-of-date, then request is forwarded to the server.

A web page will not be cached if no-cache directive is specified.

Web Services Web services are architectures that offer remotely accessible services for client

applications to form network applications, such as business-to-business (B2B) and

enterprise application integration (EAI). For example, application at Amazon.com tracks shipping of a book order by interacting

with application from Fedex.com

Two web services architectures are

WSDL / SOAP (custom application protocols)

REST (generic application protocol)

Web Service Description Language (WSDL) WSDL is a XML-based framework for specify and implementing application protocols.

WSDL is an operation model, i.e., web interface consists of operations that represent

interaction between client and the web service.

Each operation specifies a message exchange pattern (MEP) that provides the sequence

of message flow. Commonly used MEPs are In-Only (message from client to service) and

In-Out (request from a client and reply from the service).

Message formats are defined as an abstract data model using XML Schema. WSDL’s concrete part specifies how MEPs are mapped onto, known as binding.

WSDL specification of a web service contains multiple WSDL documents. Documents are modular, i.e., may be part of more than one web service.

Each WSDL document specifies URI of the target XML namespace.

A document can incorporate components of another document by: o including the second document if both share the same target

namespace o importing it if the target namespaces differ.

Page 65: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 64

SOAP SOAP provides a simple messaging framework whose core functionality is concerned

with providing extensibility.

SOAP is used to define transport protocols with features required to support a particular application protocol.

A SOAP feature specification includes: o URI that identifies the feature o State information required for implementation o Information to be relayed to the next node

Life cycle and relationships of the messages exchanged SOAP can be binded to HTTP to derive request / response feature. This is called layering

A SOAP message consists of an envelope, which contains a header composed of header

blocks, and body.

Header block encapsulates header information that corresponds to a SOAP

feature.

SOAP message is processed by nodes based on SOAP role. For example, role

next implies all nodes process, whereas for role ultimateReceiver only receiver can

process

A SOAP fault is generated if a node does not understand the blocks it should process.

A SOAP module is a specification of syntax and semantics of one or more header blocks.

It also specifies any known interaction with other SOAP modules.

REpresentational State Transfer (REST) REST web service architecture is based on re-applying the model underlying the WWW

architecture. It treats individual web services as WWW resources, accessed via HTTP.

REST uses HTTP methods such as GET and POST to provide interface for web services.

In REST model, complexity is shifted from protocol to the payload.

Payload is a representation of the abstract state of a resource. For example, GET returns a

representation of current state of the resource.

Message size is reduced by transmitting parts of a state that are or interest, passed by reference or URI.

XML and JSON are used as presentation language to define document structure.

REST uses infrastructure deployed to support the Web. For example, proxies can enforce security or cache mechanism.

Evolvability must be considered while designing REST state representations.

Page 66: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 65

Compare WSDL / SOAP 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, whereas in REST there is no interoperability problem.

Interface of legacy applications easily map onto WSDL operations than REST states.

Profile A profile is a set of guidelines that narrow choices in standards like WSDL, SOAP, etc.

For example WS-I Basic Profile requires WSDL be bound exclusively to 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.

Role of DNS on a computer network (or) domain name resolution process Domain Naming System (DNS) maps user-friendly domain names to router-friendly IP

address, i.e., middle-ware. It includes:

o namespace to define domain names without any

collision o binds domain names to IP address

o name server to lookup IP address for a given name. Domain Hierarchy DNS implements hierarchical name space for domains in the Internet.

Domain 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. Each country has

a TLD, fr (France) in (India), etc.

Domain is partitioned into zones. Each zone acts as central authority for that part of the

sub-tree. For example, in edu domain, princeton is a zone. Zones can be furthersub-divided.For example,csdepartment underprincetonuniversity

Page 67: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 66

Name Servers DNS is implemented through one or more Name Servers (NS).

Name servers contain resource records that binds name-to-value.

Name servers receive query for a domain name and returns a record with best match.

Resource record is a 5-tuple with fields <Name, Value, Type, Class, TTL>

o Name—specifies the domain/zone name.

Type—indicates what kind of record it is. Commonly used types are: NS―Value field contains address of a name server

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. 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:

princeton.edu, dns.princeton.edu, NS, IN > dns.princeton.edu, 128.112.129.15, A, IN >

… Zone name server may contain records for hosts and/or records for sub-zones.

Resource record for princeton.edu zone looks like:

< cs.princeton.edu, dns1.cs.princeton.edu, NS, IN > < dns1.cs.princeton.edu, 128.112.136.10, A, IN > …

Third-level name servercs.princeton.educontainsArecords for all hosts on that network.

< penguins.cs.princeton.edu, 128.112.155.166, A, IN >

Page 68: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 67

Name Resolution

Client sends query for penguins.cs.princeton.edu to local name server in an UDP packet.

Local NS forwards the query to the root server if it has no A record for client’s query. Root server finds no exact match. Best match is NS record for edu that points to server

a3.nstld.com. Therefore A record for a3.nstld.com is returned to local NS. Local NS therefore sends the query to edu nameserver. edu server returns A record for the best zone match princeton.edu Query is now sent to zonal NS princeton.edu and receives A record for cs.princeton.edu Finally local NS resends the query to cs.princeton.edu and gets the A record

(128.112.155.166) for penguins.cs.princeton.edu Local NS caches the response and sends it to the client. Client uses IP address to

communicate with the server. NIC maintains a table of name-to-address bindings called hosts.txt

Any host that joins the internet, mails its name and IP address to NIC. NIC updates

hosts.txt and mails it to all hosts.

Internet grew in the 80's, after which hosts.txt approach failed and DNS evolved.

What is the need for DNS? Host on a network is uniquely identified by its IP address. It is numeric with fixed length

Page 69: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 68

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.

DNS is required to find IP address for corresponding domain name, so that request message can be sent from the client.

9.Explain how SNMP is used to manage nodes on the network (or) network management. 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) 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)

o Management Information Base (MIB).

SMI Object Identifier SMI defines rules for naming objects using Abstract syntax notation (ASN.1).

Basic Encoding Rules (BER) encoding is used to transmit data over the network.

Object identifiers are hierarchical and use lexicographic ordering.

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)―information about the node such as name, location, etc. if (interface)―information about interfaces such as physical address, packets sent

and received on each interface, etc.

o at (address translation)―information about ARP table o ip―information about IP such as routing table, datagrams forwarded/dropped, etc 5. tcp―information related to TCP such as connection table, time-out value, number

of TCP packets sent / received, etc. o udp―information on UDP traffic such as number of UDP packets sent/received

Page 70: CS6551 COMPUTER NETWORKS · 2019-11-22 · CS6551 – Computer Networks Page 4 o The protocols are generally implemented by a combination of hardware/software. IP―The major protocol

Vel Tech High Tech Dr.Rangarajan Dr.Sakunthala Engineering College Department of Information Technology

CS6551 – Computer Networks Page 69

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. 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 an agent's table.

o SET―used by manager to set value of an agent's variable.

o RESPONSE―sent from an agent to manager that contains value of variables.

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 variable value and sends encoded value to manager.