Sei sulla pagina 1di 63

COMPUTER NETWORKS

Computer Network means a collection of autonomous computers interconnected by a single technology. Two computers are said to be interconnected if they are able to exchange information. The connection need not be via a copper wire; fiber optics, microwaves, infrared, and communication satellites can also be used. Networks come in many sizes, shapes and forms. Computer Networks Vs. Distributed Systems Computer Networks: A computer network is an interconnected collection of autonomous computers able to exchange information. A computer network usually require users to explicitly login onto one machine, explicitly submit jobs remotely, explicitly move files/data around the network. Distributed Systems: The existence of multiple autonomous computers in a computer network is transparent to the user. The operating system automatically allocates jobs to processors, moves files among various computers without explicit user intervention.

CLASSIFICATION OF COMPUTER NETWORKS


1. BASED ON TRANSMISSION MODE: Broadcast networks: Use a single communication channel shared by all computers in the network Short messages (packets) are sent by any machine and received by all other computers on the network An address is used in the message to select the target machine. Most localized networks are broadcast networks. Point-to-point-networks: Consist of many connections between individual pairs of machines. A message packet may have to visit one or more intermediate machines before reaching its intended target. Routing algorithms play an important role. Most large area networks are point-to-point networks. 2. BASED ON NETWORK SCALE: Local area networks (LANS): room, building, campus Broadcast-based using a bus (Ethernet) or ring topology (Token Ring). At any instant only one machine can transmit successfully (unless switches are used to segment the network). Conflict arbitration is usually used (Ethernet) Operate at 10 Mbps (Ethernet), 100 Mbps (Fast Ethernet), 1000 Mbps (Gigabit Ethernet). Metropolitan area networks (MANS): city Uses Distributed Queue Dual Bus (DQDB) Traffic destined to the right of the computer uses the upper bus while traffic destined to the left uses the lower bus. Wide area networks (WANS): Large geographical areas Consists of hosts (machines intended to run applications). Hosts and their LANS are connected by a communication subnet which carries messages from host to host. Subnets consist of: Transmission lines (circuits, channels, trunks). Switching elements: Specialized computers used to connect two or more transmission lines. These elements are also called routers. Subnets are usually packet-switched (use point-to-point communication and routing algorithms). Each host and its associated LAN are connected to the subnet using one or more routers.

The router interconnection topology is an important issue in WAN design. A common form of internet is a collection of LANs connected by a WAN. In fact, if we were to replace the label ''subnet'' in above figure by ''WAN,'' nothing else in the figure would have to change . The only real technical distinction between a subnet and a WAN in this case is whether hosts are present. If the system within the gray area contains only routers, it is a subnet; if it contains both routers and hosts, it is a WAN. Packet-switched WAN:Generally, when a process on some host has a message to be sent to a process on some other host, the sending host first cuts the message into packets, each one bearing its number in the sequence. These packets are then injected into the network one at a time in quick succession. The packets are transported individually over the network and deposited at the receiving host, where they are reassembled into the original message and delivered to the receiving process. Routing decisions are made locally. When a packet arrives at router A, it is up to A to decide if this packet should be sent on the line to B or the line to C. How A makes that decision is called the routing algorithm. Internetworks:An internetwork is formed when distinct networks are interconnected. In our view, connecting a LAN and a WAN or connecting two LANs forms an internetwork. NETWORK TOPOLOGY Computer networks may be classified according to the network topology upon which the network is based, such as bus network, star network, ring network, mesh network, star-bus network, tree or hierarchical topology network. Network topology is the coordination by which devices in the network are arranged in their logical relations to one another, independent of physical arrangement. Even if networked computers are physically placed in a linear arrangement and are connected to a hub, the network has a star topology, rather than a bus topology. Network Software: The Protocol Hierarchy To reduce design complexity, most networks are organized as a series or hierarchy of layers. Depending on its functionality, a layer may be implemented in software, hardware or both. Layer n on one machine communicates with layer n on another machine on the network using an agreed upon protocol.

The entities comprising the corresponding layers on two communicating machines over the network are called peers. A protocol is an agreement between the communicating layers on how the communication is to proceed: A formal description of message formats and the rules the two layers must follow to exchange those messages. Protocol definitions range from how bits are placed on a wire to the format of an e-mail message. Standard protocols allow different manufacturers' computers to communicate. These computers can use completely different software/hardware, provided each computer's software can agree upon the meaning of the data. In realty, no data is transferred from layer n on any two machines. Data and control information is passed to the layer below. Additional information including protocol control information may be appended by each layer to data as it travels from higher to lower layers in the form of layer headers. Below layer 1 is the physical medium where the actual communication occurs over communication channels (copper wires, optical fibers, wireless channel etc.) Between adjacent layers an interface defines which primitive operations and services the lower layer offers to the upper layer. The set of layers and associated protocols is called a network architecture.

REFERENCE MODELS The OSI Reference Model.


The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows: 1. A layer should be created where a different abstraction is needed. 2. Each layer should perform a well-defined function. 3. The function of each layer should be chosen with an eye toward defining internationally standardized 4. The layer boundaries should be chosen to minimize the information flow across the interfaces. 5. The number of layers should be large enough that distinct functions need not be thrown together in the same layer out of necessity and small enough that the architecture does not become unwieldy.

Physical Layer:
Concerned With transmitting raw data bits. The design issues have to do with making sure that when one side sends a 1 bit, it is received by the other side as a 1 bit, not as a0 bit. Decides: - how many volts should be used to represent a 1 and how many for a 0 - whether transmission may proceed simultaneously in both directions - how the initial connection is established and how it is torn down when both sides are finished - how many pins the network connector has and what each pin is used for

Data Link Layer:


Breaks packet received from network layer into frames

Transmit the frames sequentially (If the service is reliable, the receiver confirms correct receipt of each frame by sending back an acknowledgement frame). Flow Control: how to keep a fast transmitter from drowning a slow receiver in data Some traffic regulation mechanism is often needed to let the transmitter know how much buffer space the receiver has at the moment. Access Control: how to control access to the shared channel. A special sublayer of the data link layer, the medium access control sublayer, deals with this problem. Error Control

Network Layer:
Routing: how packets are routed from source to destination. Routes can be static(fixed) or dynamic (change for every packet). Congestion Control: If too many packets are present in the subnet at the same time, they will get in one another's way, forming bottlenecks. When a packet has to travel from one network to another to get to its destination, many problems can arise. The addressing used by the second network may be different from the first one. The second one may not accept the packet at all because it is too large. The protocols may differ, and so on. It is up to the network layer to overcome all these problems to allow heterogeneous networks to be interconnected.

Transport Layer:
The basic function of the transport layer is to accept data from above, split it up into smaller units if need be, pass these to the network layer, and ensure that the pieces all arrive correctly at the other end. Type of Service: Two type of Services are provided by Transport Layer 1. An error-free point-to-point channel that delivers messages or bytes in the order in which they were sent 2. Isolated messages, with no guarantee about the order of delivery, and the broadcasting of messages to multiple destinations The transport layer is a true end-to-end layer, all the way from the source to the destination. In other words, a program on the source machine carries on a conversation with a similar program on the destination machine, using the message headers and control messages. In the lower layers, the protocols are between each machine and its immediate neighbors, and not between the ultimate source and destination machines, which may be separated by many routers. Layers 1 through 3 are chained, and layers 4 through 7 are end-to-end.

Session Layer:
Allows users on different machines to establish sessions between them. Dialog control: keeping track of whose turn it is to transmit. Token management: preventing two parties from attempting the same critical operation at the same time. Synchronization: checkpointing long transmissions to allow them to continue from where they were after a crash

Presentation Layer:
Concerned with the syntax and semantics of the information transmitted.

Application Layer
Contains a variety of protocols that are commonly needed by users. One widely-used application protocol is HTTP (HyperText Transfer Protocol), which is the basis for the World Wide Web. Other application protocols are used for file transfer, electronic mail, and network news.

Q1. Which of the following functionalities must be implemented by a transport protocol over and above the network protocol? (A) Recovery from packet losses (B) Detection of duplicate Packets (C) Packet delivery in the correct order (D) End to end Connectivity CS2003 Ans. D Explanation: Main task of transport layer is to maintain end to end connectivity for this purpose it uses port number. Recovery from packet losses, Detection of duplicate Packets and Packet delivery in the correct order is done by network layer using sequence number.

The TCP/IP Reference Model Internet Layer


permit hosts to inject packets into any network and have them travel independently to the destination (potentially on a different network) . They may even arrive in a different order than they were sent, in which case it is the job of higher layers to rearrange them, if in-order delivery is desired defines an official packet format and protocol called IP (Internet Protocol) similar in functionality to the OSI network layer.

Transport Layer
The layer above the internet layer in the TCP/IP model is now usually called the transport layer. allow peer entities on the source and destination hosts to carry on a conversation just as in the OSI transport layer Two end-to-end transport protocols - TCP (Transmission Control Protocol) : a reliable connection-oriented protocol that allows a byte stream originating on one machine to be delivered without error on any other machine in the internet - UDP (User Datagram Protocol): an unreliable, connectionless protocol. It is also widely used for one-shot, client-server-type request-reply queries and applications in which prompt delivery is more important than accurate delivery, such as transmitting speech or video.

Application Layer
TCP/IP model does not have session or presentation layers. Contains all the higher-level protocols. (FTP, SMTP. TELNET)

Host-to-Network Layer
The TCP/IP reference model does not really say much about what happens here, except to point out that the host has to connect to the network using some protocol so it can send IP packets to it. This protocol is not defined and varies from host to host and network to network.

Common basic networking devices:


Gateway: device sitting at a network node for interfacing with another network that uses different protocols. Works on session layer to application layer. Router: a specialized network device that determines the next network point to which to forward a data packet toward its destination. Unlike a gateway, it cannot interface different protocols. Works on network layer.

Bridge: a device that connects multiple network segments along the data link layer. Works on DLL. Switch: a device that allocates traffic from one network segment to certain lines (intended destination(s)) which connect the segment to another network segment. So unlike a hub a switch splits the network traffic and sends it to different destinations rather than to all systems on the network. Works on DLL. Hub: connects multiple Ethernet segments together making them act as a single segment. When using a hub, every attached device shares the same broadcast domain and the same collision domain. Therefore, only one computer connected to the hub is able to transmit at a time. Depending on the network topology, the hub provides a basic level 1 OSI model connection among the network objects (workstations, servers, etc). It provides bandwidth which is shared among all the objects, compared to switches, which provide a dedicated connection between individual nodes. Works on physical layer. Repeater: device to amplify or regenerate digital signals received while setting them from one part of a network into another. Works on physical layer.

Q2. Which of the following is NOT true with respect to a transparent bridge and a router? (a) Both bridge and router selectively forward data packets (b) A bridge uses IP addresses while a router uses MAC addresses (c) A bridge builds up its routing table by inspecting incoming packets (d) A router can connect between a LAN and a WAN

CS2004

Ans. B Explanation: A bridge use MAC addresses(DLL layer) and router uses IP addresses (network layer).

PHYSICAL LAYER
Terminologies: Bit Rate- Number of bit transferred per second. Baud rate- Number of changes in signal per second. Frequency- Cycles per Second (Hertz or Hz). Bandwidth-Bandwidth simply means how many bits can be transmitted per second in the communication channel. In technical terms it indicates the width of frequency spectrum. Types of Medium Medium can be classified into 2 categories. 1. Guided Media: Guided media means that signals is guided by the presence of physical media i.e. signals are under control and remains in the physical wire. For eg. copper wire. 2. Unguided Media: Unguided Media means that there is no physical path for the signal to propagate. Unguided media are essentially electro-magnetic waves. There is no control on flow of signal. For eg. Radio waves. Communication Links In a network nodes are connected through links. The communication through links can be classified as 1. Simplex: Communication can take place only in one direction. eg. T.V broadcasting. 2. Half-duplex: Communication can take place in one direction at a time. Suppose node A and B are connected then half-duplex communication means that at a time data can flow from A to B or from B to A but not simultaneously. eg. two persons talking to each other such that when speaks the other listens and vice versa. 3. Full-duplex: Communication can take place simultaneously in both directions. eg. A discussion in a group without discipline. Links can be further classified as 1. Point to Point: In this communication only two nodes are connected to each other. When a node sends a packet then it can be received only by the node on the other side and none else.

2.

Multipoint : It is a kind of sharing communication, in which signal can be received by all nodes. This is also called broadcast.

Generally two kind of problems are associated in transmission of signals. 1. Attenuation : When a signal transmits in a network then the quality of signal degrades as the signal travels longer distances in the wire. This is called attenuation. To improve quality of signal amplifiers are used at regular distances. 2. Noise : In a communication channel many signals transmits simultaneously, certain random signals are also present in the medium. Due to interference of these signals our signal gets disrupted a bit. The Maximum Data Rate of a Channel:- If the signal consists of V discrete levels, Nyquist's theorem states: Maximum data rate = 2H log2 V bits per second For example, a noiseless 3-kHz channel cannot transmit binary (i.e., two-level) signals at a rate exceeding 6000 bps. This theorem is only for noiseless channel. For noisy channel- If we denote the signal power by S and the noise power by N, the signal-to-noise ratio is S/N. Usually, the ratio itself is not quoted; instead, the quantity 10 log 10 S/N is given. These units are called decibels (dB). An S/N ratio of 10 is 10 dB, a ratio of 100 is 20 dB, a ratio of 1000 is 30 dB, and so on. Shannon's major result is that the maximum data rate of a noisy channel whose bandwidth is H Hz, and whose signal-to-noise ratio is S/N, is given by Maximum data rate = H log2 (1+S/N) bits per second For example, a channel of 3000-Hz bandwidth with a signal to thermal noise ratio of 30 dB (typical parameters of the analog part of the telephone system) can never transmit much more than 30,000 bps, Encoding Techniques Following are several ways to map data bits to signal elements. Non return to zero(NRZ) NRZ codes share the property that voltage level is constant during a bit interval. High level voltage = bit 1 and Low level voltage = bit 0. A problem arises when there is a long sequence of 0s or 1s and the voltage level is maintained at the same value for a long time. This creates a problem on the receiving end because now, the clock synchronization is lost due to lack of any transitions and hence, it is difficult to determine the exact number of 0s or 1s in this sequence.

The two variations are as follows: 1. NRZ-Level: In NRZ-L encoding, the polarity of the signal changes only when the incoming signal changes from a 1 to a 0 or from a 0 to a 1. NRZ-L method looks just like the NRZ method, except for the first input one data bit. This is because NRZ does not consider the first data bit to be a polarity change, where NRZ-L does. 2. NRZ-Inverted: Transition at the beginning of bit interval = bit 1 and No Transition at beginning of bit interval = bit 0 or vice-versa. This technique is known as differential encoding. NRZ-I has an advantage over NRZ-L. Consider the situation when two data wires are wrongly connected in each other's place. In NRZ-L all bit sequences will get reversed (B'coz voltage levels get swapped).Whereas in NAZ-I since bits are recognized by transition the bits will be correctly interpreted. A disadvantage in NRZ codes is that a string of 0's or 1's will prevent synchronization of transmitter clock with receiver clock and a separate clock line need to be provided.

1.

Biphase encoding: It has following characteristics: Modulation rate twice that of NRZ and bandwidth correspondingly greater. (Modulation is the rate at which signal level is changed).

Because there is predictable transition during each bit time, the receiver can synchronize on that transition i.e. clock is extracted from the signal itself. 3. Since there can be transition at the beginning as well as in the middle of the bit interval the clock operates at twice the data transfer rate.
2.

Types of Encoding o Biphase-Manchester: Transition from high to low in middle of interval = 1 and Transition from low to high in middle of interval = 0 o Differential-Manchester: Always a transition in middle of interval. No transition at beginning of interval=1 and Transition at beginning of interval = 0 Baud rate for Manchester encoding is two times of bit rate because for transmission of one bit, voltage level changes two times. Note: If there are four signal values available, we could encode 2 bits at a time: 000 volt 012 volt 104 volt 116 volt The number changes in a signal per second is called the baud. Here, by doing single change in voltage level we can transmit 2bits. So in this case baud rate is half of bit rate. Example: A 2400 bauds line (modem) can make a bit rate of 9600 bps provided it uses 16 (24) signal values: S 0 1 2 3 bits 0000 0001 0010 0011 S 4 5 6 7 Bits 0100 0101 0110 0111 S 8 9 10 11 Bits 1000 1001 1010 1011 S 12 13 14 15 bits 1100 1101 1110 1111

Q3. . In the waveform (a) given below, a bit stream is encoded by Manchester scheme. The same bit stream is encoded in different coding scheme in waveform (b).The bit stream and the coding scheme are: (a)

(b)

(a) 1000010111 and differential Manchester respectively. (b) 0111101000 and differential Manchester respectively. (c) 1000010111 and integral Manchester respectively. (d) 0111101000 and integral Manchester respectively. Ans. a

Explanation: in Manchester 1 0 0 0

represents 1 and 0 1

represents 0. 0 1

So data is 10000101111 and for this differential Manchester encoding is 1 0 0 0 0 1 0 1 1 1 1

Digital Data Communication Techniques: For two devices linked by a transmission medium to exchange data ,a high degree of co-operation is required. Typically data is transmitted one bit at a time. The timing (rate, duration, spacing) of these bits must be same for transmitter and receiver. There are two options for transmission of bits. 1. Parallel All bits of a byte are transferred simultaneously on separate parallel wires. Synchronization between multiple bits is required which becomes difficult over large distance. Gives large band width but expensive. Practical only for devices close to each other. 2. Serial Bits transferred serially one after other. Gives less bandwidth but cheaper. Suitable for transmission over long distances. Transmission Techniques: 1. Asynchronous: Small blocks of bits(generally bytes) are sent at a time without any time relation between consecutive bytes .when no transmission occurs a default state is maintained corresponding to bit 1. Due to arbitrary delay between consecutive bytes, the time occurrences of the clock pulses at the receiving end need to be synchronized for each byte. This is achieved by providing 2 extra bits start and stop. Start bit: It is prefixed to each byte and equals 0. Thus it ensures a transition from 1 to 0 at onset of transmission of byte. The leading edge of start bit is used as a reference for generating clock pulses at required sampling instants. Thus each onset of a byte results in resynchronization of receiver clock. Stop bit: To ensure that transition from 1 to 0 is always present at beginning of a byte it is necessary that default state be 1. But there may be two bytes one immediately following the other and if last bit of first byte is 0, transition from 1 to 0 will not occur . Therefore a stop bit is suffixed to each byte equaling 1. It's duration is usually 1, 1.5, 2 bits. Asynchronous transmission is simple and cheap but requires an overhead of 3 bits i.e. for 7 bit code 2 (start ,stop bits)+1 parity bit implying 30% overhead. However % can be reduced by sending larger blocks of data but then timing errors between receiver and sender cannot be tolerated beyond [50/no. of bits in block] % (assuming sampling is done at middle of bit interval). It will not only result in incorrect sampling but also misaligned bit count i.e. a data bit can be mistaken for stop bit if receiver's clock is faster.

Synchronous - Larger blocks of bits are successfully transmitted. Blocks of data are either treated as sequence of bits or bytes. To prevent timing drift clocks at two ends need to be synchronized. This can done in two ways: 1. Provide a separate clock line between receiver and transmitter. OR 2. Clocking information is embedded in data signal i.e. Biphase coding for digital signals. Still another level of synchronization is required so that receiver determines beginning or end of block of data. Hence each block begins with a start code and ends with a stop code. These are in general same known as flag that is unique sequence of fixed no. of bits. In addition some control characters encompass data within these flags. Data+control information is called a frame. Since any arbitrary bit pattern can be transmitted there is no assurance that bit pattern for flag will not appear inside the frame thus destroying frame level synchronization. So to avoid this we use bit stuffing .
2.

Q. A serial transmission Ti uses 8 information bits, 2 start bits, 1 stop bit and 1 parity bit for each character. A synchronous transmission T2 uses 3 eight bit sync characters followed by 30 eight bit information characters. If the bit rate is 1200 bits/second in both cases, what are the transfer rates of Ti and T2? (A) 100 characters/sec, 153 characters/sec (B) 80 characters/sec, 136 characters/sec (C) 100 characters/sec, 136 characters/sec (D) 80 characters/sec, 153 characters/sec IT2004 Ans.C Explanation: in serial transmission 8 bit of actual data is present in 8+2+1+1(=12) bits of each transmission. In one second 1200 bits are transferred. In 1200 bit only 1200*(8/12) bits of actual data is present, So actual transfer rate is 1200*(8/12)=800 bits =100 bytes=100 characters. Similarly in synchronous transmission actual data rate is=1200*(30/33) bps=1090 bps=136 bytes per seconds.

DATA LINK LAYER


What is DLL(Data Link Layer) The Data Link Layer is the second layer in the OSI model, above the Physical Layer, which ensures that the error free data is transferred between the adjacent nodes in the network. It breaks the datagrams passed down by above layers and converts them into frames ready for transfer. This is called Framing. It provides two main functionalities Reliable data transfer service between two peer network layers Flow Control mechanism which regulates the flow of frames such that data congestion is not there at slow receivers due to fast senders. What is Framing? Since the physical layer merely accepts and transmits a stream of bits without any regard to meaning or structure, it is upto the data link layer to create and recognize frame boundaries. This can be accomplished by attaching special bit patterns to the beginning and end of the frame. If these bit patterns can accidentally occur in data, special care must be taken to make sure these patterns are not incorrectly interpreted as frame delimiters. The four framing methods that are widely used are Character count Starting and ending characters, with character stuffing Starting and ending flags, with bit stuffing Physical layer coding violations 1. Character Count This method uses a field in the header to specify the number of characters in the frame. When the data link layer at the destination sees the character count, it knows how many characters follow, and hence

where the end of the frame is. The disadvantage is that if the count is garbled by a transmission error, the destination will lose synchronization and will be unable to locate the start of the next frame. So, this method is rarely used. 2. Character stuffing In the second method, each frame starts with the ASCII character sequence DLE STX and ends with the sequence DLE ETX.(where DLE is Data Link Escape, STX is Start of Text and ETX is End of Text.) This method overcomes the drawbacks of the character count method. If the destination ever loses synchronization, it only has to look for DLE STX and DLE ETX characters. If however, binary data is being transmitted then there exists a possibility of the characters DLE STX and DLE ETX occurring in the data. Since this can interfere with the framing, a technique called character stuffing is used. The sender's data link layer inserts an ASCII DLE character just before the DLE character in the data. The receiver's data link layer removes this DLE before this data is given to the network layer. However character stuffing is closely associated with 8-bit characters and this is a major hurdle in transmitting arbitrary sized characters. 3. Bit stuffing The third method allows data frames to contain an arbitrary number of bits and allows character codes with an arbitrary number of bits per character. At the start and end of each frame is a flag byte consisting of the special bit pattern 01111110 . Whenever the sender's data link layer encounters five consecutive 1s in the data, it automatically stuffs a zero bit into the outgoing bit stream. This technique is called bit stuffing. When the receiver sees five consecutive 1s in the incoming data stream, followed by a zero bit, it automatically destuffs the 0 bit. The boundary between two frames can be determined by locating the flag pattern. (a) frame to send : 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 (b) frame transmitted over the wire: 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 0 Stuffed bits (c) frame after removing stuffed bits: 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 Q4. In a data link protocol, the frame delimiter flag is given by 0111. Assuming that bit stuffing is employed, the transmitter sends the data sequence 01110110 as (A) 01101011 (B) 011010110 (C) 011101100 (D)0110101100 IT2004 Ans. D Explanation: three consecutive ones are used for delimiter so whenever in data two consecutive one comes stuff a zero after them. Data is 01110110 After stuffing 0110101100 4. Physical layer coding violations The final framing method is physical layer coding violations and is applicable to networks in which the encoding on the physical medium contains some redundancy. In such cases normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair. The combinations of low-low and high-high which are not used for data may be used for marking frame boundaries. Error Control The bit stream transmitted by the physical layer is not guaranteed to be error free. The data link layer is responsible for error detection and correction. The most common error control method is to compute and append some form of a checksum to each outgoing frame at the sender's data link layer and to recompute the checksum and verify it with the received checksum at the receiver's side. If both of them match, then the frame is correctly received; else it is erroneous. The checksums may be of two types:

1. Error detecting : Receiver can only detect the error in the frame and inform the sender about it. 2. Error detecting and correcting : The receiver can not only detect the error but also correct it. Examples of Error Detecting methods: Parity bit: Simple example of error detection technique is parity bit. The parity bit is chosen that the number of 1 bits in the code word is either even( for even parity) or odd (for odd parity). For example when 10110101 is transmitted then for even parity an 1 will be appended to the data and for odd parity a 0 will be appended. This scheme can detect only single bits. So if two or more bits are changed then that cannot be detected. Cyclic Redundancy Checksum (CRC): Every bit pattern can be represented in polynomial. 100101 = 1*x5+0*x4+0*x3+1*x2+0*x1+1*x0 = x5+x2+x0 polynomial of degree 5 How to Generate CRC Step 1: decide a generator polynomial g(x) of degree m. Let it is x5+x2+x0 =100101 . m=5 Step 2: append m 0s to the end of data. Let data is 10111101 Then after appending 5 0s data is 1011110100000 Step 3: now divide data by g(x) and find remainder. Division in CRC is similar to division of real number but instead of using subtraction we use XOR operator. 100101)1011110100000( 100101 00101101 100101 00100000 100101 000101000 100101 001101 Step 4: Add remainder to modified data. 1101 is remainder, add this remainder to 1011110100000. Now data becomes 1011110101101, transmit this data. At receiver end , receiver perform same division operation to received data by g(x) if remainder is zero then no error occurred. 100101)1011110101101( 100101 00101101 100101 00100001 100101 000100101 100101 000000 Here, remainder is zero, so no error in data transmission. Q5. Consider the following message M = 1010001101. The cyclic redundancy check (CRC) for this message using the divisor polynomial x5 + x4 + x2 + 1 is: (A) 01110 (B) 01011 (C) 10101 (D)10110 IT2005 Ans. A Explanation: generator polynomial is of degree 5 so append 5 0s to the end of data and then divide new data by generator polynomial. x5 + x4 + x2 + 1 =110101

110101)101000110100000( 110101 0111011 110101 00111010 110101 00111110 110101 00101100 110101 0110010 110101 0001110 Remainder is 01110 Note: if generator is divisible by x3+1 then CRC can detect all odd number of errors. Examples of Error Detecting methods: Hamming Code: The Hamming distance between two frames a and b is the number of bits at the same position that differ. Example: 10001001 and 10110001 are at Hamming distance 3: 10001001 10110001 00111000 To detect all sets of k or fewer errors, it is necessary and sufficient that the Hamming distance between any two frames is k+1 or more. To correct all sets of k or fewer errors, it is necessary that the Hamming distance between any two frames is 2k+1 or more. How to detect source errors? In order ensure that the frames are delivered correctly, the receiver should inform the sender about incoming frames using positive or negative acknowledgements. On the sender's side the receipt of a positive acknowledgement implies that the frame has arrived at the destination safely while the receipt of a negative acknowledgement means that an error has occurred in the frame and it needs to be retransmitted. However, this scheme is too simplistic because if a noise burst causes the frame to vanish completely, the receiver will not respond at all and the sender would hang forever waiting for an acknowledgement. To overcome this drawback, timers are introduced into the data link layer. When the sender transmits a frame it also simultaneously starts a timer. The timer is set to go off after a interval long enough for the frame to reach the destination, be processed there, and have the acknowledgement propogate back to the sender. If the frame is received correctly the positive acknowledgment arrives before the timer runs out and so the timer is canceled. If however either the frame or the acknowledgement is lost the timer will go off and the sender may retransmit the frame. Since multiple transmission of frames can cause the receiver to accept the same frame and pass it to the network layer more than once, sequence numbers are generally assigned to the outgoing frames. The types of acknowledgements that are sent can be classified as follows: Cumulative acknowledgements: A single acknowledgement informing the sender that all the frames upto a certain number have been received. Selective acknowledgements: Acknowledgement for a particular frame. They may be also classified as: Individual acknowledgements: Individual acknowledgement for each frame. Group acknowledgements: A bit-map that specifies the acknowledgements of a range of frame numbers. Flow Control Consider a situation in which the sender transmits frames faster than the receiver can accept them. If the sender keeps pumping out frames at high rate, at some point the receiver will be completely

swamped and will start losing some frames. This problem may be solved by introducing flow control. Most flow control protocols contain a feedback mechanism to inform the sender when it should transmit the next frame. Mechanisms For Flow Control: Stop and Wait Protocol: This is the simplest flow control protocol in which the sender transmits a frame and then waits for an acknowledgement, either positive or negative, from the receiver before proceeding. If a positive acknowledgement is received, the sender transmits the next packet; else it retransmits the same frame. However, this protocol has one major flaw in it. If a packet or an acknowledgement is completely destroyed in transit due to a noise burst, a deadlock will occur because the sender cannot proceed until it receives an acknowledgement. This problem may be solved using timers on the sender's side. When the frame is transmitted, the timer is set. If there is no response from the receiver within a certain time interval, the timer goes off and the frame may be retransmitted. Sliding Window Protocols: In spite of the use of timers, the stop and wait protocol still suffers from a few drawbacks. Firstly, if the receiver had the capacity to accept more than one frame, its resources are being underutilized. Secondly, if the receiver was busy and did not wish to receive any more packets, it may delay the acknowledgement. However, the timer on the sender's side may go off and cause an unnecessary retransmission. These drawbacks are overcome by the sliding window protocols. In sliding window protocols the sender's data link layer maintains a 'sending window' which consists of a set of sequence numbers corresponding to the frames it is permitted to send. Similarly, the receiver maintains a 'receiving window' corresponding to the set of frames it is permitted to accept. The window size is dependent on the retransmission policy and it may differ in values for the receiver's and the sender's window. The sequence numbers within the sender's window represent the frames sent but as yet not acknowledged. Whenever a new packet arrives from the network layer, the upper edge of the window is advanced by one. When an acknowledgement arrives from the receiver the lower edge is advanced by one. The receiver's window corresponds to the frames that the receiver's data link layer may accept. When a frame with sequence number equal to the lower edge of the window is received, it is passed to the network layer, an acknowledgement is generated and the window is rotated by one. If however, a frame falling outside the window is received, the receiver's data link layer has two options. It may either discard this frame and all subsequent frames until the desired frame is received or it may accept these frames and buffer them until the appropriate frame is received and then pass the frames to the network layer in sequence. Most sliding window protocols also employ ARQ ( Automatic Repeat reQuest ) mechanism. In ARQ, the sender waits for a positive acknowledgement before proceeding to the next frame. If no acknowledgement is received within a certain time interval it retransmits the frame. ARQ is of two types :
1.

Go Back 'n': If a frame is lost or received in error, the receiver may simply discard all subsequent frames, sending no acknowledgments for the discarded frames. In this case the receive window is of size 1. Since no acknowledgements are being received the sender's window will fill up, the sender will eventually time out and retransmit all the unacknowledged frames in order starting from the damaged or lost frame. The maximum window size for this protocol can be obtained as follows. Assume that the window size of the sender is n. So the window will initially contain the frames with sequence numbers from 0 to (w-1). Consider that the sender transmits all these frames and the receiver's data link layer receives all of them correctly. However, the sender's data link layer does not receive any acknowledgements as all of them are lost. So the sender will retransmit all the frames after its timer goes off. However the receiver window has already advanced to w. Hence to avoid overlap , the sum of the two windows should be less than the sequence number space. w-1 + 1 < Sequence Number Space i.e., w < Sequence Number Space Maximum Window Size = Sequence Number Space - 1

Q6. Station A needs to send a message consisting of 9 packets to Station B using a sliding window (window size 3) and go-back-n error control strategy. All packets are ready and immediately available for transmission. If every 5th packet that A transmits gets lost (but no acks from B ever get lost), then what is the number of packets that A will transmit for sending the message to B? (A) 12 (B) 14 (C) 16 (D) 18 CS2006 Ans. C Explanation: window size is 3,so maximum 3 packets can be remained unacknowledged. In go back n if acknowledge for a packet is not received then packets after that packet is also retransmitted. Frame sequence for 9 frame is shown below. Frame with bold sequence number gets lost. 1 2 3 4 5 6 7 5 6 7 8 9 7 8 9 9 Discarded packets
2.

Selective Repeat: In this protocol rather than discard all the subsequent frames following a damaged or lost frame, the receiver's data link layer simply stores them in buffers. When the sender does not receive an acknowledgement for the first frame it's timer goes off after a certain time interval and it retransmits only the lost frame. Assuming error - free transmission this time, the sender's data link layer will have a sequence of a many correct frames which it can hand over to the network layer. Thus there is less overhead in retransmission than in the case of Go Back n protocol. In case of selective repeat protocol the window size may be calculated as follows. Assume that the size of both the sender's and the receiver's window is w. So initially both of them contain the values 0 to (w-1). Consider that sender's data link layer transmits all the w frames, the receiver's data link layer receives them correctly and sends acknowledgements for each of them. However, all the acknowledgements are lost and the sender does not advance it's window. The receiver window at this point contains the values w to (2w-1). To avoid overlap when the sender's data link layer retransmits, we must have the sum of these two windows less than sequence number space. Hence, we get the condition Maximum Window Size = Sequence Number Space / 2

How to Calculate Sequence number To calculate sequence number , first we should know about two terms: Transmission Delay(Tx) and Propagation Delay(Tp). In a network based on packet switching, transmission delay (or store-and-forward delay) is the amount of time required to push all of the packet's bits into the wire. In other words, this is the delay caused by the data-rate of the link. Transmission delay is a function of the packet's length and has nothing to do with the distance between the two nodes. This delay is proportional to the packet's length in bits, It is given by the following formula: Tp= N / R where Tp is the transmission delay N is the number of bits, and R is the rate of transmission (say in bits per second) Most packet switched networks use store-and-forward transmission at the input of the link. A switch using store-and-forward transmission will receive (save) the entire packet to the buffer and check it for CRC errors or other problems before sending the first bit of the packet into the outbound link. Thus store-and-forward packet switches introduce a store-and-forward delay at the input to each link along the packet's route.

Propagation delay is the amount of time it takes for the head of the signal to travel from the sender to the receiver over a medium. It can be computed as the ratio between the link length and the propagation speed over the specific medium. Propagation delay = d/s where d is the distance and s is the wave propagation speed. In wireless communication, s=c, i.e. the speed of light. Let In sliding window protocol for maximum throughput we can send N number of frames until first frame is acknowledged for a bus topology. Transmission delay of a frame is =Tx Total delay in transmission of first frame and receiving of acknowledgement of first frame is= Tx+Tp+Tp=Tx+2Tp So, N=(Tx+2Tp)/Tx, These N number of frame can be remain unacknowledged, which is maximum window size. If Tx << Tp then N=2Tp/Tx For Go back n sequence number is : N+1 For selective repeat sequence number is: 2N Note: in Computer Networks 1 Mb=106bits, Similarly, 1Kb=103bits 1 MB=8 Mb, Similarly, 1KB= 8Kb Q7. Host A is sending data to host B over a full duplex link. A and B, are using the sliding window protocol for flow control. The send and receive window size are 5 packets each. Data packets ( sent only from A to B) are all 1000 bytes long and the transmission time for such a packet is 50 s. Acknowledgement packets are very small (sent only from B to A) and require very negligible time. The propagation delay over the link is 200 s. What is the maximum achievable throughput in this communication? (A) 7.69 x 106 bytes per second (B) 11.11 x 106 bytes per second (C) 12.33 x 106 bytes per second (D) 15.00 x 106 bytes per second CS2003 Ans. B Explanation: Transmission rate , Tx is= 1000 bytes/ 50 s=8000bits /50 s=160 Mbps Efficiency= 5* 50/(50+400)=250/450=5/9 Maximum achievable throughput=(5/9)*160 Mbps=88.88Mbps=11.11 x 106 bytes per second Q8. Consider a 100 km long cable running at 1.54 Mbps at propagation speed 2C/3 (i.e. C is speed of light=3*108 meter/second). At max how many bits can be feed into the cable. Ans. 770 bits Explanation: propagation delay is = 100 km / (2C/3)=105meter / (2*108meter / second) =5*10-4 seconds =0.5 ms Maximum number of bits that can be feed into 100 m long cable is=1.54 Mbps *0.5 ms = 770 bits

Efficiency of DLL protocols if error rate(p) is given


In Stop and Wait Protocol, efficiency e = (1-p)/(1+2) where =Tx / Tp In sliding window - Go Back n : 1-p w(1-p) . (1+2)(1-p+wp) 1-p w(1-p) (1+2) if w2+1

Efficiency e= Selective Repeat:

if w2+1

Efficiency e=

The Medium Access Control Sublayer


In any broadcast network, the key issue is how to determine who gets to use the channel when there is competition for it. To make this point clearer, consider a conference call in which six people, on six different telephones, are all connected so that each one can hear and talk to all the others. It is very likely that when one of them stops speaking, two or more will start talking at once, leading to chaos. Many protocols for solving the problem are known and form the contents of this chapter. In the literature, broadcast channels are sometimes referred to as multiaccess channels or random access channels. The protocols used to determine who goes next on a multiaccess channel belong to a sublayer of the data link layer called the MAC (Medium Access Control) sublayer. The MAC sublayer is especially important in LANs, many of which use a multiaccess channel as the basis for communication.

The Channel Allocation Problem


Static Channel Allocation in LANs and MANs: The traditional way of allocating a single channel, such as a telephone trunk, among multiple competing users is Frequency Division Multiplexing (FDM). If there are N users, the bandwidth is divided into N equal-sized portions , each user being assigned one portion. Since each user has a private frequency band, there is no interference between users. When there is only a small and constant number of users, each of which has a heavy (buffered) load of traffic (e.g., carriers' switching offices), FDM is a simple and efficient allocation mechanism.

Dynamic Channel Allocation in LANs and MANs:


Assumption: 1. Station Model. The model consists of N independent stations (e.g., computers, telephones, or personal communicators), each with a program or user that generates frames for transmission. Stations are sometimes called terminals. The probability of a frame being generated in an interval of length t is t, where is a constant (the arrival rate of new frames). Once a frame has been generated, the station is blocked and does nothing until the frame has been successfully transmitted. 2. Single Channel Assumption: A single channel is available for all communication. All stations can transmit on it and all can receive from it. As far as the hardware is concerned, all stations are equivalent, although protocol software may assign priorities to them. 3. Collision Assumption: If two frames are transmitted simultaneously, they overlap in time and the resulting signal is garbled. This event is called a collision. All stations can detect collisions. A collided frame must be transmitted again later. There are no errors other than those generated by collisions. 4. Continuous Time: Frame transmission can begin at any instant. There is no master clock dividing time into discrete intervals. Slotted Time. Time is divided into discrete intervals (slots). Frame transmissions always begin at the start of a slot. A slot may contain 0, 1, or more frames, corresponding to an idle slot, a successful transmission, or a collision, respectively. 5. Carrier Sense. Stations can tell if the channel is in use before trying to use it. If the channel is sensed as busy, no station will attempt to use it until it goes idle. No Carrier Sense. Stations cannot sense the channel before trying to use it. They just go ahead and transmit. Only later can they determine whether the transmission was successful.

Multiple Access Protocols


ALOHA: There are two version of ALOHA Pure Aloha: The basic idea of an ALOHA system is simple: let users transmit whenever they have data to be sent. There will be collisions, of course, and the colliding frames will be damaged. However, due to the feedback property of broadcasting, a sender can always find out whether its frame was destroyed by listening to the channel, the same way other users do. Whenever two frames try to occupy the channel at the same time, there will be a collision and both will be garbled. If the first bit of a new frame overlaps with just the last bit of a frame almost finished, both frames

will be totally destroyed and both will have to be retransmitted later. The checksum cannot (and should not) distinguish between a total loss and a near miss. What is the efficiency of an ALOHA channel? Throughput of Aloha Channel is defined by: S=Ge-2G Which is maximum at g=1/2 S= 1/2e= .184=18.4% Slotted Aloha: In this into discrete intervals, each interval corresponding to one frame. This approach requires the users to agree on slot boundaries. Users are allowed to send frame only at the start of interval. Throughput of Slotted Aloha is double of pure Aloha i.e. 1/e=36.8% Q9. There are n stations in a slotted LAN. Each station attempts to transmit with a probability p in each time slot. What is the probability that ONLY one station transmits in a given time slot? (A) np(1-p)n-1 (B) (1-p)n-1 (C)p (1-p)n-1 (D)1- (1-p)n-1 CS2007 Ans. A Explanation: A station can transmit only when all other stations(n-1 stations) are idle. Each station attempts with probability =p Probability of a station for not attempting to transmit is =1-p Probability when n-1 station are not transmitting= (1-p)n-1 Probability when all other n-1 station are not transmitting and one particular station is transmitting= p(1-p)n-1 This probability is for all n station. The probability that ONLY one station transmits in a given time slot is = np(1-p)n-1 Q10. Consider a simplified time slotted MAC protocol, where each host always has data to send and transmits with probability p=0.2 in every slot. There is no back off and one frame can be transmitted in one slot. If more than one host transmits in the same slot, then the transmissions are unsuccessful due to collision. What is the maximum number of hosts which this protocol can support, if each host has to be provided a minimum throughput of 0.16 frames per time slot? (A) 1 (B) 2 (C) 3 (D)4 IT2004 Ans. B Explanation: each host have throughput of .16 frames per time slot. If there are n host then total throughput will be 0.16n , which is probability at which a frame can transmit successfully. So by the formula in previous question np(1-p)n-1 =0.16n n * 0.2 * (0.8)n-1 =0.16n n=2 satisfy above condition.

Carrier Sense Multiple Access Protocols


Protocols in which stations listen for a carrier (i.e., a transmission) and act accordingly are called carrier sense protocols. Persistent and Nonpersistent CSMA 1 Persistent CSMA: When a station has data to send, it first listens to the channel to see if anyone else is transmitting at that moment. If the channel is busy, the station waits until it becomes idle. When the station detects an idle channel, it transmits a frame. If a collision occurs, the station waits a random amount of time and starts all over again. The protocol is called 1persistent because the station transmits with a probability of 1 when it finds the channel idle. Non-Persistent CSMA: In this protocol, a conscious attempt is made to be less greedy than in the previous one. Before sending, a station senses the channel. If no one else is sending, the station begins doing so itself. However, if the channel is already in use, the station does not continually sense it for the purpose of seizing it immediately upon detecting the end of the previous transmission. Instead, it waits a random period of time and then repeats the algorithm. Consequently, this algorithm leads to better channel utilization but longer delays than 1persistent CSMA.

P persistence CSMA: It applies to slotted channels and works as follows. When a station

becomes ready to send, it senses the channel. If it is idle, it transmits with a probability p. With a probability q = 1 - p, it defers until the next slot. If that slot is also idle, it either transmits or defers again, with probabilities p and q. This process is repeated until either the frame has been transmitted or another station has begun transmitting. In the latter case, the unlucky station acts as if there had been a collision (i.e., it waits a random time and starts again). If the station initially senses the channel busy, it waits until the next slot and applies the above algorithm. CSMA with Collision Detection: if two stations sense the channel to be idle and begin transmitting simultaneously, they will both detect the collision almost immediately. Rather than finish transmitting their frames, which are irretrievably garbled anyway, they should abruptly stop transmitting as soon as the collision is detected. Quickly terminating damaged frames saves time and bandwidth. This protocol, known as CSMA/CD (CSMA with Collision Detection) is widely used on LANs in the MAC sublayer. IEEE 802.3 and Ethernet Very popular LAN standard. Ethernet and IEEE 802.3 are distinct standards but as they are very similar to one another these words are used interchangeably. A standard for a 1-persistent CSMA/CD LAN. It covers the physical layer and MAC sublayer protocol. To decide the random time in CSMA/CD Ethernet make use of Binary Exponential Backoff Algorithm. In this at ith collision user should choose 0 to 2i-1 time interval to wait. Example: The figure 51.2s has been given here as an example. However, 51.2s could be replaced by any positive value, in practice. 1. When a collision first occurs, send a `Jamming signal' to prevent further data being sent. 2. Resend a frame after either 0 seconds or 51.2s, chosen at random. Probability of collision is . 3. If that fails, resend the frame after either 0s, 51.2s, 102.4s, or 153.6s. Probability of collision is . 4. If that still doesn't work, resend the frame after k*51.2s, where k is a random number between 0 and 23 1. Probability of collision is 1/8. 5. In general, after the kth failed attempt, resend the frame after k*51.2s, where k is a random number between 0 and 2n 1. Probability of collision is 1/2k. Q11. A and B are the only two stations on an Ethernet. Each has a steady queue of frames to send. Both A and B attempt to transmit a frame, collide, and A wins the first backoff race. At the end of this successful transmission by A, both A and B attempt to transmit and collide. The probability that A wins the second backoff race is (a) 0.5 (b) 0.625 (c) 0.75 (d)1.0 CS2004 Ans. b Explanation: let counter for A is CA and for B it is CB. Both CA and CB initializes to zero so at first attempt ,both A and B try to transmit and collide. So they increment there counters to 1. if A wins first backoff means A decided to transmit at first slot when t=0 and B decided to transmit at second slot when t= 1;A transmit first frame at first slot and set its counter to 0 i.e. CA =0, Now , A have second frame to transmit at t=1 and CA =0(with probability 1) and B have chose to transmit at t =1 . Both A and B try to transmit and collide. They increment their counter CA becomes 1and CB becomes 3.A and B choose different values of t to transmit; A can choose 0 or 1 and B can choose 0,1,2or 3 A B 0 0 1 1 2 3

Combination for which A wins this race is (0,1) ,(0,2),(0,3),(1,2) and (1,3) where first value in pair shows time chose by A and second is time chose by B. there are only 5 combination out of 8 in which A wins the race. So, Probability is 5/8=0.625 IEEE 802.3 Frame Structure Start of Frame Dest. Source 802.2 Frame Preamble Length Delimiter Address Address Header+Data Checksum (7 bytes) (2 bytes) (1 byte) (2/6 bytes) (2/6 bytes) (46-1500 bytes) (4 bytes) A brief description of each of the fields Preamble :Each frame starts with a preamble of 7 bytes, each byte containing the bit pattern 10101010. Manchester encoding is employed here and this enables the receiver's clock to synchronize with the sender's and initialize itself. Start of Frame Delimiter :This field containing a byte sequence 10101011 denotes the start of the frame itself. Dest. Address :The standard allows 2-byte and 6-byte addresses. Note that the 2-byte addresses are always local addresses while the 6-byte ones can be local or global. Multicast : Sending to group of stations. This is ensured by setting the first bit in either 2byte/6-byte addresses to 1. Broadcast : Sending to all stations. This can be done by setting all bits in the address field to 1.All Ethernet cards(Nodes) are a member of this group. Source Address :Refer to Dest. Address. Same holds true over here. Length : The Length field tells how many bytes are present in the data field, from a minimum of 0 to a maximum of 1500. The Data and padding together can be from 46bytes to 1500 bytes as the valid frames must be at least 64 bytes long, thus if data is less than 46 bytes the amount of padding can be found out by length field. Data :Actually this field can be split up into two parts - Data(0-1500 bytes) and Padding(0-46 bytes). Reasons for having a minimum length frame : 1. To prevent a station from completing the transmission of a short frame before the first bit has even reached the far end of the cable, where it may collide with another frame. Note that the transmission time ought to be greater than twice the propagation time between two farthest nodes. transmission time for frame > 2*propagation time between two farthest nodes Tx > 2 Tp 2. When a transceiver detects a collision, it truncates the current frame, which implies that stray bits and pieces of frames appear on the cable all the time. Hence to distinguish between valid frames from garbage, 802.3 states that the minimum length of valid frames ought to be 64 bytes (from Dest. Address to Frame Checksum). Frame Checksum : It is a 32-bit hash code of the data. If some bits are erroneously received by the destination (due to noise on the cable), the checksum computed by the destination wouldn't match with the checksum sent and therefore the error will be detected. The checksum algorithm is a cyclic redundancy checksum (CRC) kind. The checksum includes the packet from Dest. Address to Data field. Q12. 1 km long 10 Mbps CSMA/CD LAN has propagation speed 200m/s, data frame is 256 bit long including 32 bits of header ,checksum and other. The first big slot after successful transmission is reserve for a receiver to capture channel and to send 32 bit of acknowledgement . What is effective data rate excluding overhead and assuming there is no collision. Ans: Explanation: Tx= 256 bits / 10 Mbps=25.6s Tp=1*103 meter /(200meter/s) =5 s 1 big slot = 2*Tp= 10 s Transmission time for acknowledgement= 32bits/ 10 Mbps =3.2 s Total delay in transmission of acknowledgement= transmission delay+ propagation delay= 3.2 s+5 s = 8.2 s

Total delay in transmission of single frame is= first big slot + total delay of frame + total delay of ack =10 + (25.6 + 5 ) + 8.2 =48.8 s In 48.8 s only 256 bit of data is transferred . So effective data rate is =256 bits /48.8 s=5.245 Mbps Note: from these data we can also calculate efficiency of this network Efficiency= effective data rate / proposed data rate =5.245 / 10 = 0.5245 =52.45% Q13. A 2km long LAN has 107 bps bandwidth and users CSMA/CD. The signal travels along the wire at 2 x 108 m/s. What is the minimum packet size that can be used on this network? (A) 50 bytes (B) 100 bytes (C) 200 bytes (D) none of the above CS2003 Ans. D Explanation: minimum packet size for a CSMA/CD LAN is is the frame which cover whole RTT(round trip time).i.e. Tx=2Tp Tp=2 x 103/(2 x 108) seconds= 10-5 seconds Let S bits be minimum size of frame, then Tx=S/107 seconds Tx=2Tp S/107 = 2 x 10-5 =200 bits =(200 / 8) bytes Q14. Suppose the round trip propagation delay for a 10 Mbps Ethernet having 48-bit jamming signal is 46.4 ms. The minimum frame size is: (a) 94 (b) 416 (c) 464 (d) 512 CS2005 Ans. c Explanation: Round trip propagation delay is 2*Tp Minimum frame size of Ethernet can be found by using formula Tx=2*Tp. Let S is minimum frame size then S/10Mbps = 46.4 ms S=464 Kbits IEEE 802.5: Token Ring Network Token Ring is formed by the nodes connected in ring. The principle used in the token ring network is that a token is circulating in the ring and whichever node grabs that token will have right to transmit the data. Whenever a station wants to transmit a frame it inverts a single bit of the 3-byte token which instantaneously changes it into a normal data packet. Because there is only one token, there can at most be one transmission at a time. Since the token rotates in the ring it is guaranteed that every node gets the token with in some specified time. So there is an upper bound on the time of waiting to grab the token so that starvation is avoided. There is also an upper limit of 250 on the number of nodes in the network. To distinguish the normal data packets from token (control packet) a special sequence is assigned to the token packet. When any node gets the token it first sends the data it wants to send, then recirculates the token. If a node transmits the token and nobody wants to send the data the token comes back to the sender. If the first bit of the token reaches the sender before the transmission of the last bit, then error situation arises. So to avoid this we should have: propagation delay + transmission of n-bits (1-bit delay in each node ) > transmission of the token time A station may hold the token for the token-holding time. which is 10 ms unless the installation sets a different value. If there is enough time left after the first frame has been transmitted to send more frames, then these frames may be sent as well. After all pending frames have been transmitted

or the transmission frame would exceed the token-holding time, the station regenerates the 3-byte token frame and puts it back on the ring. Who should remove the packet from the ring ? There are 3 possibilities1. The source itself removes the packet after one full round in the ring. 2. The destination removes it after accepting it: This has two potential problems. Firstly, the solution won't work for broadcast or multicast, and secondly, there would be no way to acknowledge the sender about the receipt of the packet. 3. Have a specialized node only to discard packets: This is a bad solution as the specialized node would know that the packet has been received by the destination only when it receives the packet the second time and by that time the packet may have actually made about one and half (or almost two in the worst case) rounds in the ring. Thus the first solution is adopted with the source itself removing the packet from the ring after a full one round. With this scheme, broadcasting and multicasting can be handled as well as the destination can acknowledge the source about the receipt of the packet (or can tell the source about some error). Token Format The token is the shortest frame transmitted (24 bit) MSB (Most Significant Bit) is always transmitted first - as opposed to Ethernet SD AC ED SD = Starting Delimiter (1 Octet) AC = Access Control (1 Octet) ED = Ending Delimiter (1 Octet) Access Control Format: P PPTMRRR T=Token T = 0 for Token T = 1 for Frame When a station with a Frame to transmit detects a token which has a priority equal to or less than the Frame to be transmitted, it may change the token to a start-of-frame sequence and transmit the Frame P = Priority Priority Bits indicate tokens priority, and therefore, which stations are allowed to use it. Station can transmit if its priority as at least as high as that of the token. M = Monitor The monitor bit is used to prevent a token whose priority is greater than 0 or any frame from continuously circulating on the ring. If an active monitor detects a frame or a high priority token with the monitor bit equal to 1, the frame or token is aborted. This bit shall be transmitted as 0 in all frame and tokens. The active monitor inspects and modifies this bit. All other stations shall repeat this bit as received. R = Reserved bits The reserved bits allow station with high priority Frames to request that the next token be issued at the requested priority. Frame Format: MSB (Most Significant Bit) is always transmitted first - as opposed to Ethernet SD AC FC DA SA DATA CRC ED FS SD=Starting Delimiter(1 octet) AC=Access Control(1 octet) FC = Frame Control (1 Octet) DA = Destination Address (2 or 6 Octets) SA = Source Address (2 or 6 Octets) DATA = Information 0 or more octets up to 4027 CRC = Checksum(4 Octets)

ED = Ending Delimiter (1 Octet) FS=Frame Status Access Control Format: P PPTMRRR T=Token T = 0 for Token, T = 1 for Frame. When a station with a Frame to transmit detects a token which has a priority equal to or less than the Frame to be transmitted, it may change the token to a start-of-frame sequence and transmit the Frame. P = Priority Bits Priority Bits indicate tokens priority, and therefore, which stations are allowed to use it. Station can transmit if its priority as at least as high as that of the token. M = Monitor The monitor bit is used to prevent a token whose priority is greater than 0 or any frame from continuously circulating on the ring. if an active monitor detects a frame or a high priority token with the monitor bit equal to 1, the frame or token is aborted. This bit shall be transmitted as 0 in all frame and tokens. The active monitor inspects and modifies this bit. All other stations shall repeat this bit as received. R = Reserved bits the reserved bits allow station with high priority Frames to request that the next token be issued at the requested priority. Frame Control Format: F F CONTROL BITS (6 BITS) FF= Type of Packet-Regular data packet or MAC layer packet Control Bits= Used if the packet is for MAC layer protocol itself Frame Status: It contains the A and C bits. A bit set to 1: destination recognized the packet. C bit set to 1: destination accepted the packet. This arrangement provides an automatic acknowledgement for each frame. The A and C bits are present twice in the Frame Status to increase reliability in as much as they are not covered by the checksum. A C 0 0 frame is neither copied nor acknowledged. 0 1 this is invalid combination because if frame is copied it must be acknowledged. 1 0 frame acknowledged without copying it because receiver not exist. 1 1 frame is successfully copied and acknowledged. Ring Maintenance Each token ring has a monitor that oversees the ring. Among the monitor's responsibilities are seeing that the token is not lost, taking action when the ring breaks, cleaning the ring when garbled frames appear and watching out for orphan frames. An orphan frame occurs when a station transmits a short frame in it's entirety onto a long ring and then crashes or is powered down before the frame can be removed. If nothing is done, the frame circulates indefinitely. Detection of orphan frames: The monitor detects orphan frames by setting the monitor bit in the Access Control byte whenever it passes through. If an incoming frame has this bit set, something is wrong since the same frame has passed the monitor twice. Evidently it was not removed by the source, so the monitor drains it. Lost Tokens: The monitor has a timer that is set to the longest possible tokenless interval : when each node transmits for the full token holding time. If this timer goes off, the monitor drains the ring and issues a fresh token.

Garbled frames: The monitor can detect such frames by their invalid format or checksum, drain the ring and issue a fresh token.

Q15. Consider a 4Mbps token ring having token holding time 10ms. What is the size of longest frame that can be send on ring. Ans. 40Kbits Explanation: if token holding time is 10ms then a user can transmit only for 10 ms, maximum time till it can hold token. In 1 ms a user can transmit 4Mbps* 10ms=4*106bits per second* 10*10-3 seconds= 4*104 bits=40 Kbits. Q16. Consider a 5 Mbps token ring with propagation speed 200 m/s. How much length of cable is occupied by 1 bit. Ans. 40 meter Explanation: 5 Mbits of data takes transmission delay of 1 second 1 bit takes 1/5M seconds=2*10-7 seconds 1 bit occupies 200 m per s * 2*10-7 seconds =2*108 * 2*10-7 meters=40 meters There are two strategy of token ring on the basis of time when token is released 1. Early Token Release: as soon as sender transmit last bit of data frame it releases the token. Tx . Utilization of ring with N number of hosts= Tx+(Tp/N) 2. Delayed Token Release: when last bit of data frame reaches at the sender after one round to the ring then release the token. Tx . Utilization of ring with N number of hosts= Tp+(Tp/N) Q17. Consider a token ring with the latency of 500s. Assume that there are sufficiently many host transmitting so that time spent in advancing the token can be ignored. Packet size is 1500 bytes. Ring has bandwidth of 3Mbps. What is effective throughput rate that can be achieved (1) if Delayed token release strategy is used and if there is single user in the ring. (2) if Delayed token release strategy is used and if there are many users in the ring. (3) if early token release strategy is used and if there is single user in the ring. (4) if early token release strategy is used and if there are many users in the ring. Ans. Tx= (1500 * 8 bits)/ 3Mbps= 4000 s (1) if Single user is there then this user transmit frame and wait until last bit of frame is received to it. And then user releases the token, token circulates in ring then comes back to user then user can transmit another frame. So total delay in transmitting a frame= Tx + Tp(propagation delay of frame) +Tp(propagation delay of token) = 4000 + 500 + 500 =5000 s Effective throughput is =1500* 8 bits / 5000 s=2.4 Mbps (2) if many users are there then sender transmit frame and wait until last bit of frame is received to it. And then sender releases the token, token is occupied by other user in the ring, so other user can transmit his frame. So total delay in transmitting a frame= Tx + Tp(propagation delay of frame) = 4000 + 500 =4500 s Effective throughput is =1500* 8 bits / 4500 s=2.66 Mbps (3) if Single user is there then this user transmit frame and after releasing last bit of data frame user releases the token, token circulates in ring then comes back to user then user can transmit another frame. So total delay in transmitting a frame= Tx + Tp(propagation delay of token) = 4000 + 500 =4500 s Effective throughput is =1500* 8 bits / 4500 s=2.66 Mbps

(4) if many users are there then sender transmit frame and after transmitting last bit of frame sender releases the token, token is occupied by other user in the ring, so other user can transmit his frame. So total delay in transmitting a frame= Tx = 4000 =4000 s Effective throughput is =1500* 8 bits / 4000 s=3 Mbps Statement for Linked Answer Questions 18 and 19: Consider a token ring topology with N stations (numbered 1 to N) running token ring protocol where the stations are equally spaced. When a station gets the token it is allowed to send one frame of fixed size. Ring latency is tp ,while the transmission time of frame is tx. all other latencies can be neglected Q18. maximum utilization of the token ring when tx=3 ms, tp = 5 ms, N=10 is (a) 0.545 (b) 0.6 (c) 0.857 (d) 0.961 IT2007

Ans. c Explanation: If tx < tp Maximum utilization can be achieved by using early token release. Maximum utilization in delayed token release token ring= tx / (tx +tp /N)=3/(3 +5/10)=3/3.5=0.857 Note: here, if you use delayed token release then Maximum utilization in token release token ring= tx / (tp +tp /N)=3/(5 +5/10)=3/5.5=0.545 Which less than the utilization in delayed token release. Q19. The maximum utilization of the token ring when tx=5 ms, tp = 3 ms, N=15 is (a) 0.545 (b) 0.655 (c) 0.9375 (d) 0.961 IT2007

Ans. d Explanation: If tx >tp Maximum utilization in delayed token release token ring(in this case we cant use early token release)= tx / (tp +tp /N) =5/(3 +3/15)=3/3.2=0.961

NETWORK LAYER
The network layer is concerned with getting packets from the source all the way to the destination. The packets may require to make many hops at the intermediate routers while reaching the destination. This is the lowest layer that deals with end to end transmission. In order to achieve its goals, the network layer must know about the topology of the communication network. It must also take care to choose routes to avoid overloading of some of the communication lines while leaving others idle. The network layer-transport layer interface frequently is the interface between the carrier and the customer, that is the boundary of the subnet. The functions of this layer include: 1. Routing - The process of transferring packets received from the Data Link Layer of the source network to the Data Link Layer of the correct destination network is called routing. Involves decision making at each intermediate node on where to send the packet next so that it eventually reaches its destination. The node which makes this choice is called a router. For routing we require some mode of addressing which is recognized by the Network Layer. This addressing is different from the MAC layer addressing. 2. Inter-networking - The network layer is the same across all physical networks (such as Token-Ring and Ethernet). Thus, if two physically different networks have to communicate, the packets that arrive at the Data Link Layer of the node which connects these two physically different networks, would be stripped of their headers and passed to the Network Layer. The network layer would then pass this data to the Data Link Layer of the other physical network.. 3. Congestion Control - If the incoming rate of the packets arriving at any router is more than the outgoing rate, then congestion is said to occur. Congestion may be caused by many factors. If suddenly, packets begin arriving on many input lines and all need the same output line, then a queue will build up. If there is insufficient memory to hold all of them, packets will be lost. But even if routers have an infinite amount of memory, congestion gets worse, because by the time

packets reach to the front of the queue, they have already timed out (repeatedly), and duplicates have been sent. All these packets are dutifully forwarded to the next router, increasing the load all the way to the destination. Another reason for congestion are slow processors. If the router's CPUs are slow at performing the bookkeeping tasks required of them, queues can build up, even though there is excess line capacity. Similarly, low-bandwidth lines can also cause congestion. Addressing Scheme IP addresses are of 4 bytes and consist of : i) The network address, followed by ii) The host address The first part identifies a network on which the host resides and the second part identifies the particular host on the given network. Some nodes which have more than one interface to a network must be assigned separate internet addresses for each interface. This multi-layer addressing makes it easier to find and deliver data to the destination. A fixed size for each of these would lead to wastage or under-usage that is either there will be too many network addresses and few hosts in each (which causes problems for routers who route based on the network address) or there will be very few network addresses and lots of hosts (which will be a waste for small network requirements). Thus, we do away with any notion of fixed sizes for the network and host addresses. Q20. Which of the following assertion is FALSE about the Internal Protocol (IP) ? (A) It is possible for a computer to have multiple IP address. (B) IP packets from the same source to the same destination take different routes in the network. (C) IP ensures a packet is discarded if it is unable to reach its destination within a given number of hopes. (D) packet source cannot set route of outgoing packets; the route is determined only by routing tables in the routers on the way. CS2003 Ans. A Explanation: A computer can have only one IP address. If a Computer have multiple interfaces then each interface is assigned different IP address and each interface is treated as separate entity in network. We classify networks as follows: 1. Large Networks : 8-bit network address and 24-bit host address. There are approximately 16 million hosts per network and a maximum of 126 ( 2 7 - 2 ) Class A networks can be defined. The calculation requires that 2 be subtracted because 0.0.0.0 is reserved for use as the default route and 127.0.0.0 be reserved for the loop back function. Moreover each Class A network can support a maximum of 16,777,214 (224 - 2) hosts per network. The host calculation requires that 2 be subtracted because all 0's are reserved to identify the network itself and all 1s are reserved for broadcast addresses. The reserved numbers may not be assigned to individual hosts. 2. Medium Networks : 16-bit network address and 16-bit host address. There are approximately 65000 hosts per network and a maximum of 16,384 (2 14) Class B networks can be defined with up to (216-2) hosts per network. 3. Small networks : 24-bit network address and 8-bit host address. There are approximately 250 hosts per network. Address Classes The IP specifications divide addresses into the following classes : Class A - For large networks 0 7 bits of the network address 24 bits of host address Class B - For medium networks 1 0 14 bits of the network address

16 bits of host address

Class C - For small networks 1 1 0 21 bits of the network address

8 bits of host address

Class D - For multi-cast messages ( multi-cast to a "group" of networks ) 1 1 1 0 28 bits for some sort of group address Class E - Currently unused, reserved for potential uses in the future 1 1 1 1 28 bits Internet Protocol Special Addresses : There are some special IP addresses : 1. Broadcast Addresses They are of two types : (i) Limited Broadcast : It consists of all 1's, i.e., the address is 255.255.255.255 . It is used only on the LAN, and not for any external network. (ii) Directed Broadcast : It consists of the network number + all other bits as1's. It reaches the router corresponding to the network number, and from there it broadcasts to all the nodes in the network. This method is a major security problem, and is not used anymore. So now if we find that all the bits are 1 in the host no. field, then the packet is simply dropped. Therefore, now we can only do broadcast in our own network using Limited Broadcast. 2. Network ID = 0 It means we are referring to this network and for local broadcast we make the host ID zero. 3. Host ID = 0 This is used to refer to the entire network in the routing table. 4. Loop-back Address Here we have addresses of the type 127.x.y.z It goes down way upto the IP layer and comes back to the application layer on the same host. This is used to test network applications before they are used commercially. Subnetting Sub netting means organizing hierarchies within the network by dividing the host ID as per our network. For example consider the network ID : 150.29.x.y We could organize the remaining 16 bits in any way, like : 8 bits department 8 bits host This gives some structure to the host IDs. This division is not visible to the outside world. They still see just the network number, and host number (as a whole). The network will have an internal routing table which stores information about which router to send an address to. Now consider the case where we have : 8 bits - subnet number, and 8 bits - host number. Each router on the network must know about all subnet numbers. This is called the subnet mask. We put the network number and subnet number bits as 1 and the host bits as 0. Therefore, in this example the subnet mask becomes : 255.255.255.0 . The hosts also need to know the subnet mask when they send a packet. To find if two addresses are on the same subnet, we can AND source address with subnet mask, and destination address with subnet mask, and see if the two results are the same. The basic reason for sub netting was avoiding broadcast. But if at the lower level, our switches are smart enough to send directed messages, then we do not need sub netting. However, sub netting has some security related advantages. Q21. The subnet mask for a particular network is 255.255.31.0. Which of the following pairs of IP addresses could belong to this network? (A) 172.57.88.62 and 172.56.87.233 (B) 10.35.28.2 and 10.35.29.4 (C) 191.203.31.87 and 191.234.31.88 (D) 128.8.129.43 and 128.8.161.55 CS2003 Ans.D

Explanation: To find whether hosts belong to sane network or not , we have to find their net id, if net id is same then hosts belong to same network and net id can be find by ANDing subnet mask and IP address. Note: 255 means all 8 bits 1. So ANDing with 255 results same. e.g. 172 AND 255 =172 Similarly, 0 means all 8 bit 0. So ANDing with 0 results 0. e.g. 172 AND 0 =0 In above question , first two octet of subnet mask is 255, ANDing with first two octet of IP address results same octets. Only in option B and D first two octet are same. So option A and C can be discarded. Fourth octet of subnet mask is 0, ANDing with 0 results 0 , this does not create difference. Now, consider third octet of subnet mask and IP addresses 31=00011111 (B) 28 = 00011100 29 = 31 = 00011111 AND 31= 00011100 =28 Both results are different, Option B is incorrect. (D) 129 = 10000001 161 = 31 = 00011111 AND 31= 00000001 =1 Both results are same, Option D is correct. 00011101 00011111 00011101 11000001 00011111 00000001 AND =29 AND =1

Supernetting This is moving towards class-less addressing. We could say that the network number is 21 bits ( for 8 class C networks ) or say that it is 24 bits and 7 numbers following that. For example : a.b.c.d / 21 This means only look at the first 21 bits as the network address. Q22. An organization has a class B network and wishes to form subnets for 64 departments. The subnet mask would be: (a) 255.255.0.0 (b) 255.255.64.0 (c) 255.255.128.0 (d) 255.255.252.0 CS2005 Ans. d Explanation: Organization have 64 departments, and to assign 64 subnet we need 6 bits for subnet. In Class B network first two octet are reserved for net id, so we take first 6 bit of third octet for subnets and subnet mask should be 255.255.11111100.00000000 = 255.255.252.0 Packet Structure Version Header Type of Service Number Length (4 (8 bits) (4 bits) bits) ID (16 bits) Time To Live (8 bits) Protocol (8 bits) Flags (3bits)

Total Length (16 bits) Flag Offset (13 bits)

Header Checksum (16 bits)

Source (32 bits) Destination (32 bits) Options Version Number : The current version is Version 4 (0100). 1. Header Length : We could have multiple sized headers so we need this field. Header will always be a multiple of 4bytes and so we can have a maximum length of the field as 15, so the maximum size of the header is 60 bytes ( 20 bytes are mandatory ).

2. Type Of Service (ToS): This helps the router in taking the right routing decisions. The structure is:

First three bits : They specify the precedence i.e. the priority of the packets. Next three bits : o D bit - D stands for delay. If the D bit is set to 1, then this means that the application is delay sensitive, so we should try to route the packet with minimum delay. o T bit - T stands for throughput. This tells us that this particular operation is throughput sensitive. o R bit - R stands for reliability. This tells us that we should route this packet through a more reliable network. Last two bits: The last two bits are never used. Unfortunately, no router in this world looks at these bits and so no application sets them nowadays. The second word is meant for handling fragmentations. If a link cannot transmit large packets, then we fragment the packet and put sufficient information in the header for recollection at the destination. 3. ID Field : The source and ID field together will represent the fragments of a unique packet. So each fragment will have a different ID. 4. Offset : It is a 13 bit field that represents where in the packet, the current fragment starts. Each bit represents 8 bytes of the packet. So the packet size can be at most 64 kB. Every fragment except the last one must have its size in bytes as a multiple of 8 in order to ensure compliance with this structure. The reason why the position of a fragment is given as an offset value instead of simply numbering each packet is because refragmentation may occur somewhere on the path to the other node. Fragmentation, though supported by IPv4 is not encouraged. This is because if even one fragment is lost the entire packet needs to be discarded. A quantity M.T.U (Maximum Transmission Unit) is defined for each link in the route. It is the size of the largest packet that can be handled by the link. The Path-M.T.U is then defined as the size of the largest packet that can be handled by the path. It is the smallest of all the MTUs along the path. Given information about the path MTU we can send packets with sizes smaller than the path MTU and thus prevent fragmentation. This will not completely prevent it because routing tables may change leading to a change in the path. Following information pertains to Q 23 and Q24 Consider three IP networks A, B and C. Host HA in networks A sends messages each containing 180 bytes of application data to a host HC in network C. The TCP layer prefixes a 20 byte header to the message. This passes through an intermediate network B. the maximum packet size, including 20 byte IP header, in each network is: A : 1000 bytes B : 100 bytes C : 1000 bytes The network A and B are connected through a 1 Mbps link, while B and C are connected by a 512 Kbps link (bps = bits per second). 1 Mbps 512 Kbps

Network A

Network B

Network C

Q23. Assuming that the packets are correctly delivered, how many bytes, including headers, are delivered to the IP layer at the destination for one application message, in the best case? Consider only data packets. (a) 200 (b) 220 (c) 240 (d) 260 CS2004 Ans. d Explanation: Application data is 180 bytes. TCP layer add 20 bytes to it and passes to IP layer, data for IP layer becomes 200 byte. HA send packet by adding 20 byte of ip header, So total size of IP

packet is 220 bytes. Since, maximum packet size for packet in network A is 1000 bytes , there will be no fragmentation at network A. IP Layer at Network B removes IP header and receive 200 bytes of data. Network B has Maximum packet size 100 bytes including 20 byte ip header, network B divide data in 80 bytes fragments and add 20 byte of IP header to it. Data will be divided in three packets as. First packet: 80 bytes + 20 byte of header Second packet: 80 bytes + 20 byte of header Third packet: 40 bytes + 20 byte of header Note : Defragmentaion(grouping of fragments) is done only at destination. HC will receive total 260 bytes including header. Q24. What is the rate at which application data is transferred to host H? Ignore errors, acknowledgements, and other overheads. (a) 325.5 Kbps (b) 354.5 Kbps (c) 409.6 Kbps (d) 512.0 Kbps CS2004 Ans. b Explanation: HC will receive 260 bytes in which only 180 bytes are of application data. Application data is transferred at rate of (180/260) x 512 Kbps=354.46 Kbps
5. Flags :It has three bits -

M bit : If M is one, then there are more fragments on the way and if M is 0, then it is the last fragment o DF bit : If this bit is sent to 1, then we should not fragment such a packet. o Reserved bit : This bit is not used. Note: Reassembly can be done only at the destination and not at any intermediate node. This is because we are considering Datagram Service and so it is not guaranteed that all the fragments of the packet will be sent thorough the node at which we wish to do reassembly. 6. Total Length : It includes the IP header and everything that comes after it. 7. Time To Live (TTL) : Using this field, we can set the time within which the packet should be delivered or else destroyed. It is strictly treated as the number of hops. The packet should reach the destination in this number of hops. Every router decreases the value as the packet goes through it and if this value becomes zero at a particular router, it can be destroyed. 8. Protocol : This specifies the module to which we should hand over the packet ( UDP or TCP ). It is the next encapsulated protocol. 9. Header Checksum : This is the usual checksum field used to detect errors. Since the TTL field is changing at every router so the header checksum ( upto the options field ) is checked and recalculated at every router. 10. Source : It is the IP address of the source node 11. Destination : It is the IP address of the destination node. 12. IP Options : The options field was created in order to allow features to be added into IP as time passes and requirements change. Currently 5 options are specified although not all routers support them.
o

Q25. For which one of the following reasons does Internet Protocol (IP) use the time-to-live (TTL) field in the IP datagram header? (A) Ensure packets reach destination within that time (B) Discard packets that reach later than that time (C) Prevent packets from looping indefinitely (D) Limit the time for which a packet gets queued in intermediate routers. CS2006 Ans. C

Q26. In a packet switching network, packets are routed from source to destination along a single path having two intermediate nodes. If the message size is 24 bytes and each packet contains a header of 3 bytes, then the optimum packet size is: (a) 4 (b) 6 (c) 7 (d) 9 CS2005 Ans. d Explanation: Data in Packet require to packets transmit 24 byte of data 4 4-3=1 24 6 6-3=3 8 7 7-3=4 6 9 9-3=6 4 Packet size 9 have minimum header overhead. Packet size Total header overhead 24*3=72 bytes 8*3=24 bytes 6*3=18 bytes 4*3=12 bytes

ROUTING ALGORITHMS
The routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on. If the subnet uses datagrams internally, this decision must be made anew for every arriving data packet since the best route may have changed since last time. If the subnet uses virtual circuits internally, routing decisions are made only when a new virtual circuit is being set up. Thereafter, data packets just follow the previously-established route. The latter case is sometimes called session routing because a route remains in force for an entire user session (e.g., a login session at a terminal or a file transfer). Q27. The routing table of a router is shown below: Destination Subnet Mask Interface 128.75.43.0 255.255.255.0 Eth0 128.75.43.0 255.255.255.128 Eth1 192.12.17.5 255.255.255.255 Eth3 Default Eth2 On which interface will the router forward packets addressed to destinations 128.75.43.16 and 192.12.17.10 respectively? (a) Eth1 and Eth2 (b) Eth0 and Eth2 (c) Eth0 and Eth3 (d) Eth1 and Eth3 CS2004 Ans. A Explanation: Router decides route for packet by ANDing subnet mask and ip address. If results of ANDing subnet masks and ip address are same then subnet mask with higher number of 1s is preferred. IP address 128.75.43.16 is AND with 255.255.255.0 results 128.75.43.0 net id which is similar to destination of this mask, but ANDing 128.75.43.16 with 255.255.255.128 also results same destination. So, here, mask with higher number of one is considered and router will forward packet to Eth1. ANDing 192.12.17.10 with three subnet mask in table does not result in destination net id so router will forward this packet to default network via Eth2. Routing algorithms can be grouped into two major classes: nonadaptive and adaptive. Nonadaptive algorithms do not base their routing decisions on measurements or estimates of the current traffic and topology. Instead, the choice of the route to use to get from I to J (for all I and J) is computed in advance, off-line, and downloaded to the routers when the network is booted. This procedure is

sometimes called static routing. Adaptive algorithms, in contrast, change their routing decisions to reflect changes in the topology, and usually the traffic as well. NONADAPTIVE ALGORITHMS Shortest Path Routing : The idea is to build a graph of the subnet, with each node of the graph representing a router and each arc of the graph representing a communication line (often called a link). To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph. One way of measuring path length is the number of hops. Using this metric, the paths ABC and ABE in Figure are equally long. Another metric is the geographic distance in kilometers, in which case ABC is clearly much longer than ABE. In the general case, the labels on the arcs could be computed as a function of the distance, bandwidth, average traffic, communication cost, mean queue length, measured delay, and other factors. Flooding Another static algorithm is flooding, in which every incoming packet is sent out on every outgoing line except the one it arrived on. Flooding obviously generates vast numbers of duplicate packets, in fact, an infinite number unless some measures are taken to damp the process. One such measure is to have a hop counter contained in the header of each packet, which is decremented at each hop, with the packet being discarded when the counter reaches zero. Ideally, the hop counter should be initialized to the length of the path from source to destination. If the sender does not know how long the path is, it can initialize the counter to the worst case, namely, the full diameter of the subnet. A variation of flooding that is slightly more practical is selective flooding. In this algorithm the routers do not send every incoming packet out on every line, only on those lines that are going approximately in the right direction. ADAPTIVE ALGORITHM Distance Vector Routing: This algorithms operate by having each router maintain a table (i.e, a vector) giving the best known distance to each destination and which line to use to get there. These tables are updated by exchanging information with the neighbors. The distance vector routing algorithm is sometimes called by other names, most commonly the distributed Bellman-Ford routing algorithm and the Ford-Fulkerson algorithm, after the researchers who developed it (Bellman, 1957; and Ford and Fulkerson, 1962). In distance vector routing, each router maintains a routing table indexed by, and containing one entry for, each router in the subnet. This entry contains two parts: the preferred outgoing line to use for that destination and an estimate of the time or distance to that destination. The metric used might be number of hops, time delay in milliseconds, total number of packets queued along the path, or something similar. The router is assumed to know the ''distance'' to each of its neighbors. If the metric is hops, the distance is just one hop. If the metric is queue length, the router simply examines each queue. If the metric

is delay, the router can measure it directly with special ECHO packets that the receiver just timestamps and sends back as fast as it can. As an example, assume that delay is used as a metric and that the router knows the delay to each of its neighbors. Once every T msec each router sends to each neighbor a list of its estimated delays to each destination. It also receives a similar list from each neighbor. Imagine that one of these tables has just come in from neighbor X, with Xi being X's estimate of how long it takes to get to router i. If the router knows that the delay to X is m msec, it also knows that it can reach router i via X in Xi + m msec. By performing this calculation for each neighbor, a router can find out which estimate seems the best and use that estimate and the corresponding line in its new routing table. Note that the old routing table is not used in the calculation. This updating process is illustrated in Figure. Part (a) shows a subnet. The first four columns of part (b) show the delay vectors received from the neighbors of router J. A claims to have a 12-msec delay to B, a 25-msec delay to C, a 40-msec delay to D, etc. Suppose that J has measured or estimated its delay to its neighbors, A, I, H, and K as 8, 10, 12, and 6 msec, respectively. Note: DVR is pretty expensive: it turns out to be O(n3) which is too high for a fast convergence. Q28. For the network given in the figure below, the routing table of four nodes A,E,D and G are shown. Suppose that F has estimated its delay to its neighbors A,E,D and G as 8, 10, 12 and 6 msecs respectively and updates its routing table using distance vector routing technique. A C E F Routing table of A A 0 B 40 C 14 D 17 E 21 F 9 G 24 Routing table of G A 21 B 24 C 22 D 19 E 22 F 10 G 0 B D G

which one of the following options represents the updated routing table of F? (a) (b) (c) A B C D E F G 8 20 17 12 10 0 6 IT2007 Ans. a Explanation: F update its routing table with minimum distance to other destination according to routing table of A, E, D and G. Calculate distance of stations from to via A,E,D and G

(d) A B C D E F G 8 8 7 12 10 0 6

To Stations

Via A Via E Via D Via G (8 ms + entries (10ms+ entries (12ms+ entries (6ms+ entries in routing table in routing table in routing table in routing table of A) of E) of D) of G) 8 34 32 27

Min

B C D E F G

48 22 25 29 17 32

37 17 30 10 21 32

20 42 12 26 19 34

30 28 25 28 16 6

20 17 12 10 0 (distance from F to F is 0) 6

So routing table of F is option a. Drawbacks of Distance Vector Routing Algorithm: Count to infinity Problem: In distance vector routing good news(when a router is up) travels fast and bad news(when a router is down) travels slowly. When A comes up, the other routers learn about it via the vector exchanges. At the time of the first exchange, B learns that its left neighbor has zero delay to A. B now makes an entry in its routing table that A is one hop away to the left. All the other routers still think that A is down. At this point, the routing table entries for A are as shown in the second row of Figure (a). On the next exchange, C learns that B has a path of length 1 to A, so it updates its routing table to indicate a path of length 2, but D and E do not hear the good news until later. Clearly, the good news is spreading at the rate of one hop per exchange. In a subnet whose longest path is of length N hops, within N exchanges everyone will know about newly-revived lines and routers. Now let us consider the situation of Figure (b), in which all the lines and routers are initially up. Routers B, C, D, and E have distances to A of 1, 2, 3, and 4, respectively. Suddenly A goes down, or alternatively, the line between A and B is cut, which is effectively the same thing from B's point of view. At the first packet exchange, B does not hear anything from A. Fortunately, C says: Do not worry; I have a path to A of length 2. Little does B know that C's path runs through B itself. For all B knows, C might have ten lines all with separate paths to A of length 2. As a result, B thinks it can reach A via C, with a path length of 3. D and E do not update their entries for A on the first exchange. On the second exchange, C notices that each of its neighbors claims to have a path to A of length 3. It picks one of the them at random and makes its new distance to A 4, as shown in the third row of Figure (b). Subsequent exchanges produce the history shown in the rest of Figure(b). From this figure, it should be clear why bad news travels slowly: no router ever has a value more than one higher than the minimum of all its neighbors. Gradually, all routers work their way up to infinity, but the number of exchanges required depends on the numerical value used for infinity. For this reason, it is wise to set infinity to the longest path plus 1. If the metric is time delay, there is no welldefined upper bound, so a high value is needed to prevent a path with a long delay from being treated as down. T this problem is known as the count-to-infinity problem. Statement for Linked Answer Questions 29 and 30: Consider a simple graph with unit edge costs. Each node in the graph represents a router. Each node maintains a routing table indicating the next hop router to be used to relay a packet to its destination and the cost of the path to the destination through that router. Initially, the routing table is empty. The routing table is synchronously updated as follows. In each updation interval, three tasks are performed.

(i) A node determines whether its neighbors in the graph are accessible. If so, it sets the tentative cost to each accessible neighbor as 1. Otherwise, the cost is set to infinity . (ii) From each accessible neighbor, it gets the costs to relay to other nodes via that neighbor (as the next hop) (iii) Each node updates its routing table based on the information received in the previous two steps by choosing the minimum cost. Q29. For the Graphs given above, possible routing tables for various nodes after they have stabilized, are shown in th following options. Identify the correct table. (A) Table for node A (B) Table for node C (C) Table for node B (D) Table for node D A B C D E F B B C E F 3 1 2 1 1 IT2005 Ans. C Explanation: (A) entry for D, E and F are wrong. D and E are at distance of 2 hops from A and F is at distance of 3 hops from A (B) Entry for F is Wrong. F is at distance of 2 hops from C via D (D) entries for A and C are wrong. Q30. Continuing from the earlier problem, suppose at some time t, when the costs have stabilized, node A goes down. The cost From node F to node A at time(t + 100) is (A) >100 but finite (B) infinite (C) 3 (D) >3 and 100 IT2005 Ans. A Explanation: According to count to infinity problem after t+100 time cost will be >100 . It will set to infinite count reaches at its maximum limit . If count is given 8 bit and count reaches 255 then cost is set to infinity. Link State Routing: Basic idea is broadcast info on the entire network topology to all routers, and let each of them calculate a sink tree to the other routers. What a router needs to do (next to just routing): Find out who its neighbors are and get their network addresses. Calculate the cost for getting a packet to a neighbor. Construct a link state packet telling all it has just learned. Send that packet to all other routers. Use Dijkstra algorithm to find shortest path . Q31. two popular routing algorithm are distance vector (DV) and kink state (LS) routing. Which of the following are true? (S1) Count to infinity is a problem only with DV and not LS routing. (S2) In LS, the shortest path algorithm is run only at one node. (S3) In DV, the shortest path algorithm is run only at one node. (S4) DV require lesser number of network messages than LS. (a) S1, S2 and S4 only. (b) S1, S3 and S4 only. (c) S2 and S3 only.

(d) S1 and S4 only.

IT2008

Ans. d Q32. Count to infinity is a problem associated with (A) link state routing protocol (B) distance vector routing protocol (C) DNS while resolving host name (D) TCP for congestion control Ans. B

IT2005

TRANSPORT LAYER
The transport layer is responsible for completing the services of the underlying network to the extent that application development can take place: provide reliable connection-oriented services provide unreliable connectionless services provide parameters for specifying quality of services. Transport Layer Interface Example: Consider the Berkeley socket interface, which has been adopted by all UNIX systems, as well as Windows: SOCKET Create a new communication endpoint BIND Attach a local address to a socket LISTEN Announce willingness to accept N connections ACCEPT Block until someone remote wants to establish a connection CONNECT Attempt to establish a connection SEND Send data over a connection RECEIVE Receive data over a connection CLOSE Release the connection What is TCP? TCP was specifically designed to provide a reliable end to end byte stream over an unreliable internetwork. Each machine supporting TCP has a TCP transport entity either a user process or part of the kernel that manages TCP streams and interface to IP layer. A TCP entity accepts user data streams from local processes, breaks them up into pieces not exceeding 64KB and sends each piece as a separate IP datagram. Client Server mechanism is not necessary for TCP to behave properly. The IP layer gives no guarantee that datagram will be delivered properly, so it is up to TCP to timeout and retransmit, if needed. Duplicate, lost and out of sequence packets are handled using the sequence number, acknowledgements, retransmission, timers, etc to provide a reliable service. Connection is a must for this service. Bit errors are taken care of by the CRC checksum. One difference from usual sequence numbering is that each byte is given a number instead of each packet. This is done so that at the time of transmission in case of loss, data of many small packets can be combined together to get a larger packet, and hence smaller overhead. TCP connection is a duplex connection. That means there is no difference between two sides once the connection is established. TCP Connection establishment The "three-way handshake" is the procedure used to establish a connection. This procedure normally is initiated by one TCP and responded to by another TCP. The procedure also works if two TCP simultaneously initiate the procedure. When simultaneous attempt occurs, each TCP receives a "SYN" segment which carries no acknowledgment after it has sent a "SYN". Of course, the arrival of an old duplicate "SYN" segment can potentially make it appear, to the recipient, that a simultaneous connection initiation is in progress.

Question: Why is three-way handshake needed? What is the problem if we send only two packets and consider the connection established? What will be the problem from application's point of view? Will the packets be delivered to the wrong application? Problem regarding 2-way handshake: The only real problem with a 2-way handshake is that duplicate packets from a previous connection( which has been closed) between the two nodes might still be floating on the network. After a SYN has been sent to the responder, it might receive a duplicate packet of a previous connection and it would regard it as a packet from the current connection which would be undesirable. The first two figures show how a three way handshake deals with problems of duplicate/delayed connection requests and duplicate/delayed connection acknowledgements in the network. The third figure highlights the problem of spoofing associated with a two way handshake.

Some Conventions 1. The ACK contains 'x+1' if the sequence number received is 'x'. 2. If 'ISN' is the sequence number of the connection packet then 1st data packet has the seq number 'ISN+1' 3. Seq numbers are 32 bit. They are byte seq number(every byte has a seq number).With a packet 1st seq number and length of the packet is sent. 4. Acknowledgements are cumulative. 5. Acknowledgements have a seq number of their own but with a length 0.So the next data packet has the seq number same as ACK. Connection Establish The sender sends a SYN packet with sequence number say 'x'. The receiver on receiving SYN packet responds with SYN packet with sequence number 'y' and ACK with seq number 'x+1' On receiving both SYN and ACK packet, the sender responds with ACK packet with seq number 'y+1' The receiver when receives ACK packet, initiates the connection. Connection Release The initiator sends a FIN with the current sequence and acknowledgement number. The responder on receiving this informs the application program that it will receive no more data and sends an acknowledgement of the packet. The connection is now closed from one side. Now the responder will follow similar steps to close the connection from its side. Once this is done the connection will be fully closed.

Q33. Consider a TCP connection in a state where there are no outstanding ACKs. The sender sends two segments back to back. The sequence numbers of the first and second segments are 230 and 290 respectively. The first segment was lost, but the second segment was received correctly by the receiver. Let X be the amount of data carried in the first segment (in bytes), and Y be the ACK number sent by the receiver. The value of X and Y(in that order) are (a) 60 and 290 (b)230 and 291 (c)60 and 231 (d) 60 and 230 IT2007 Ans. d Explanation: In TCP sequence number is assign to each data bytes. Number of bytes in first segment is 290-230= 60 bytes. In TCP ACK number send by receiver is next expected sequence number which is 230 here, 230 is first sequence number of first byte in first segment. First segment is lost and second received correctly, but receiver send ACK with sequence number of first byte of first segment until first segment received correctly. Salient Features of TCP Piggybacking of acknowledgments: The ACK for the last received packet need not be sent as a new packet, but gets a free ride on the next outgoing data frame(using the ACK field in the frame header). The technique is temporarily delaying outgoing ACKs so that they can be hooked on the next outgoing data frame is known as piggybacking. But ACK can't be delayed for a long time if receiver(of the packet to be acknowledged) does not have any data to send. Flow and congestion control: TCP takes care of flow control by ensuring that both ends have enough resources and both can handle the speed of data transfer of each other so that none of them gets overloaded with data. The term congestion control is used in almost the same context except that resources and speed of each router is also taken care of. The main concern is network resources in the latter case. Multiplexing / Demultiplexing : Many application can be sending/receiving data at the same time. Data from all of them has to be multiplexed together. On receiving some data from lower layer, TCP has to decide which application is the recipient. This is called demultiplexing. TCP uses the concept of port number to do this. TCP segment header:

Explanation of header fields: Source and destination port :These fields identify the local endpoint of the connection. Each host may decide for itself how to allocate its own ports starting at 1024. The source and destination socket numbers together identify the connection. Sequence and ACK number : This field is used to give a sequence number to each and every byte transferred. This has an advantage over giving the sequence numbers to every packet because data of many small packets can be combined into one at the time of retransmission, if needed. The ACK signifies the next byte expected from the source and not the last byte received. The ACKs are cumulative instead of selective. Sequence number space is as large as 32-bit although 17 bits would have been enough if the packets were delivered in order. If packets reach in order, then according to the following formula: (sender's window size) + (receiver's window size) < (sequence number space) The sequence number space should be 17-bits. But packets may take different routes and reach out of order. So, we need a larger sequence number space. And for optimization, this is 32-bits.

Q34. In TCP, a unique sequence number is assigned to each (A) byte (B) word (C) segment (D)message IT2004 Ans. A

Header length :This field tells how many 32-bit words are contained in the TCP header. This is needed because the options field is of variable length. Flags : There are six one-bit flags. 1. URG : This bit indicates whether the urgent pointer field in this packet is being used. 2. ACK :This bit is set to indicate the ACK number field in this packet is valid. 3. PSH : This bit indicates PUSHed data. The receiver is requested to deliver the data to the application upon arrival and not buffer it until a full buffer has been received. 4. RST : This flag is used to reset a connection that has become confused due to a host crash or some other reason. It is also used to reject an invalid segment or refuse an attempt to open a connection. This causes an abrupt end to the connection, if it existed. 5. SYN : This bit is used to establish connections. The connection request(1st packet in 3way handshake) has SYN=1 and ACK=0. The connection reply (2nd packet in 3-way handshake) has SYN=1 and ACK=1. 6. FIN : This bit is used to release a connection. It specifies that the sender has no more fresh data to transmit. However, it will retransmit any lost or delayed packet. Also, it will continue to receive data from other side. Since SYN and FIN packets have to be acknowledged, they must have a sequence number even if they do not contain any data. Window Size : Flow control in TCP is handled using a variable-size sliding window. The Window Size field tells how many bytes may be sent starting at the byte acknowledged. Sender can send the bytes with sequence number between (ACK#) to (ACK# + window size - 1) A window size of zero is legal and says that the bytes up to and including ACK# -1 have been received, but the receiver would like no more data for the moment. Permission to send can be granted later by sending a segment with the same ACK number and a nonzero Window Size field. Checksum : This is provided for extreme reliability. It checksums the header, the data, and the conceptual pseudo-header. The pseudo-header contains the 32-bit IP address of the source and destination machines, the protocol number for TCP(6), and the byte count for the TCP segment (including the header).Including the pseudo-header in TCP checksum computation helps detect misdelivered packets, but doing so violates the protocol hierarchy since the IP addresses in it belong to the IP layer, not the TCP layer. Urgent Pointer : Indicates a byte offset from the current sequence number at which urgent data are to be found. Urgent data continues till the end of the segment. This is not used in practice. The same effect can be had by using two TCP connections, one for transferring urgent data. Options : Provides a way to add extra facilities not covered by the regular header. eg, o Maximum TCP payload that sender is willing to handle. The maximum size of segment is called MSS (Maximum Segment Size). At the time of handshake, both parties inform each other about their capacity. Minimum of the two is honored. This information is sent in the options of the SYN packets of the three way handshake. o Window scale option can be used to increase the window size. It can be specified by telling the receiver that the window size should be interpreted by shifting it left by specified number of bits. This header option allows window size up to 230. Data : This can be of variable size. TCP knows its size by looking at the IP size header.

Topics to be Discussed relating TCP 1. Maximum Segment Size : It refers to the maximum size of segment ( MSS ) that is acceptable to both ends of the connection. TCP negotiates for MSS using OPTION field. In Internet environment MSS is to be selected optimally. An arbitrarily small segment size will result in poor bandwidth utilization since Data to Overhead ratio remains low. On the other hand extremely large segment size will necessitate large IP Datagrams which require fragmentation. As there are finite chances of a fragment getting lost, segment size above "fragmentation threshold " decrease the

Throughput. Theoretically an optimum segment size is the size that results in largest IP Datagram, which do not require fragmentation anywhere enroute from source to destination. However it is very difficult to find such an optimum segment size. In system V a simple technique is used to identify MSS. If H1 and H2 are on the same network use MSS=1024. If on different networks then MSS=5000. 2. Flow Control : TCP uses Sliding Window mechanism at octet level. The window size can be variable over time. This is achieved by utilizing the concept of "Window Advertisement" based on : 1. Buffer availability at the receiver 2. Network conditions ( traffic load etc.) In the former case receiver varies its window size depending upon the space available in its buffers. The window is referred as RECEIVE WINDOW (Recv_Win). When receiver buffer begin to fill it advertises a small Recv_Win so that the sender doesnt send more data than it can accept. If all buffers are full receiver sends a "Zero" size advertisement. It stops all transmission. When buffers become available receiver advertises a Non Zero widow to resume retransmission. The sender also periodically probes the "Zero" window to avoid any deadlock if the Non Zero Window advertisement from receiver is lost. The Variable size Recv_Win provides efficient end to end flow control. The second case arises when some intermediate node ( e.g. a router ) controls the source to reduce transmission rate. Here another window referred as COGESTION WINDOW (C_Win) is utilized. Advertisement of C_Win helps to check and avoid congestion. 3. Congestion Control : Congestion is a condition of severe delay caused by an overload of datagrams at any intermediate node on the Internet. If unchecked it may feed on itself and finally the node may start dropping arriving datagrams. This can further aggravate congestion in the network resulting in congestion collapse. TCP uses two techniques to check congestion. 1. Slow Start : At the time of start of a connection no information about network conditions is available. A Recv_Win size can be agreed upon however C_Win size is not known. Any arbitrary C_Win size can not be used because it may lead to congestion. TCP acts as if the window size is equal to the minimum of ( Recv_Win & C_Win). So following algorithm is used. 1. Recv_Win=X 2. SET C_Win=1 3. for every ACK received C_Win++ Q35. In the slow start phase of the TCP congestion control algorithm, the size of the congestion window (A) does not increase (B) increases linearly (C) increases quadratically (D) increases exponentially CS2008 Ans. D Q36. On a TCP connection, current congestion window size is Congestion Window = 4 KB. The window size advertised by the received is Advertise Window = 6 KB. The last byte sent by the sender is LastByteSent = 10240 and the last byte acknowledged by the receiver is LastByteAcked = 8192. The current window size at the sender is: (A) 2048 bytes (B) 4096 bytes (C) 6144 bytes (D)8192 bytes IT2005 Ans. B Explanation: Current Window Size =min(congestion window, advertised window) Q37. Suppose that the maximum transmit window size for a TCP connection is 12000 bytes. Each packet consists of 2000 bytes. At some point of time, the connection is slow-start phase with a current transmit window of 4000 bytes. Subsequently, the transmitter receives two acknowledgements.

Assume that no packets are lost and there are no time-outs. What is the maximum possible value of the current transmit window? (A) 4000 bytes (B) 8000 bytes (C) 10000 bytes (D) 12000 bytes IT2004 Ans. B Explanation: in slow start phase if sender receive acknowledgement for a window than it enhances its current window size by one window. So, after two acknowledgement current window size will be 4000+2000+2000=8000 bytes Multiplicative decrease : This scheme is used when congestion is encountered ( ie. when a segment is lost ). It works as follows. Reduce the congestion window by half if a segment is lost and exponentially backoff the timer ( double it ) for the segments within the reduced window. If the next segment also gets lost continue the above process. For successive losses this scheme reduces traffic into the connection exponentially thus allowing the intermediate nodes to clear their queues. Once congestion ends SLOW START is used to scale up the transmission. 4. Congestion Avoidance: This procedure is used at the onset of congestion to minimize its effect on the network. When transmission is to be scaled up it should be done in such a way that it doesnt lead to congestion again. Following algorithm is used . 1. At loss of a segment SET C_Win=1 2. SET SLOW START THRESHOLD (SST) = Send_Win / 2 3. Send segment 4. If ACK Received, C_Win++ till C_Win <= SST 5. else for each ACK C_Win += 1 / C_Win 5. Time out and Retransmission : Following two schemes are used : 1. Fast Retransmit 2. Fast Recovery When a source sends a segment TCP sets a timer. If this value is set too low it will result in many unnecessary retransmissions. If set too high it results in wastage of bandwidth and hence lower throughput. In Fast Retransmit scheme the timer value is set fairly higher than the RTT. The sender can therefore detect segment loss before the timer expires. This scheme presumes that the sender will get repeated ACK for a lost packet. 6. Round Trip Time (RTT) : In Internet environment the segments may travel across different intermediate networks and through multiple routers. The networks and routers may have different delays, which may vary over time. The RTT therefore is also variable. It makes difficult to set timers. TCP allows varying timers by using an adaptive retransmission algorithm. It works as follows. 1. Note the time (t1) when a segment is sent and the time (t2) when its ACK is received. 2. Compute RTT(sample) = (t 2 - t 1 ) 3. Again Compute RTT(new) for next segment. 4. Compute Average RTT by weighted average of old and new values of RTT 5. RTT(est) = a *RTT(old) + (1-a) * RTT (new) where 0 < a < 1 A high value of 'a' makes the estimated RTT insensitive to changes that last for a short time and RTT relies on the history of the network. A low value makes it sensitive to current state of the network. A typical value of 'a' is 0.75 6. Compute Time Out = b * RTT(est) where b> 1
2.

Sequence of System Calls for Connection Oriented communication The typical set of system calls on both the machines in a connection-oriented setup is shown in Figure. The sequence of system calls that have to be made in order to setup a connection is given below. 1. The socket system call is used to obtain a socket descriptor on both the client and the server. Both these calls need not be synchronous or related in the time at which they are called. 2. Both the client and the server 'bind' to a particular port on their machines using the bind system call. This function has to be called only after a socket has been created and has to be passed the

socket descriptor returned by the socket call. Again this binding on both the machines need not be in any particular order. Moreover the binding procedure on the client is entirely optional. The bind system call requires the address family, the port number and the IP address. 3. The next call has to be listen to be made on the server. 4. The connect function is then called on the client with three arguments, namely the socket descriptor, the remote server address and the length of the address data structure. This call normally blocks until either the connection is established or is rejected. 5. The request generated by this connect call is processed by the remote server and is placed in an operating system buffer, waiting to be handed over to the application which will be calling the accept function. The accept call is the mechanism by which the networking program on the server receives that requests that have been accepted by the operating system. The accept call is a blocking system call. In case there are requests present in the system buffer, they will be returned and in case there aren't any, the call simply blocks until one arrives. 6. Finally when both connect and accept return the connection has been established. Q38. A client process P needs to make a TCP connection to a server process S. Consider the following situation: the server process S executes a socket (), a bind () and a listen () system call in that order, following which it is preempted. Subsequently, the client process P executes a socket () system call followed by connect () system call to connect to the server process S. The server process has not executed any accept () system call. Which one of the following events could take place? (A) connect () system call returns successfully (B) connect () system call blocks (C) connect () system call returns an error (D) connect () system call results in a core dump CS2008 Ans. C Explanation: Connect() System call is not blocking system call but it blocks until connection is established or rejected. If accept() is not executed at server then connection will be rejected and an error statement is returned. Q39. Consider the following statements about the timeout value used in TCP. (1) The timeout value is set to the RTT (Round Trip Time) measured during TCP connection establishment for the entire duration of the connection. (2) Appropriate RTT estimation algorithm is used to set the timeout value of TCP connection. (3) Timeout value is set to twice the propagation delay from the sender to receiver Which of the following choice hold? (a) (1) is false,but (2) and (3) are true (b) (1) and (3) are false, but (2) is true (c) (1) and (2) are false, but (3) is true (d) (1) , (2) and (3) are false Ans. b TCP Congestion Control

IT2007

If the receiver advertises a large window-size , larger than what the network en route can handle , then there will invariably be packet losses. So there will be re-transmissions as well . However , the sender cannot send all the packets for which ACK has not been received because this way it will be causing even more congestion in the network. Moreover , the sender at this point of time cannot be sure about how many packets have actually been lost . It might be that this is the only one that has been lost , and some following it have actually been received and buffered by the receiver. In that case , the sender will have unnecessarily sent a number of packets. So the re-transmission of the packets also follows slow-start mechanism. However , we do indeed need to keep an upper bound on the size of the packets as it increases in slow start, to prevent it from increasing unbounded and causing congestion. This cap is put at half the value of the segment size at which packet loss started. Congestion Window We have already seen one bound on the size of the segments sent by the receiver-namely , the receiver window that the receiver advertises . However there could be a bottleneck created by some intermediate network that is getting clogged up. The net effect is that just having the receiver window is not enough. There should be some bound relating to the congestion of the network path - congestion window captures exactly this bound. Similar to receiver window, we have another window , the Congestion Window , and the maximum size of the segments sent are bounded by the minimum of the sizes of the two windows. E.g. If the receiver says "send 8K" (size of the receiver window ) , but the sender knows that bursts of more than 4K (size of congestion window ) clog the network up, then it sends 4K. On the other hand , if the congestion window was of size 32K , then the sender would send segments of maximum size 8K. How do we calculate/manage the Congestion Window ? The size of the congestion window is initialized to 1.For every ACK received , it is incremented by 1. Another field that we maintain is threshold which is equal to half the size of the congestion window. Whenever a packet loss takes place, the congestion window is set to 1.Then we keep increasing the congestion window by 1 on every ACK received till we reach the threshold value. Thereafter, we increment the congestion window size by 1 after every round trip time. Notice that TCP always tries to keep the flow rate slightly below the maximum value. So if the network traffic fluctuates slightly, then a lot of packets might be lost. Packet losses cause a terrible loss in throughput. In all these schemes, we have been assuming that any packet loss occurs only due to network congestion. What happens if some packet loss occurs not due to some congestion but due to some random factors? When a packet is lost, the congestion window size is set to 1. Then when we retransmit the packet, if we receive a cumulative ACK for a lot of subsequent packets, we can assume that the packet loss was not due to congestion, but because of some random factors. So we give up slow start and straightaway set the size of Congestion Window to the threshold value. Silly Window Syndrome This happens when the application supplying data to the sender does do in large chunks, but the application taking data from receiver (probably an interactive application) does it in very small chunks, say 1 byte at a time. The sender keeps advertising windows of size 1 byte each as the application consumes the bytes one at a time. Clark's Solution to this problem We try to prevent the sender from advertising very small windows. The sender should try to wait until it has accumulated enough space in the window to send a full segment or half the receiver's buffer size, which it can estimate from the pattern of window updates that it received in the past. Another problem: What if the same behavior is shown by an interactive application at the sender's end ? That is , what if the sender keeps sending in segments of very small size? Nagle's algorithm when data comes to the sender one byte at a time , send the first byte and buffer all the remaining bytes till the outstanding byte is acknowledged. Then send all the buffered characters in one segment

and start buffering again till they are acknowledged. It can help reduce the bandwidth usage for example when the user is typing quickly into a telnet connection and the network is slow . Persistent Timer Consider the following deadlock situation . The receiver sends an ACK with 0 sized window, telling the sender to wait. Later it send an ACK with non-zero window, but this ACK packet gets lost. Then both the receiver and the sender will be waiting for each other to do something. So we keep another timer. When this timer goes off, the sender transmits a probe packet to the sender with an ACK number that is old. The receiver responds with an ACK with updated window size and transmission resumes.

UDP (USER DATAGRAM PROTOCOL)


UDP -- like its cousin the Transmission Control Protocol (TCP) -- sits directly on top of the base Internet Protocol (IP). In general, UDP implements a fairly "lightweight" layer above the Internet Protocol. It seems at first site that similar service is provided by both UDP and IP, namely transfer of data.But we need UDP for multiplexing/demultiplexing of addresses. UDP's main purpose is to abstract network traffic in the form of datagrams. A datagram comprises one single "unit" of binary data; the first eight (8) bytes of a datagram contain the header information and the remaining bytes contain the data itself. UDP Headers The UDP header consists of four (4) fields of two bytes each: Source Port Length

Destination Port checksum

source port number destination port number datagram size checksum

UDP port numbers allow different applications to maintain their own "channels" for data; both UDP and TCP use this mechanism to support multiple applications sending and receiving data concurrently. The sending application (that could be a client or a server) sends UDP datagrams through the source port, and the recipient of the packet accepts this datagram through the destination port. Some applications use static port numbers that are reserved for or registered to the application. Other applications use dynamic (unregistered) port numbers. Because the UDP port headers are two bytes long, valid port numbers range from 0 to 65535; by convention, values above 49151 represent dynamic ports. The datagram size is a simple count of the number of bytes contained in the header and data sections . Because the header length is a fixed size, this field essentially refers to the length of the variable-sized data portion (sometimes called the payload). The maximum size of a datagram varies depending on the operating environment. With a two-byte size field, the theoretical maximum size is 65535 bytes. However, some implementations of UDP restrict the datagram to a smaller number -- sometimes as low as 8192 bytes. UDP checksums work as a safety feature. The checksum value represents an encoding of the datagram data that is calculated first by the sender and later by the receiver. Should an individual datagram be tampered with (due to a hacker) or get corrupted during transmission (due to line noise, for example), the calculations of the sender and receiver will not match, and the UDP protocol will detect this error. The algorithm is not fool-proof, but it is effective in many cases. In UDP, check summing is optional -- turning it off squeezes a little extra performance from the system -- as opposed to TCP where checksums are mandatory. It should be remembered that check summing is optional only for the sender, not the receiver. If the sender has used checksum then it is mandatory for the receiver to do so.

Usage of the Checksum in UDP is optional. In case the sender does not use it, it sets the checksum field to all 0's. Now if the sender computes the checksum then the recipient must also compute the checksum an set the field accordingly. If the checksum is calculated and turns out to be all 1's then the sender sends all 1's instead of all 0's. This is since in the algorithm for checksum computation used by UDP, a checksum of all 1's if equivalent to a checksum of all 0's. Now the checksum field is unambiguous for the recipient, if it is all 0's then checksum has not been used, in any other case the checksum has to be computed. Q40. Packets of the same session may be routed through different paths in: (a) TCP, but not UDP (b) TCP and UDP (c) UDP, but not TCP (d) Neither TCP nor UDP Ans. b Q41. Which one of the following uses UDP as the transport protocol? (A) HTTP (B) Telnet (C) DNS (D) SMTP Ans. C Q42. Which of the following statements are true? (S1) TCP handles both congestion and flow control. (S2) UDP handles congestion but not flow control (S3) Fast retransmit deals with congestion but not flow control. (S4) Slow start mechanism deals with both congestion and flow control. (a) S1, S2 and S3 only. (b) S1 and S3 only. (c) S3 and S4 only. (d) S1,S3 and S4 only. Ans. d CS2007

CS2005

IT2008

Q43. A program on machine X attempts to open a UDP connection to port 5376 on a machine Y, and a TCP connection to port 8632 on machine Z. However, there are no application listening at the corresponding ports on Y and Z. An ICMP port unreachable error will be generated by (a) Y but not Z (b) Z but not Y (c) neither Y nor Z (d) both Y and Z IT2006 Ans. a Explanation: TCP is connection oriented protocol and unreachability of a port can be detect by using Timed Out option of timer in TCP(if acknowledgement not returned in RTT then timed out occurs). But in UDP there is no acknowledgement, So to inform sender that receiver is not reachable ICMP is used by router.

NETWORK SECURITY
Data on the network is analogous to possessions of a person. It has to be kept secure from others with malicious intent. This intent ranges from bringing down servers on the network to using people's private information like credit card numbers to sabotage of major organizations with a presence on a network. To secure data, one has to ensure that it makes sense only to those for whom it is meant. This is the case for data transactions where we want to prevent eavesdroppers from listening to and stealing data. Other aspects of security involve protecting user data on a computer by providing password restricted access to the data and maybe some resources so that only authorized people get to use these,

and identifying miscreants and thwarting their attempts to cause damage to the network among other things. The various issues in Network security are as follows : 1. Authentication: We have to check that the person who has requested for something or has sent an e-mail is indeed allowed to do so. In this process we will also look at how the person authenticates his identity to a remote machine. 2. Integrity: We have to check that the message which we have received is indeed the message which was sent. Here CRC will not be enough because somebody may deliberately change the data. Nobody along the route should be able to change the data. 3. Confidentiality: Nobody should be able to read the data on the way so we need Encryption 4. Non-repudiation: Once we sent a message, there should be no way that we can deny sending it and we have to accept that we had sent it. 5. Authorization: This refers to the kind of service which is allowed for a particular client. Even though a user is authenticated we may decide not to authorize him to use a particular service. Terms used in network security Plain text- actual data to transmit. Cipher text- data after encryption of plain text. Cryptography- how to convert plain text to cipher text. Crypto analyst- person who breaks or makes cipher. Encryption Strategies 1. Substitution cipher: in this, characters in data is substituted by another character using a key. If key =2 then A is substituted by C,B by D, C by E,,Y by A and Z by B. Breaking of this encryption is easy. To brake this encryption only thing we have to do is to find key , which can be easily find by using loop for 26 time in worst case. 2. Random Cipher : in this each character is replaced by random character. Breaking of this encryption is little harder than substitution cipher but yet too easy for computer. To brake this encryption we have to find every possible combination of 26 letters which can be find by using loop for 26! time in worst case. 3. Transposition cipher: in this, order of text is changed. 4. One time pad: in this, data is XORed with a key. Because of cyclic nature of XOR operator actua data can be decrypted from cipher using same key. Let K is 8 bit key , P is 8 bit plain text and C is 8 bit cipher text, then C=PK and P=CK This technique dose not break but can be fail if bit pattern is corrupted. For authentication, if two persons know a secret then we just need to prove that no third person could have generated the message. But for Non-repudiation we need to prove that even the sender could not have generated the message. So authentication is easier than Non-repudiation. To ensure all this, we take the help of cryptography. We can have two kinds of encryption : 1. Symmetric Key Encryption: There is a single key which is shared between the two users and the same key is used for encrypting and decrypting the message. 2. Public Key Encryption: There are two keys with each user : a public key and a private key. The public key of a user is known to all but the private key is not known to anyone except the owner of the key. If a user encrypts a message in his private key then it can be decrypted by anyone by using the sender's public key. To send a message securely, we encrypt the message in the public key of the receiver which can only be decrypted by the user with his private key. Symmetric key encryption is much faster and efficient in terms of performance. But it does not give us Non-repudiation. And there is a problem of how do the two sides agree on the key to be used assuming that the channel is insecure ( others may snoop on our packet ). In symmetric key exchange, we need some amount of public key encryption for authentication. However, in public key encryption, we can send the public key in plain text and so key exchange is trivial. But this does not authenticate anybody. So along with the public key, there needs to be a certificate. Hence we would need a public key infrastructure to distribute such certificates in the world.

Q44. The total number of keys required for a set of n individuals to be able to communicate with each other using secret key and public key cryptosystem, respectively are: (a) n(n-1) and 2n (b)2n and n(n-1)/2 (c) n(n-1)/2 and 2n (d) n(n-1)/2 and n IT2008 Ans. c Explanation: if n individual communicate using secret key or symmetric key technique then unique key is required for each connection. Total possible connections are nC2=n(n-1)/2 And if n individual communicate using public key or Asymmetric key technique then each individual should have public and private key pair. So total number of key= 2n RSA- an Asymmetric key Algorithm Choose two distinct large prime numbers p and q Compute n =pq Compute (n)=(p-1)(q-1) Choose an integer e such that 1 < d < (n) . d and (n) must not have common factor other than 1. d is public key. Compute e to satisfy congruence relation d *e 1 mod (n) or d*e = 1+ k* (n) where k is some constant integer. e is private key. Example: let p=3 and q=5 then n= 15 and (n)=8 d can be 3 , 5 or 7 If d=7 then If d=5 If d=3 7e = 1+8k 5e=8k+1 3e=8k+1 At k=6 e =7 At k=3 e=5 At k =1 e=3 Private key and public key must be different so to get different values of e and d always choose large values of p and q. Let M is message and M is encrypted message then At sender message is encrypted using private key M= Me mod (n) At receiver decrypt using public key M= (M)d mod (n) Q45. In the RSA public key cryptosystem, the private and public keys are (e, n) and (d, n) respectively, where n=p*q and p and q are large primes. Besides, n is public and p and q are private. Let M be an integer such that 0<M<n and (n)= (p 1) (q 1). Now consider the following equations. M = Me mod n M = (M)d mod n II. ed1 mod n III. ed 1mod (n) IV. M = Me mod (n) M = (M)d mod (n) I. Which of the above equations correctly represent RSA cryptosystem? (A) I and II (B) I and III (C) II and IV (D) III and IV Ans. C CS2009

Diffie - Hellman Key Exchange A Symmetric key Algorithm A and B are two persons wishing to communicate. Both of them generate a random number each, say x and y respectively. There is a function f which has no inverse. Now A sends f(x) to B and B sends f(y) to A. So now A knows x and f(y) and B knows y and f(x). There is another function g such that g(x, f(y)) = g(y, f(x)). The key used by A is g(x, f(y)) and that used by B is g(y, f(x)). Both are actually same. The implementation of this approach is described below :
1. A has two large prime numbers n

and g. There are other conditions also that these numbers must satisfy. 2. A sends n, g and gx mod n to B in a message. B evaluates (gx mod n)y to be used as the key. 3. B sends gy mod n to A. A evaluates (gy mod n)x to be used as the key. So now both parties have the common number gxy mod n. This is the symmetric (secret communication) key used by both A and B now. This works because though the other people know n, g, gx mod n, gy mod n but still they cannot evaluate the key because they do not know either x or y. Q46. The minimum positive integer p such that 3p modulo 17=1 is (a) 5 (b)8 (c)12 (d) 16 Ans. d Q47. Exponentiation is a heavily used operation in public key cryptography. Which of the following option is tightest upper bound on the number of multiplication required to compute b n modulo m, 0b, nm? (a) O(log n) (b) O(n) (c) O(n / log n) (d) O(n) IT2007 Ans. a Q48. Suppose that two parties A and B wish to setup a common secret key (D-H key) between themselves using the Diffie-Hellman key exchange technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their respective secrets. Their D-H key is: (A) 3 (B) 4 (C) 5 (D)6 IT2005 Ans. B Explanation: D-H key is gAB mod n= 32*5 mod 7= 310 mod 7= 4 IT2007

Miscellaneous Questions
Q49. The address resolution protocol (ARP) is used for: (a) Finding the IP address from the DNS (b) Finding the IP address of the default gateway (c) Finding the IP address that corresponds to a MAC address (d) Finding the MAC address that corresponds to an IP address

CS2005

Ans. C Explanation: Address Resolution Protocol(ARP) If a machine talks to another machine in the same network, it requires its physical or MAC address. But ,since the application has given the destination's IP address it requires some mechanism to bind the IP address with its MAC address. This is done through Address Resolution protocol (ARP).IP address of the destination node is broadcast and the destination node informs the source of its MAC address. 1. Assume broadcast nature of LAN 2. Broadcast IP address of the destination 3. Destination replies it with its MAC address. 4. Source maintains a cache of IP and MAC address bindings But this means that every time machine A wants to send packets to machine B, A has to send an ARP packet to resolve the MAC address of B and hence this will increase the traffic load too much, so to reduce the communication cost computers that use ARP maintains a cache of recently acquired IP_to_MAC address bindings. Reverse Address Resolution Protocol(RARP) RARP is a protocol by which a physical machine in a local area network can request to learn its IP address from a gateway server's Address Resolution Protocol table or cache. This is needed since the machine may not have permanently attached disk where it can store its IP address permanently. Both the machine that issues the request and the server that responds use physical network addresses during their brief communication. Usually, the requester does not know the physical address. So, the request is broadcasted to all the machines on the network. Now, the requester must identify itself uniquely to the server. For this either CPU serial number or the machine's physical network address can be used. Q50. The maximum window size for data transmission using the selective reject protocol with n bit frame sequence numbers is: (a) 2n (b) 2n-1 (c) 2n 1 (d) 2n-2 CS2005 Ans. d Explanation: Maximum window size for selective reject protocol is (sequence number space)/2 For n bit of sequence number, sequence number space is 2n . Q51. In a network of LANs connected by bridges, packets are sent from one LAN to another through intermediate bridges. Since more than one path may exist between two LANs, packets may have to be routed through multiple bridges. Why is the spanning tree algorithm used for bridge-routing? (a) For shortest path routing between LANs (b) For avoiding loops in the routing paths (c) For fault tolerance (d) For minimizing collisions CS2005 Ans. b Explanation: Types of Bridges There are three types of Bridge: Simple, Self Learning and Source Routing Bridge Simple Bridge: In this table is maintained manually by network administrator. Advantage : easy to implement. Drawback: Simple bridge needs to updated manually. If a host is lost than its information will not be updated until network administrator update it and table will show host is reachable.

Self Learning Bridge: To overcome drawbacks of simple bridge self learning bridge are introduced. It update information about interfaces of system automatically. If any host lost it can detect status of host by sending a frame. Drawback: if there is loop of bridge then it is possible that a frame traverse indefinitely in loop. - To remove infinite looping of frame Spanning Tree Bridge are used. Drawback of Spanning tree bridge : when number of hosts increases it cant adopt changes or in other words it converge slowly. Source Routing Bridge: In this route is decided by source. If A wants to send data to D and it doesnt know the address of D, then it will generate a discovery frame. Bridges broadcast this frame and edit entry in the table in frame (ALAN1bridge b1LAN2D), which will be shortest path to D and when D acknowledge, it reverses the entries in table, then acknowledgement traverse reverse path and path in acknowledgement is copied by A. A store address of D temporarily and then sends data. Q52. Station A uses 32 byte packets to transmit messages to Station B using a sliding window protocol. The round trip delay between A and B is 80 milliseconds and the bottleneck bandwidth on the path between A and B is 128 kbps. What is the optimal window size that A should use? (A) 20 (B) 40 (C) 160 (D) 320 CS2006 Ans. B Explanation: Tx= 32bytes/ 128kbps=32*8/128 ms= 2ms Maximum frame that can be transferred without acknowledging is= Tp/Tx =80 / 2 =40 which is optimal window size. Q53. Two computers Cl and C2 are configured as follows. Cl has IP address 203.197.2.53 and netmask 255.255.128.0. C2 has IP address 203.197.75.201 and netmask 255.255.192.0. which one of the following statements is true? (A) Cl and C2 both assume they are on the same network (B) C2 assumes Cl is on same network, but Cl assumes C2 is on a different network (C) Cl assumes C2 is on same network, but C2 assumes Cl is on a different network (D) Cl and C2 both assume they are on different networks. CS2006 Ans.C Explanation: If C1 wants to check whether C2 is in same network or in different network then C1 ANDs IP address of C2 with C1s subnet mask , if result is same as net id of C1 then C1 assumes that C2 is in same Network. AND 255.255.128.0(subnet mask of C1) 255.255.192.0(subnet mask of C2) 203.197.2.53 203.197.0.0 203.197.0.0 203.197.75.201 203.197.0.0 203.197.64 So C1 assumes that C2 is in same network but C2 assumes C1 is on different network. Statement for Linked Answer Questions 54 & 55: Consider the diagram shown below where a number of LANs are connected by (transparent) bridges. In order to avoid packets looping through circuits in the graph, the bridges organize themselves in a spanning tree.

First, the root bridge is identified as the bridge with the least serial number. Next, the root sends out (one or more) data units to enable the setting up of the spanning tree of shortest paths from the root bridge to each bridge. Each bridge identifies a port (the root port) through which it will forward frames to the root bridge. Port conflicts are always resolved in favor of the port with the lower index value. When there is a possibility of multiple bridges forwarding to the same LAN (but not through the root port), ties are broken as follows: bridges closest to the root get preference and between such bridges, the one with the lowest serial number is preferred. Q54. For the given connection of LANs by bridges, which one of the following choices represents the depth first traversal of the spanning tree of bridges? (A) B1, B5, B3, B4, B2 (B) B1, B3, B5, B2, B4 (C) B1, B5, B2, B3, B4 (D) B1, B3, B4, B5, B2 CS2006 Ans. C Explanation: Start Depth First traversal from B1 . B5 is connected to port 1 of B1 so B5 will be traversed after B1. Port1 of B5 is connected to port1 of B2 and port2 of B3. B2 is connected with lower index port so B2 is traversed next. Port 2 Both B3 and B4 is connected with port1 of B2, but B3 is Closer to root so B3 will be traversed next. Depth First traversal is B1,B5,B2,B3,B4. Q55. Consider the correct spanning tree for the previous question. Let host H1 send out a broadcast ping packet. Which of the following options represents the correct forwarding table on B3? (A) HOSTS H1, H2, H3, H4 H5,H6, H9,H1O H7,H8,H11,H12 PORT 3 1 2 (B) HOSTS H1, H2 H3,H4 H5,H6 H7,H8.H9.H10,H11,H1 2 (D) HOSTS H1, H2, H3,H4 H5,H7, H9,H1O H7,H8 H11,H12 PORT 4 3 1 2

(C) HOSTS H3, H4 H5,H6, H9,H1O H1,H2 H7,H8,H11,H12

PORT 3 1 4 2

PORT 3 1 4 CS2006

Ans. C Explanation: Use Spanning tree generated in previous question. Q56. In a token ring network the transmission speed is 10 7 bps and the propagation speed is 200 meters/s. The 1-bit delay in this network is equivalent to: (A) 500 meters of cable. (B) 200 meters of cable. (C) 20 meters of cable. (D) 50 meters of cable. CS2007 Ans. C

Explanation: 107 bits transmits in one second . One bit transmits in 1/107 seconds=10-7 seconds 1- bit delay is equivalent to 10-7 seconds * 200 meter/ s= 20 meters of cable Q57. The address of a class B host is to be split into subnets with a 6-bit subnet number. What is the maximum number of subnets and the maximum number of hosts in each subnet? (A) 62 subnets and 262142 hosts. (B) 64 subnets and 262142 hosts. (C) 62 subnets and 1022 hosts. (D) 64 subnets and 1024 hosts. CS2007 Ans.C Explanation: in class B address first two octets are reserved for net id. First 6 bit of third octet can be use for subnet and remaining 10 bits can be used for host id. If n bits are used for subnet id then maximum number of subnets is 2 n-2 .Similarly, If n bits are used for host id then maximum number of host is 2n-2. Q58. The message 11001001 is to be transmitted using the CRC polynomial x3 + 1 to protect it from errors. The message that should be transmitted is: (A) 11001001000 (B) 11001001011 (C) 11001010 (D) 110010010011 CS2007 Ans. B Explanation: x3 + 1 is generator polynomial of degree 3and x3 + 1 = 1001 Add three zeros to the right of data, new data is 11001001000 Now divide new data by generator polynomial 1001)11001001000( 1001 01011 1001 001000 1001 0001100 1001 01010 1001 0011 Remainder is 011, add this to the new data, Message that should be transmitted is 11001001011 Q59. The distance between two stations M and N is L kilometers. All frames are K bits long. The propagation delay per kilometer is t seconds. Let R bits/second be the channel capacity. Assuming that processing delay is negligible, the minimum number of bits for the sequence number field in a frame for maximum utilization, when the sliding window protocol is used, is: (A) Log2((2LtR+2k)/k) (B) Log2(2LtR/k) (C) Log2((2LtR+k)/k) (D) Log2((2LtR+k)/2k) CS2007 Ans. A Explanation: Maximum window size(Wmax) is the maximum number of frame that can be remained unacknowledged. Which is (Tx+2Tp)/Tx if Tx is not negligible in comparison to Tp. Here Tp = Lt Tx= K/R Wmax=(K/R + 2Lt) / (K/R)=(2LtR+k)/k Let minimum n number of bits required then 2n = Wmax+1=(2LtR+2k)/k n=log2((2LtR+2k)/k) Q60. Match the following:

(P) SMTP (Q) BGP (R) TCP (S) PPP

(1) Application layer (2) Transport layer (3) Data link layer (4) Network layer (5) Physical layer (A) P - 2 Q - 1 R - 3 S - 5 (B) P - 1 Q - 4 R - 2 S - 3 (C) P - 1 Q - 4 R - 2 S - 5 (D) P - 2 Q - 4 R - 1 S 3 Ans. B

CS2007

Q61. What is the maximum size of data that the application layer can pass on to the TCP layer below? (A) Any size (B) 216 bytes-size of TCP header (C) 216 bytes (D) 1500 bytes CS2008 Ans. A Q62. If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of hosts per subnet? (A) 1022 (B) 1023 (C) 2046 (D) 2047 CS2008 Ans. C Explanation: 255.255.248.0 can be written as 11111111.11111111.11111000.00000000 Number of bits assigned for host id is the number of zeros in subnet mask. Here 11 bits are used for host id so maximum possible hosts are= 211-2=2046 Q63. A computer on a 10Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 2Mbps. It is initially filled to capacity with 16Megabits. What is the maximum duration for which the computer can transmit at the full 10Mbps? (A) 1.6 seconds (B) 2 seconds (C) 5 seconds (D) 8 seconds CS2008 Ans. B Explanation: There are two types of traffic scheduling Algorithm used to control the amount of data that is injected into a network, allowing for bursts of data to be sent. 1. Leaky Bucket: Outgoing rate is fixed for any incoming rate of data. 2. Token bucket: in this router generates token , and to transmit a packet it have to capture the token. Tokens are generated at constant rate. For example, a router generate 10 token per second. Maximum number of token ,that can be generated by a router, are limited. To generate new token previous token should be consumed. Token bucket can handle burst upto certain limit better than leaky bucket. C + *S = M*S Where C is token bucket Capacity is token arrival rate S is Maximum time for which token bucket can handle burst M is Maximum data transfer rate In above question C =16 Mbits , =2 Mbps, M=10Mbps By using above formula 16 Mbits + 2Mbps * S=10 Mbps *S 16 Mbits=8Mbps * S S= 2 seconds

Q64. While opening a TCP connection, the initial sequence number is to be derived using a time-ofday (ToD) clock that keeps running even when the host is down. The low order 32 bits of the counter of the ToD clock is to be used for the initial sequence numbers. The clock counter increments once per millisecond. The maximum packet lifetime is given to be 64s. Which one of the choices given below is closest to the minimum permissible rate at which sequence numbers used for packets of a connection can increase? (A) 0.015/s (B) 0.064/s (C) 0.135/s (D) 0.327/s CS2009 Ans. B Statement for Linked Answer Questions: 37 & 38 Frames of 1000 bits are sent over a 106 bps duplex link between two hosts. The propagation time is 25ms. Frames are to be transmitted into this link to maximally pack them in transit (within the link). Q65. What is the minimum number of bits (l) that will be required to represent the sequence numbers distinctly? Assume that no time gap needs to be given between transmissions of two frames. (A) l=2 (B) l=3 (C) l=4 (D) l=5 CS2009 Ans. D Explanation: Tx=1000/106 seconds=1 ms Maximum number of frames that can be transmit to maximally pack them is=(Tx+2Tp)/Tx = (25+1)/1=26 which is window size Minimum sequence number space = window size +1=27 Minimum number of bits required for sequence number is 5. Q66. Suppose that the sliding window protocol is used with the sender window size of 2L, where L is the number of bits identified in the earlier part and acknowledgements are always piggy backed. After sending 2L frames, what is the minimum time the sender will have to wait before starting transmission of the next frame? (Identify the closest choice ignoring the frame processing time.) (A) 16ms (B) 18ms (C) 20ms (D) 22ms CS2009 Ans.C Explanation: given Window size is 2L=25=32 Maximum frame that sender can transmit in one RTT is 26, when it is transmitting 27th frame it will get ack for 1st frame ,Similarly , when it is transmitting 32th frame it will get ack for 6th frame. After transmitting 32th frame ,sender have to wait until acknowledgement for 26th frame is arrived. Which is equals to (transmission time of 26 frame - transmission time of 6 frame)= 20 ms Q67. One of the header fields in an IP datagram is the Time to Live (TTL) field. Which of the following statements best explains the need for this field? (A) It can be used to prioritize packets (B) It can be used to reduce delays (C) It can be used to optimize throughput (D) It can be used to prevent packet looping CS2010 Ans. D Explanation: Main purpose of TTL field in IP Datagram is to prevent packet from looping. TTL is initialized by maximum hope and this value is decremented by each router in route, if it becomes zero packet is discarded. Q68. Which one of the following is not a client server application? (A) Internet chat (B) Web browsing (C) E-mail (D) Ping CS2010

Ans. D Explanation: Ping is used for knowing status of a host by another host. Statement for Linked Answer Questions: 69 & 70 Consider a network with 6 routers R1 to R6 connected with links having weights as shown in the following diagram Q69. All the routers use the distance vector based routing algorithm to update their routing tables. Each router starts with its routing table initialized to contain an entry for each neighbor with the weight of the respective connecting link. After all the routing tables stabilize, how many links in the network will never be used for carrying any data? (A) 4 (B) 3 (C) 2 (D) 1

CS2010

Ans. C Explanation: Link R1- R2 will not be used because its cost is 6 and link R1-R3-R2 costs 5 which is lesser than R1-R2 link. Similarly, link R4-R6 will not be used, instead this link we can use R4-R5-R6 link which costs only 5 unit. Q70. Suppose the weights of all unused links in the previous question are changed to 2 and the distance vector algorithm is used again until all routing tables stabilize. How many links will now remain unused? (A) 0 (B) 1 (C) 2 (D) 3 CS2010 Ans. 1 Explanation: Now Graph will look like And only link that will be removed is R5-R6 link.

Q71. A subnet has been assigned a subnet mask of 255.255.255.192. What is the maximum number of hosts that can belong to this subnet? (A) 14 (B) 30 (C) 62 (D)126 IT2004 Ans. C Explanation: number of bits for host id is 6,So maximum number of host=26-2=62 Q72. A host is connected to a Department network which is part of a University network. The University network, in turn, is part of the Internet. The largest network in which the Ethernet address of the host is unique is: (A) the subnet to which the host belongs (B) the Department network (C) the University network (D) the Internet IT2004 Ans. B

Q73. In a sliding window ARQ scheme, the transmitters window size is N and the receivers window size is M. The minimum number of distinct sequence numbers required to ensure correct operation of the ARQ scheme is: (A) min(M,N) (B) max(M,N) (C) M+N (D)MN IT2004 Ans. B Q74. Consider a 10 Mbps token ring LAN with a ring latency of 400s. A host that needs to transmit seizes the token. Then it sends a frame of 1000 bytes, removes the frame after it has circulated all around the ring, and finally releases the token. This process is repeated for every frame. Assuming that only a single host wishes to transmit, the effective data rate is: (A) 1 Mbps (B) 2 Mbps (C) 5 Mbps (D)6 Mbps IT2004 Ans.C Explanation: in this question delayed token release strategy is used . Tx=1000 byte /10 Mbps =800s Total delay in transmitting 1000 byte= 800s+400s+400s =1600s Effective data rate=1000 *8 bits/1600s =5Mbps Q75. A 25 Kbps satellite link has a propagation delay of 400 ms. The transmitter employs the go back n ARQ scheme with n set to 10. Assuming that each frame is 100 bytes long, what is the maximum data rate possible? (A) 5 Kbps (B) 10 Kbps (C) 15 Kbps (D)20 Kbps IT2004 Ans. B Explanation: Tx=100*8 bits/25Kbps=32 ms Maximum frame that can remain unacknowledged=2Tp/Tx=800/32 =25, but senders window size is 10. After transmitting 10 frame Sender cannot transmit more frame until it gets acknowledgement of first frame. So maximum data rate is=(10/25) * 25 Kbps =10 Kbps. Q76. Consider a parity check code with three data bits and four parity check bits. Three of the code words are 0101011, 1001101 and 1110001. Which of the following are also code words? I. 0010111 II. 0110110 III. 1011010 IV. 0111010 (A) I and III (B) I, II and III (C) II and IV (D) I, II, III and IV IT2004 Ans. D Explanation: To find out other code words , first we should calculate hamming distance between two words. Hamming distance between 0101011 and 1001101 is 4, Similarly hamming distance between 100111 and 111001 is 4, So other valid code too have hamming distance 4 with these codes. All four given code words are at hamming distance 4 from valid three code words. All four code words are valid. Q77. In the TCP/IP protocol suite, which one of the following is NOT part of the IP header? (A) Fragment offset (B) Source IP address (C) Destination IP address (D) Destination port number Ans. D Q78. A TCP message consisting of 2100 bytes is passed to IP for delivery across two networks. The first network can carry a maximum payload of 1200 bytes per frame and the second network can carry

IT2004

a maximum payload of 400 bytes per frame, excluding network overhead. Assume that IP overhead per packet is 20 bytes. What is the total IP overhead in the second network for this transmission? (A) 40 bytes (B) 80 bytes (C) 120 bytes (D) 160 bytes IT2004 Ans. C Explanation: in question maximum payload can be transferred is given not the maximum packet size. So during fragmentation we have to consider only payload not headers. At first network 2100 byte payload will be divided into 1200 byte and 900 bytes payloads. In second network 1200 bytes payload divided into 3 payloads of 400 bytes and similarly, 90 bytes payload will be divided in 2 payload of 400 bytes and one payload of 100 byte. So 2100 bytes of payload in second network is divided in six packets, so total IP overhead in second network is 6*20=12 bytes Q79. Trace-route reports a possible route that is taken by packets moving from some host A to some other host B. which of the following options represents the technique used by traceroute to identify these hosts? (A) By progressively querying routers about the next router on the path to B using ICMP packets, starting with the first router. (B) By requiring each router to append the address to the ICMP packet as it is forwarded to B. The list of all routers en-route to B is returned by B in an ICMP reply packet. (C) By ensuring that an ICMP reply packet is returned to A by each router en- route to B, in the ascending order of their hop distance from A (D) By locally computing the shortest path from A to B IT2005 Ans. B Q80. Which of the following statements is TRUE about CSMA/CD? (A) IEEE 802.11 wireless LAN runs CSMA/CD protocol (B) Ethernet is not based on CSMA/CD protocol (C) CSMA/CD is not suitable for a high propagation delay network like satellite network. (D) There is no contention in a CSMA/CD network Ans. C Q81. Which of the following statements is FALSE regarding a bridge (A) Bridge is a layer 2 device (B) Bridge reduces collision domain (C) Bridge is used to connect two or more LAN segments (D) Bridge reduces broadcast domain

IT2005

IT2005

Ans. D Explanation: Bridge increases broadcast domain , since it forward packet to its all links. Bridge reduces collision domain, Since there is a single collision domain which is inside bridge. Switch have multiple collision domain, its each link is a collision domain. Router reduce broadcast domain, it allows to broad cast in single network. Broadcasted packet cannot pass router unless its destined for other network. Q82. A network with CSMA/CD protocol in the MAC layer is running at 1 Gbps over a 1 km cable with no repeaters. The signal speed in the cable is 2x108m/sec. The minimum frame size for this network should be (A) 10000 bits (B) 10000 bytes (C) 5000 bits (D)5000 bytes IT2005

Ans. A Explanation: Tp=(1km)/( 2 x 108m/s)=5x 10-6 Seconds Let S is minimum packet size Minimum frame size can be found by formula Tx=2Tp S/1Gbps = 2*5*10-6 S=109 x 10-5 =104 bits Q83. A channel has a bit rate of 4 kbps and one-way propagation delay of 20 ms. The channel uses stop and wait protocol. The transmission time of the acknowledgement frame is negligible. To get a channel efficiency of at least 50%, the minimum frame size should be (A) 80 bytes (B) 80 bits (C) 160 bytes (D) 160 bits IT2005 Ans. D Explanation: efficiency=(transmission delay ) / total delay For stop and wait protocol efficiency is = Tx/(Tx+2Tp) because after sending one packet sender waits until ack for this packet returns. Efficiency = 50%=0.5 is given Let S bits be minimum frame size then Tx=S/4Kbps 0.5= (S/4Kbps)/( S/4Kbps + 40ms)= (S/4)/(S/4 + 40) S/8 +20 =S/4 S/8=20 S= 160 bits Q84. In a TDM medium access control bus LAN, each station is assigned one time slot per cycle for transmission. Assume that the length of each time slot is the time to transmit 100 bits plus the end-toend propagation delay. Assume a propagation speed of 2x108m/sec. The length of the LAN is 1 km with a bandwidth of 10 Mbps. The maximum number of stations that can be allowed in the LAN so that the throughput of each station can be 2/3 Mbps is: (A) 3 (B) 5 (C) 10 (D)20 IT2005 Ans. C Explanation: Each slot is equals to transmission time of 100 bits + propagation delay. Propagation delay=1km/2*108ms= 5s. Tx =100/10 Mbps=10s. Let there are maximum N number of station then Length of cycle is=N*(10+5)=15N s. And in a whole cycle each user transmit for only 10s. So throughput of each station is (10/15N)*10Mbps which is 2/3 Mbps N=(10*10*3) / (15 *2)=10 Q85. A company has a class C network address of 204.204.204.0. It wishes to have three subnets, one with 100 hosts and two with 50 hosts each. Which one of the following options represents a feasible set of subnet address/subnet mask pairs? (A) 204.204.204.128/255.255.255.192 204.204.204.0/255.255.255.128 204.204.204.64/255.255.255.128 (C) 204.204.204.128/255.255.255.128 204.204.204.192/255.255.255.192 204.204.204.224/255.255.255.192 B) 204.204.204.0/255.255.255.192 204.204.204.192/255.255.255.128 204.204.204.64/255.255.255.128 (D) 204.204.204.128/255.255.255.128 204.204.204.64/255.255.255.192 204.204.204.0/255.255.255.192 IT2005

Ans. D Explanation: in Class C network first three octet are reserved for net id, so we have total 8 bits for host and subnets. If we want to distribute addresses in subnets so first we should consider the subnet with maximum host, here which is subnet with 100 hosts. For 100 hosts we require 7 bits for host id , one bit remains for subnet, which we fix to 1 for this subnet , now subnet mask for this subnet is 255.255.255.10000000 =255.255.255.128 and subnet address is 204.204.204.128 For first subnet we have fixed 17th bit to 1 now for second and third subnet 17th bit will be 0. 50 host require 6 bit for host id , two bit remain for subnet id in which one bit is already fixed to zero; we can configure 18th bit only for these subnets ; for second subnet we fix 18th bit to 1 and for third subnet to 0. Subnet mask for second and third subnet is 255.255.255.11000000=255.255.255.192 subnet address for second subnet is 204.204.204.64 and subnet address for third subnet is 204.204.204.0 Q86. On a wireless link, the probability of packet error is 0.2. a stop and wait protocol is used to transfer data across the link. The channel condition is assumed to be independent from transmission to transmission. What is the average number of transmission attempts requires to transfer 100 packets? (a) 100 (b) 125 (c) 150 (d) 200 IT2006 Ans. b Explanation: error rate 0.2 , In stop and wait protocol sender will transmits 100*(1+0.2+0.22 +0.23 +0.24 +) packets = 100 *(1/(1-.02))=100/0.8 = 125 (sum of infinite G.P. is a/(a-r)) Q87. A subnetted class B network has the following broadcast address:144.16.95.255. Its subnet mask (a) is necessarily 255.255.224.0 (b) is necessarily 255.255.240.0 (c) is necessarily 255.255.248.0 (d) could be any one of 255.255.224.0, 255.255.240.0, 255.255.248.0 IT2006 Ans. d Explanation: 144.16.95.255 = 144.16.01011111.11111111 Since last 13 bits are one so it could be broadcast address for any of subnets with mask 255.255.224.0 (with 13 bit for host id), 255.255.240.0(with 12 bit for host id), 255.255.248.0(with 11 bits for host id). Q88. Q.HELLO and PORT ,respectively, are commands from the protocols (a) FTP and HTTP (b) TELNET and POP3 (c) HTTP and TELNET (d) SMTP and FTP Ans. d Q89. which of the following statements is true? (a) Both Ethernet frame and IP packet include checksum field. (b) Ethernet frame include a checksum field and IP packet includes a CRC field (c) Ethernet frame include a CRC field and IP packet includes a checksum field. (d) Both Ethernet frame and IP packet include CRC fields. Ans. c

IT2006

IT2006

Q90. In the 4B/5B encoding scheme, every 4 bits of data are encoded in 5 bit codeword. It is required that the codewords have at most 1 leading and at most 1 trailing zero. How many such codewords are possible? (a) 14 (b) 16 (c) 18 (d) 20 IT2006 Ans. c Explanation: there are 4 combination possible 5 bit code with no leading 0 and no trailing 0= 1 _ _ _ 1 = 23 =8 codewords 5 bit code with at most one leading 0 and no trailing 0= 0 1 _ _ 1 = 22 = 4 codewords 5 bit code with no leading 0 and at most one trailing 0= 1 _ _ 0 1 = 22 = 4 codewords 5 bit code with at most one leading 0 and at most one trailing 0= 0 1 _ 1 0 = 21 = 2 codewords Total possible codewords is =18 4B/5B Encoding: In Manchester encoding scheme , there is a transition after every bit. It means that we must have clocks with double the speed to send same amount of data as in NRZ encodings. In other words, we may say that only 50% of the data is sent. This performance factor can be significantly improved if we use a better encoding scheme. This scheme may have a transition after fixed number of bits instead of every other bit. Like if we have a transition after every four bits, then we will be sending 80% data of actual capacity. This is a significant improvement in the performance. This scheme is known as 4B/5B. So here we convert 4-bits to 5-bits, ensuring at least one transition in them. The basic idea here is that 5-bit code selected must have : one leading 0 no more than two trailing 0s Thus it is ensured that we can never have more than three consecutive 0s. Now these 5-bit codes are transmitted using NRZI coding thus problem of consecutive 1s is solved. The exact transformation is as follows : 4-bit Data 0000 0001 0010 0011 0100 0101 0110 0111 5-bit code 11110 01001 10100 10101 01010 01011 01110 01111 4-bit Data 1000 1001 1010 1011 1100 1101 1110 1111 5-bit code 10010 10011 10110 10111 11010 11011 11100 11101

Of the remaining 16 codes, 7 are invalid and others are used to send some control information like line idle(11111), line dead(00000), Halt(00100) etc. Q91. A link of capacity 100 Mbps is carrying traffic from a number of sources. Each source generates an on- off traffic stream; when the source is on, the rate of traffic is 10 mbps, and when the source is off, the rate of traffic is zero. The duty cycle, which is the ratio of on time to off time is 1:2. When there is no buffer at the link, the minimum number of sources that can be multiplexed on the link so that link capacity is not wasted and no data loss occur is S1. Assuming that all sources are synchronized and that link is provided with a large buffer, the maximum number of sources that can be multiplexed so that no data loss occur is S2. The value of S1 and S2 are respectively, (a) 10 and 30 (b) 12 and 25 (c)5 and 33 (d)15 and 22 IT2006 Ans. a

Explanation: capacity of link is 100 Mbps. And each source generate 10Mbps traffic when it is on. If there is no buffer at link, we can divide link 100Mbps/10Mbps =10 parts , so at maximum 10 user can be multiplexed.S1=10 But if there is buffer at link so we can store frame at link. For maximum utilization other source can use off time of a source. If duty cycle is of 3 unit time and for 1 st unit of time for source transmits then for other two unit can be utilized by other two other user alternatively. Now, each part of link is utilized by 3 users so maximum number of user possible is s2= 30. Q92. Q. A router ha full duplex Ethernet interfaces each operating at 100 Mbps. Ethernet frames are at least 84 bytes long (including the preamble and inter packet gap). The maximum packet processing time at the router for wirespeed forwarding to be possible is(in micro seconds) (a) 0.01 (b) 3.36 (c) 6.72 (d) 8 IT2006 Ans. c Explanation: here other information is not given so transmission time can be taken as processing time. Tx=84 bytes/100Mbps =(84*8/100) s = 6.72 s. Q93. A router uses the following routing table: Destination Mask Interface 144.16.0.0 255.255.0.0 Eth0 144.16.64.0 255.255.224.0 Eth1 144.16.68.0 255.255.255.0 Eth2 144.16.68.64 255.255.255.22 Eth3 4 A packet bearing a destination address 144.16.68.117 arrives at the router. On which interface will it be forwarded? (a) Eth0 Ans. C Q94. A firewall is to be configured to allow hosts in a private network to freely open TCP connections and send packets on open connections. However, it will only allow external hosts to send packets on existing open TCP connections or connections that are being opened (by internal host) but not allow them to open TCP connections to hosts in the private network. To achieve the minimum capability of the firewall should be that of (a) A combinational circuit (b) A finite automation (c) A pushdown automaton with one stack (d)A pushdown automaton with two stacks IT2007 Ans. d Q95. Q. A group of 15 routers are interconnected in a centralized complete binary tree with a router at each tree node. Router i communicate with router j by sending a message to the root of the tree. The root then sends the message back down to router j. The mean number of hops per message, assuming all possible router pairs are equally likely is (a) 3 (b) 4.26 (c) 4.53 (d) 5.26 IT-2007 Ans. c Explanation: Consider Complete tree in Figure (b) Eth1 (c) Eth2 (d) Eth3 IT2006

If H wants to communicate with router at level 3 then it first sends packet to node A, then A forward packet to the router at Level 3; total 6 hops are required if A wants to communicate with any level 3 node. Similarly, 5 hops are required if H wants to communicate with any level 2 node , 4 hops are required if H wants to communicate with any level 1 node and 3 hops are required if H wants to communicate with any level 0 node . Hops required if H wants to communicates with all other nodes = (8-1)*6 + 4*5+2*4 +1*3 = 73 If all 8 level 3 nodes communicates with all other nodes then hops required=73*8=584 Similarly, Hops required if D wants to communicates with all other nodes = 8*5 + (4-1)*4+2*3 +1*2 = 60 If all 4 level 2 nodes communicates with all other nodes then hops required=60*4=240 Hops required if B wants to communicates with all other nodes = 8*4 + 4*3+(2-1)*2 +1*1 = 47 If all 4 level 2 nodes communicates with all other nodes then hops required=47*2=94 Hops required if A wants to communicates with all other nodes = 8*3 + 4*2+2*1 = 34 Total hops required when all nodes communicate with all other nodes=584+240+94+34= 952 Total number of message is 2 * 15C2 =2 * (15*14/2)=2*105=210 Here 2 is multiplied with 15C2 because in communication between A and B, A sends message to B and B sends message to A. The mean number of hops per message= 952/210= 4.53 Q96. . A broadcast channel has 10 nodes and total capacity of 10 Mbps. It uses polling for medium access. Once a node finishes transmission, there is a polling delay of 80 micro seconds to poll the next node. Whenever a node is polled , it is allowed to transmit a maximum of 1000 bytes. The maximum throughput of broad cast channel is (a) 1 Mbps (b) 100/11 Mbps (c) 10 Mbpd (d) 100 Mbps IT2007 Ans. Explanation: Tx=1000 bytes/10Mbps =800s. Delay because of polling is = 80 s Efficiency of channel , e =transmission delay/ (total delay) =800/(800+80)= 10/11 Maximum throughput is =(10/11) * 10 Mbps= 100/11 Mbps Q97. The minimum frame size required for CSMA/CD base computer network running at 1 Gbps on 200 m cable with a link speed of 2 x 108 m/s is (a) 125 bytes (b) 250 bytes (c) 500 bytes (d) none of these IT2008 Ans. b Explanation: Use Tx=2Tp Q98. A sender is employing public key cryptography to send a secret message to a receiver. Which one of the following statements is TRUE? (A) Sender encrypts using receivers public key (B) Sender encrypts using his own public key (C) Receiver decrypts using senders public key

(D) Receiver decrypts using his own public key Ans.a

IT2004

Q99.Which one of the following statements is FALSE? (A) Packet switching leads to better utilization of bandwidth resources than circuit switching. (B) Packet switching results in less variation in delay than circuit switching. (C) Packet switching requires more per packet processing than circuit switching. (D) Packet switching can lead to reordering unlike in circuit switching. IT2004 Ans. B Q100. Which one of the following statements is FALSE? (A) TCP guarantees a minimum communication rate (B) TCP ensures in-order delivery (C) TCP reacts to congestion by reducing sender window size (D) TCP employs retransmission to compensate IT2004 Ans. A Q101.Which one of the following statements is FALSE? (A) HTTP runs over TCP (B) HTTP describes the structure of web pages (C) HTTP allows information to be stored in a URL (D) HTTP can be used to test the validity of a hypertext link Ans. D

for

packet

loss

IT2004

Potrebbero piacerti anche