20
1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 1 Vidyalankar B.E. Sem. VII [EXTC] Computer Communication Networks Prelim Question Paper Solution THE OSI REFERENCE MODEL The model is called the ISO OSI (Open systems Interconnection) model because it deals with connecting open systems i.e. systems that are open for communication with other systems. The OSI model is not a network architecture because it does not specify the exact services and protocols to be used in each layer. It just tells what each layer should do. The OSI model has seven layers 1) The Physical Layer : The physical layer is concerned with transmitting raw bits over a communication channel. This layer deals with mechanical and electrical specifications of primary connections such as cables, connectors and signaling options that physically link 2 nodes on a network. 2) The Data Link Layer : The Data Link Layer is responsible for delivering data units from one station to the next without errors. A data unit with header and trailer is called a frame. 1. (a) Application 7 Application APDU Application Protocol Presentation 6 Presentation PPDU Presentation Protocol Session 5 Session SPDU Session Protocol Transport 4 Transport TPDU Transport Protocol Internal subnet protocol Network 3 Network packet Network Network Data Link 2 Data Link frame Data Link Data Link Physical 1 Physical Bit Physical Router Physical Router Network layer hostrouter protocol Data Link layer hostrouter protocol Physical layer hostrouter protocol HOST A Layer Name of unit exchanged Communication subnet boundary HOST B Fig. 1 : The OSI reference model. Vidyalankar

THE OSI REFERENCE MODEL Vidyalankarvidyalankar.org/.../SemVII/EXTC/CCN.pdf · 1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 1 Vidyalankar B.E. Sem. VII [EXTC] Computer Communication Networks

  • Upload
    others

  • View
    17

  • Download
    0

Embed Size (px)

Citation preview

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 1

Vidyalankar B.E. Sem. VII [EXTC]

Computer Communication Networks Prelim Question Paper Solution

THE OSI REFERENCE MODEL The model is called the ISO OSI (Open systems Interconnection) model because it deals with connecting open systems i.e. systems that are open for communication with other systems. The OSI model is not a network architecture because it does not specify the exact services and protocols to be used in each layer. It just tells what each layer should do.

The OSI model has seven layers

1) The Physical Layer : The physical layer is concerned with transmitting raw bits over a communication channel. This layer deals with mechanical and electrical specifications of primary connections such

as cables, connectors and signaling options that physically link 2 nodes on a network. 2) The Data Link Layer : The Data Link Layer is responsible for delivering data units from one station to the next

without errors. A data unit with header and trailer is called a frame.

1. (a)

Application 7 Application APDU Application Protocol

Presentation 6 Presentation PPDU Presentation Protocol

Session 5 Session SPDU Session Protocol

Transport 4 Transport TPDU Transport Protocol

Internal subnet protocol

Network 3 Network packet Network Network

Data Link 2 Data Link frame Data Link Data Link

Physical 1 Physical Bit Physical

Router

Physical

Router

Network layer hostrouter protocol

Data Link layer hostrouter protocol

Physical layer hostrouter protocol

HOST A

Layer Name of unit

exchanged

Communication subnet boundary

HOST B

Fig. 1 : The OSI reference model.Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 2

Responsibilities : (a) Nodetonode delivery. (b) Addressing : Physical addressing is done at data link layer. (c) Access Control : When two or more devices are connected to the same link, which device

has control over the link is decided by DLL. (d) Flow Control : Flow control avoids the fast transmitter from drowning the slower receiver. (e) Error control : Error control means error correction. It allows the receiver to inform the

sender of any frame lost or damaged in transmission and co-ordinates the re-transmission of those frames by the sender.

(f) Synchronization : DLL is divided into : (1) LLC (2) MAC 3) The Network Layer : The network layer is responsible for source to destination delivery of packet across multiple

network links. Responsibilities : (a) Source to destination delivery. (b) Logical addressing. (c) Routing (d) Multiplexing 4) The Transport Layer : The transport layer is responsible for source to destination delivery of entire message. Responsibilities : (a) Endtoend message delivery (b) Servicepoint(port or sockect) addressing Guaranteeing delivery of message to appropriate application of computer. (c) Segmentation and reassembly. (d) Connection control Deciding whether or not to send all packets by a single path. 5) The Session Layer : One of the services of the session layer is to manage dialogue control. It establishes, maintains and synchronizes the interaction between communicating devices.

Responsibilities : (a) Session management : Introduction of checkpoints and dialog units appropriate for

transmission. (b) Synchronization : Deciding in what order to pass the dialog units to the transport layer

and where in the transmission to require confirmation from the receiver. (c) Dialog control : Deciding who sends and when. (d) Graceful close : Ensuring that exchange has been appropriately completely before the

session closes.. 6) Presentation Layer : The Presentation layer ensures interoperability among communicating devices. It provides the necessary translation of different control codes, character sets, graphics

characters. Responsibilities :

(a) Translation (b) Encryption (c) Compression (d) Security validating passwords and login codes.

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 3

7) Application Layer : The Application layer provides user interfaces and support for services such as email,

remote file access and transfer, shared database management and others. Applications : (a) Network virtual terminal (b) File access, transfer and management (c) Mail services (d) Directory services. Various features of layered architecture are : i) Different levels of abstraction are available. ii) Every layer has different specified function. iii) Standardized protocols. AUTOMATIC REPEAT REQUEST (ARQ) i) Error Detection : Using CRC. ii) Positive Acknowledgement : The destination returns a positive acknowledgement to

successfully received, error free frames. iii) Retransmission after time out : The source retransmits a frame that has not been

acknowledged after a predetermined amount of time.

All these methods are referred to as Automatic Repeat Request (ARQ) GOBACKNARQ The GobacknARQ technique takes into account the following contingencies :

1. (b)

5, 6 and 7 retransmitted

A B

F0

Fig. : Go-back-n-ARQ.

F1

F2

F3

F4

F5 *

RR2

RR4

F6

F7

F5

F6

F7

F0

*

RR6

REJ5

F1

RR (P bit = 1)

F2

RR2

Discarded by receiver

Error

RR0

Timeout Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 4

(a) Damaged Data Frame ‘A’ transmits frame i, B detects an error and has previously successfully received frame

(i 1) B sends REJ i, indicating frame i has been rejected. Frame i is lost in transmit. ‘A’ subsequently sends frame (i + 1). ‘B’ receives frame

(i + 1) out of order and sends REJ i. ‘A’ must transmit frame i and all next. Frame i is lost in transit and ‘A’ does not soon send additional frames. ‘B’ receives nothing and returns neither RR nor an REJ.

When A’s timer expires, it transmits an RR frame that includes a bit known as the p bit which is set to 1.

‘B’ interprets the RR frame with a p bit of 1 as a command that must be acknowledged by sending an RR indicating the next frame that it expects.

When ‘A’ receives the RR, it retransmits frame i. (b) Damaged RR

‘B’ receives frame i and sends RR (i + 1) which is lost in transit. Next RR arrives before ‘A’s timer expires.

If ‘A’ timer expires, it transmits RR command. (c) Damaged REJ Frame i is lost in transit and ‘A’ does not soon send additional frames. ‘B’ receives nothing and returns neither RR nor an REJ.

When A’s timer expires, it transmits an RR frame that include a bit known as the p bit which is set to 1.

‘B’ interprets the RR frame with a p bit of 1 as a command that must be acknowledged by sending an RR indicating the next frame that it expects.

When ‘A’ receives the RR, it retransmits frame i. The different types of ARQ are : i) Stop and wait ARQ ii) Go Back N ARQ iii) Selective reject ARQ TRANSMISSION CONTROL PROTOCOL (TCP)

TCP Segment Figure 1 shows the format of the TCP segment. The header consists of a 20byte fixed part

plus a variablesize options field.

2. (a)

0 4 10 16 24 31 Source port Destination port

Sequence number Acknowledgment number

Higher length

Reserved U A P R S F

Window size R C S S Y I G K H T N N

Checksum Urgent pointer Options Padding

Data

Fig. 1 : TCP segment

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 5

The description of each field in the TCP segment is given below. The term sender refers to the host that sends the segment, and receiver refers to the host that receives the segment.

Source port and destination port : The source and destination ports identify the sending and receiving applications, respectively.

Sequence number : The 32bit sequence number field identifies the position of the first data byte of this segment in the sender’s byte stream during data transfer (when SYN bit is not set). The sequence number wraps back to 0 after 232 1. Note that TCP identifies the sequence number for each byte (rather than for each segment).

Acknowledgment number : This field identifies the sequence number of the next data byte that the sender expects to receive if the ACK bit is set. This field also indicates that the sender has successfully received all data up to but not including this value. If the ACK bit is not set (during connection establishment), this field is meaningless. Once a connection is established, the ACK bit must be set.

Header length : This field specifies the length of the TCP header in 32bit words. This information allows the receiver to know the beginning of the data area because the options field is variable length.

Reserved : As the name implies, this field is reserved for future use and must be set to 0.

URG : If this bit is set, the urgent pointer is valid.

ACK : If this bit is set, the acknowledgment number is valid.

PSH : When this bit is set, it tells the receiving TCP module to pass the data to the application immediately. Otherwise, the receiving TCP module may choose to buffer the segment until enough data accumulates in its buffer.

RST : When this bit is set, it tells the receiving TCP module to abort the connection because of some abnormal condition.

SYN : This bit requests a connection.

FIN : When this bit is set, it tells the receiver that the sender does not have any more data to send. The sender can still receive data from the other direction until it receives a segment with the FIN bit set.

Window size : The window size field specifies the number of bytes the sender is willing to accept. This field can be used to control the flow of data and congestion.

Checksum : This field detects errors on the TCP segment. The procedure is discussed below.

Urgent pointer : When the URG bit is set, the value in the urgent pointer field added to that in the sequence number field points to the last byte of the “urgent data” (data that needs immediate delivery). However, the first byte of the urgent data is never explicitly defined. Because the receiver’s TCP module passes data to the application in sequence, any data in the receiver’s buffer up to the last byte of the urgent data may be considered urgent. Options : The options field may be used to provide other functions that are not covered by the header. If the length of the options field is not a multiple of 32 bits, extra padding bits will be added. The most important option is used by the sender to indicate the maximum segment size (MSS) it can accept. This option is specified during connection setup. Two other options that are negotiated during connection setup are intended to deal with situations that involve large delaybandwidth products. The window scale option allows the use of a larger advertised

0 8 16 31 Source IP address

Destination IP address 0 0 0 0 0 0 0 0 Protocol = 6 TCP segment length

Fig. 2 : TCP pseudoheader Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 6

window size. The window can be scaled upward by a factor of up to 214. Normally the maximum window size is 216 1 = 65,535. With scaling the maximum advertised window size is 65,535 214 = 1,073,725,440 bytes. The timestamp option is intended for highspeed connections where the sequence numbers may wrap around during the lifetime of the connection. The timestamp option allows the sender to include a timestamp in every segment. This timestamp can also be used in the RTT calculation. Advantages of TCP : Reliable protocol, Error reporting Application : Critical communication systems. USER DATAGRAM PROTOCOL (UDP)

The format of the UDP datagram is shown in Figure 3. The destination port allows the UDP module to demultiplex datagrams to the correct application in a given host.

The source port identifies the particular application in the source host to receive replies. The

UDP length field indicates the number of bytes in the UDP datagram (including header and data).

The UDP checksum field detects errors in the datagram, and its use is optional. Advantages of UDP : Fastest data transfer Application : Real times video streaming, entertainment purposes. DJIKSTRA’S ALGORITHM It is called shortest path algorithm or forward search algorithm. It is a centralized, static algorithm although it could be made adaptive by executing it periodically. Algorithm : 1) Define S as a set of nodes. Initially node contains the start node. 2) Define cost(X) as the cost of the cheapest route from start node to X using only nodes from S. do { (a) Determine the set of nodes not in S but connected to a node in S. Call this set W. (b) Choose a node X in W for which cost(X) is minimum. (c) For each V not in S, define cost(V) = minimum {cost(V), cost(X) + cost of link connecting X to V } If cost(V) is changed define prior(V) = X (d) Add X to the set S. } while not all nodes in S. e.g.

2. (b)

Source port Destination port UDP length UDP checksum

Data

0 16 31

Fig. 3 : UDP datagram

B B D

A

C E

F

1

2

37 2

6

6

73

4

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 7

Step S W Cost functions for Prior functions for

X B C D E F B C D E F I {A} {B, C} C 2 1 ∞ ∞ ∞ A A

II {A, C} {B, D, E, F} B 2 1 4 7 8 A A C C C

III {A, B, C} {D, E, F} D 2 1 4 6 8 A A C B C

IV {A, B, C, D} {E, F} E 2 1 4 6 6 A A C B D

V {A, B, C, D, E} {F} F 2 1 4 6 6 A A C B D

VI {A, B, C, D, E, F} { } 2 1 4 6 6 A A C B D

Shortest path from A to F is F D C A Least cost = 6 HIGH LEVEL DATA LINK CONTROL PROTOCOL (HDLC) HDLC is the most important data link control protocol.

Basic Characteristics : To satisfy a variety of applications, HDLC defined Three types of stations Two link configurations Three data transfer modes of operation

Types of Stations

Primary Station Has the responsibility for controlling the operation of the link. Frames issued by the primary are called commands.

Secondary Station Operates under the control of the primary station. Frames issued by a secondary are called responses. The primary maintains a separate logical link with each secondary station on the line

Combined Station Combines the features of primary and secondary. A combined station may issue both commands and responses.

Two Link Configurations

Unbalanced Configuration

Consists of one primary and one or more secondary and supports both full-duplex and half-duplex transmission.

Balanced Configuration

Consists of two combined stations and supports both full-duplex and half-duplex transmission.

Three Data Transfer Modes :

Normal Response Mode (NRM)

Used with an unbalanced configuration. The primary may initiate data transfer to a secondary, but a secondary may only transmit data in response to a command from the primary.

Asynchronous Balanced Mode (ABM)

Used with a balanced configuration. Either combined station may initiate transmission without receiving permission from the other combined station.

Asynchronous Response Mode (ARM)

Used with an unbalanced configuration. The secondary may initiate transmission without explicit permission of the primary. The primary still retains responsibility for the line, including initialization, error recovery and logical disconnection.

3. (a)

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 8

Frame Structure HDLC uses synchronous transmission. All transmission are in the form of frames and a single frame format suffices for all types of data and control exchanges.

Header : The flag, address and control fields that precede the information field.

Trailer : The FCS and flag fields following the data field.

Flag Fields : Flag fields delimit the frame at both ends with the unique pattern 01111110. The data is bit stuffed at the transmitter and unstuffed at the receiver.

Address Fields : The address fields identify the secondary station that transmitted or is to receive the frame. Frame Check Sequence Field : FCS is an error-detecting code calculated from the remaining bits of the flags, exclusive of flags and uses 16-bit CRC

Operation : The operation of HDLC involves three phases:

i) Initialization : Initialization may be requested by either side. The commands serves three purposes :

It signals the other side that initialization is requested. It specifies which of the three modes (NRM, ABM, ARM) is requested. It specifies whether 3 – or 7 bit sequence numbers are to be used. If the other sides accepts this request, then the HDLC module on that end transmits an

unnumbered acknowledged (UA) frame back to the initiating side. If the request is rejected, then a disconnected mode (DM) frame is sent.

ii) Data Transfer : When the initialization had been requested and accepted, then a logical connection is established. Both sides may begin to send user data in I-frames, starting with sequence number 0. The N(S) and N(R) fields of the I-frame are sequence numbers that support flow control and error control.

iii) Disconnect : Either HDLC module can initiate a disconnect by issuing a disconnect (DISC) frame. The other side reply’s with UA.

Fig. 1 : HDLC Frame Structure.

0

1

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 9

TOPOLOGY The term topology refers to the way a network is laid out, either physically or logically. Five basic technologies are : 1) Mesh Every device has dedicated pointtopoint link to every other device.

n(n 1)

2

physical channels are required to link n devices.

Advantages No Traffic : The use of dedicated links guarantees that each connection can carry its data

load, thus eliminate traffic problems.

Robust : If one link becomes unusable, it does not affect the entire problem.

Privacy or Security : Every message travels along a dedicated link, hence only the intended recipient sees it.

Fault identification and fault isolation is easy. Disadvantages Installation and reconfiguration is difficult. The sheer bulk of wiring can be greater than the available space can accommodate. The hardware required to connect each link (I/O port and cable) are expensive.

2) Star Each device has a dedicated pointtopoint link only to a central controller, usually called a hub.

Advantages Less expensive than mesh topology. Easy to install and configure Less cabling required as compared to mesh Robust : One link is damaged then the complete system is not affected. This also leads to

easy fault identification and isolation.

3. (b)

TOPOLOGY

MESH STAR TREE BUS RING

Fig. 1 : Types of Topologies.

1

2

4

3

5

5 devices 5(5 1)

10 links2

Fig. 2 : Mesh Topology.

Fig. 3 : Star Topology.

1

3

2

4

HUBVidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 10

Disadvantages More cabling compared to bus or ring topology. Central controller is required.

3) Tree (Variation of STAR)

In TREE majority devices are connected to a secondary hub that in turn is connected to the central hub.

Advantages : Less expensive than mesh topology. Easy to install and configure Less cabling required as compared to mesh Robust More devices can be attached to a single hub. Allows network to isolate and prioritize communication from different computers. Disadvantages More cabling compared to bus or ring topology. Central controller is required.

4) Bus It uses multipoint configuration. One long cable acts as a backbone to link all devices in the network.

Advantages Ease of installation Backbone cable can be laid along the most efficient path. Less cabling required. Disadvantages Difficult reconfiguration and fault isolation. Signal reflection at the taps can cause degradation in quality. A fault or break in the bus cable stops transmission.

1 2 13 4 5

Tap Tap Tap Tap Tap

Cable end

Drop line

Cable end

Fig. 5 : Bus Topology.

Fig. 4 : Tree Topology.

1 2

Central Hub

Secondary Hub Secondary Hub

6 7 8 3 4 5

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 11

5) Ring Each device has a dedicated pointtopoint line configuration only with the two devices on other side of it.

Advantages Relatively easy to install and configure. Disadvantages Unidirectional traffic can be a disadvantage. A break in the ring can disable the entire network.

M/M/1 : A Basic Multiplexer Model A basic model for a multiplexer is shown in figure 1. The interarrival times in this system have mean E[] = 1/ as an exponential distribution. Let A(t) be the number of arrivals in the interval 0 to t; then as indicated above A(t) has a

Poisson distribution. The average packet length is E[L] bits per packet, and the transmission line has a speed of R

bits/second. So the average packet transmission time is E[X] = E[L]/R seconds. This transmission line is modeled by a single server that can process packets at a maximum

rate of = R/E[L] packets/second. We assume that the packet transmission time X has an exponential distribution :

P [X > t] = et / E[X] = et for t > 0 We also assume that the interarrival times and packet lengths are independent of each other.

We will first assume that at most K packets are allowed in the system. In terms of long-term flows, packets arrive at this system at a rate of packets/second, and

the maximum rate at which packets can depart is packets/second. If > , then the system will necessarily lose packets because the system is incapable of

handling the arrival rate . If < , then on the average the system can handle the rate , but it will occasionally delay

and/or lose packets because of temporary surges in arrivals or long consecutive service times. Consider what events can happen in the next t seconds. In terms of arrivals there can be 0, 1,

or > 1 arrivals. Similarly there can be 0, 1, or > 1 departures. It can be shown that if the interarrival times are exponential, then P[1 arrival in t] = t + o(t) where 0(t) denotes terms that are negligible relative to t, as t 02. Thus the probability of a single arrival is proportional to . Similarly, it can also be shown

that probability of no arrivals in t seconds is given by P[0 arrival in t] = 1 t + o(t)

4. (a)

Fig. 6 : Ring Topology.

2 3

1

5

4

Direction of flow

Fig. 1 : M/M/1/K queue

K 1 buffer

Poissonarrivalsrate

Exponential service time with rate

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 12

The preceding two equations imply that only two events are possible as t becomes very small : one arrival or no arrival.

Since the service times also have an exponential distribution, it can be shown that a customer in service will depart in the next t seconds with probability

P[1 departure in t] = t + o(t) and that the probability that the customer will continue its service after an additional t

seconds is P[0 departure in t] = 1 t + o(t) Different expression for M/M/1 system are : Average number of customers

E[N] = 2

n 0

n(1 )

=

1

Average delay

E[T] = E[N]

=

1/

1

Average waiting time E[W] = E[T] E[X]

= (1/ )

1

Thus average wating time and delay grow without bound as 1. IP PACKET The header has a fixedlength component of 20 bytes plus a variablelength component

consisting of options that can be up to 40 bytes. IP packets are transmitted according to network byte order in the following groups: bits 07,

bits 815, bits 1623, and finally bits 2431 for each row. The meaning of each field in the header follows. Version : The version field indicates the version number used by the IP packet so that

revisions can be distinguished from each other. The current IP version is 4. Versions 5 is used for a realtime stream protocol called ST2, and version 6 is used for the new generation IP known as IPv6.

Internet header length : The Internet header length (IHL) specifies the length of the header in 32bit words. If no options are present, IHL will have a value of 5. The length of the options filed can be determined from IHL.

Type of service : The type of service (TOS) field traditionally specifies the priority of the packet based on delay, throughput, reliability, and cost requirements. Three bits are assigned for priority levels (called “precedence”) and four bits for the specific requirement (i.e. delay, throughput, reliability and cost).

Total length : The total length specifies the number of bytes of the IP packet including header and data. With 16 bits assigned to this field, the maximum packet length is 65,535 bytes.

4. (b)

0 4 8 16 19 24 31

Version IHL Type of service Total length Fragment offset

Header checksumSource IP address

Destination IP addressOption Padding

Identification

Protocol Time to live

Fig.: 1 IP version 4 header

Flags

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 13

Identification, flags and fragment offset : These fields are used for fragmentation and reassembly and are discussed below.

Time to live : The timetolive (TTL) field is defined to indicate the amount of time in seconds the packet is allowed to remain in the network. However, most routers interpret this filed to indicate the number of hops the packet is allowed to traverse in the network.

Protocol : The protocol field specifies the upperlayer protocol that is to receive the IP data at the destination host. Examples of the protocols include TCP (protocol = 6), UDP(protocol = 17), and ICMP (protocol = 1).

Header checksum : The header checksum field verifies the integrity of the header of the IP packet.

Source IP address and destination IP address : These fields contain the addresses of the source and destination hosts. The format of the IP address is discussed below.

Options : The options field, which is of variable length, allows the packet to request special features such as security level, route to be taken by the packet and timestamp at each router.

Padding : This field is used to make the header a multiple of 32bit words.

When an IP packet is passed to the router, the following processing takes place. First the header checksum is computed and the fields in the header (version and total length)

are checked to see if they contain valid values. Next the router identifies the next hop for the IP packet by consulting its routing table. Then the fields that need to be changed are updated. For example, the TTL and header checksum fields always require updating. The IP packet is then forwarded along the next hop. Advantages of IpV6 over IpV4 i) Longer addresses, hence effectively unlimited supply of Internet addresses. ii) Simpler header format. iii) Faster throughput and delay is less. iv) Support for options. v) Higher security. Differentiate between circuit switching and datagram packet switching

Circuit Switching Datagram Packet Switching 1) Dedicated transmission path 1) No dedicated path 2) Continuous transmission of data 2) Transmission of packets 3) Messages are not stored 3) Packets may be stored until delivered 4) The path is established for entire conversation 4) Route established for each packet 5) Call setup delay; negligible transmission delay 5) Packet transmission delay 6) Busy signal if called party busy 6) Sender may be notified if packet not

delivered 7) Electromechanical or computerized switching

nodes 7) Small switching nodes

8) Fixed bandwidth transmission 8) Dynamic use of bandwidth 9) No overhead bits after call setup 9) Overhead bits in each message 10) Usually no speed of code conversion 10) Speed and code conversion

Application of Circuit Switching : i) Telephony ii) Local area network connections Applications of Packet Switching : i) IP Internet ii) Wireless communication

5. (a)

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 14

SLIDING WINDOW METHOD In sliding window method, sender can transmit several frames without waiting for an

acknowledgement. To keep track of each frame, identification scheme is based on size of the window. The frames are numbered modulon, which means they are numbered from 0 to n 1. If n = 8 then frames are numbered from 0 to 7. Maximum window size = n 1 i.e. 7. Sender’s Window When frames are transmitted the left boundary moves inward and hence window shrinks. When ACK arrives the right boundary moves outward and hence window expands to allow

number of few frames equal to number of frames expanded. Receiver’s Window When new frames come in, the left boundary moves inward and hence window shrinks. When the receiver acknowledges a frame, the right boundary moves outward and hence

window expands. When sizes of both the sender and receiver are same.

5. (b)

0 2 4 6 0 2 4 6 . . . . .1 3 5 7 7531. . . . .

Frames already received

Window expands from leading edge as acknowledgements are sent

Window shrinks from trailing edge as frames are received

Last frame acknowledged

Window of frames that may be accepted

Fig. 2 : Receiver's Window.

Fig. 1 : Sender's Window.

0 2 4 6 0 2 4 6 . . . . .1 3 5 7 7531. . . . .

Frames already received

Window expands from leading edge as acknowledgements are received.

Window shrinks from trailing edge as frames are sent.

Last frame transmitted

Window of frames that may be transmitted

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 15

RR Receive Ready RNR Receive not ready RNR 5 means I have received all frames upto no. 4 but I am unable to accept any more. CARRIER SENSE MULTIPLE ACCESS (CSMA) PROTOCOLS

Protocols in which stations listen for a carrier and act accordingly are called carrier sense protocol. − Persistent and Nonpersistent CSMA. 1Persistent 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 transmit 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 wit a probability of 1

whenever it finds the channel idle.

Advantages : It is still better than ALOHA

Disadvantages :

I) Propagation delay has an important effect on the performance of protocol. There is a small chance that just after a station begins sending, another station will

become ready to send and sense the channel. If the first station’s signal has not yet reached the second one, the latter will sense an idle

channel and will also begin sending, resulting in a collision. Propagation delay increases, performance decreases.

ii) Even if propagation delay = 0, there will still be collisions. If two station become ready in the middle of a third station’s transmission, both will wait

politely until the transmission ends and then both will begin transmitting exactly simultaneously, resulting in a collision.

6. (a)

Source System A Destination System B

0 2 4 6 0 21 3 5 7 1 0 2 4 6 0 2 1 3 5 7 1

0 2 4 6 0 21 3 5 7 1 0 2 4 6 0 2 1 3 5 7 1

F0

F1

F2

0 2 4 6 0 2 1 3 5 7 1

0 2 4 6 0 21 3 5 7 1

RR3

0 2 4 6 0 2 1 3 5 7 1

F3F4

F5

F60 2 4 6 0 21 3 5 7 1

0 2 4 6 0 21 3 5 7 1

0 2 4 6 0 2 1 3 5 7 1 RR4

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 16

Nonpersistent CSMA Before sending, a station senses the channel. If no one else is sending, a 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 pervious transmission. Instead, it waits a random period of time and then repeats the algorithm.

It is better than 1persistent CSMA.

Ppersistent CSMA ppersistent CSMA is used for slotted channels. 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 idle, it either transmits or defers again, with probability p and q. This process is repeated until either the frame has been transmitted or another station has

begun transmitting. If the station initially sense’s the channel bus it waits until the next slot and applies the

above algorithm. Various network devices are : Repeaters Hubs Switches Bridges Repeaters A repeater is a device that operates only in the physical layer. Signals that carry information

within a network can travel a fixed distance before attenuation endangers the integrity of the data.

A repeater receives a signal and before it becomes too weak or corrupted, regenerates the original bit pattern. The repeater then sends the refreshed signal. A repeater can extend the physical length of a LAN, as shown in figure 1.

A repeater does not actually connect two LANs; it connects two segments of the same LAN. The segments connected are still part of one single LAN.

A repeater connects segments of a LAN A repeater can overcome the 10BASE5 Ethernet length restriction. In this standard, the length

of the cable is limited to 500 m. To extend this length, we divide the cable into segments and install repeaters between

segments. Note that the whole network is still considered one LAN, but the portions of the network separated by repeaters are called segments.

6. (b)

5 4 3 2 1 1 1

Repeater

1

5 4 3 2 1

Segment 1 Segment 2 Fig. 1 : Repeater

Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 17

The repeater acts as a twoport node, but operates only in the physical layer. When it receives a frame from any of the ports, it regenerates and forwards it to the other port.

A repeater forwards every bit; it has no filtering capability It is tempting to compare a repeater to an amplifier, but the comparison is inaccurate. An amplifier cannot discriminate between the intended signal and noise; it amplifies equally

everything fed into it. A repeater does not amplify the signal; it regenerates the signal. When it receives a weakened

or corrupted signal, it creates a copy, bit for bit, at the original strength. A repeater is a regenerator, not an amplifier The location of a repeater on a link is vital. A repeater must be placed so that a signal reaches

it before any noise changes the meaning of any of its bits. A little noise can alter the precision of a bit’s voltage without destroying its identity (see figure 2).

If the corrupted bit travels much farther, however, accumulated noise can change its meaning completely.

At that point, the original voltage is not recoverable and the error needs to be corrected. A repeater placed on the line before the legibility of the signal becomes lost can still read the signal well enough to determine the intended voltages and replicate them in their original form.

BELLMAN FORD ALGORITHM The Bellman-Ford algorithm computes single-source shortest paths in a weighted digraph.'1' For graphs with only non-negative edge weights, the faster Dijkstra's algorithm also solves the problem. Thus, Bellman-Ford is used primarily for graphs with negative edge weights. The algorithm is named after its developers, Richard Bellman and Lester Ford, Jr. Negative edge weights are found in various applications of graphs, hence the usefulness of this algorithm.'2' However, if a graph contains a "negative cycle", i.e., a cycle whose edges sum to a negative value, then walks of arbitrarily low weight can be constructed by repeatedly following the cycle, so there may not be a shortest path. In such a case, the Bellman-Ford algorithm can detect negative cycles and report their existence, but it cannot produce a correct "shortest path" answer if a negative cycle is reachable from the source. Algorithm Bellman-Ford is based on dynamic programming approach. In its basic structure it is similar to Dijkstra's Algorithm, but instead of greedily selecting the minimum-weight node not yet processed to relax, it simply relaxes all the edges, and does this |V| 1 times, where |V| is the number of vertices in the graph. The repetitions allow minimum distances to propagate accurately throughout the graph, since, in the absence of negative cycles, the shortest path can visit each node at most only once. Unlike the greedy approach, which depends on certain structural assumptions derived from positive weights, this straightforward approach extends to the general.

7. (a)

Repeater

Repeater

Corrupted signal Regenerated signal

Regenerated signal

Corrupted signal(a)Righttoleft transmission

(b) LefttoRight transmission

Fig. 2 : Function of a repeater

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 18

Bellman-Ford runs in O (|V| . |E|) time, where |V| and |E| are the number of vertices and edges respectively. procedure BellmanFord(list vertices, list edges, vertex source) // This implementation takes in a graph, represented as lists of vertices // and edges, and modifies the vertices so that their distance and // predecessor attributes store the shortest paths. // Step 1: initialize graph for each vertex v in vertices: if v is source tn v.distance := 0 else v.distance := infinity v.predecessor := null // Step 2: relax edges repeatedly for i from 1 to size(vertices)-1: for each edge uv in edges: // uv is the edge from u to v u := uv.source v := uv.destination if u.distance + uv.weight <v.distance: v.distance := u.distance + uv.weight v.predecessor := u // Step 3: check for negative-weight cycles for each edge uv in edges: u := uv.source v := uv.destination if u.distance + uv.weight < v.distance: error "Graph contains a negative-weight cycle" SPANNING TREE ALGORITHM

To avoid loops, spanning tree bridges are used. Each bridge is assigned an unique ID number. Algorithm :

1. Finding the root bridge. Bridge with smallest ID is chosen as ROOT BRIDGE.

B 200

DES 2

DES 2

4 RP

Seg 3

Seg 4

RP

B 500

2

DES 2

Seg 5

Seg 2

B 100

ROOTBRIDGE

4 4

Seg 1

RP

B 400

2

3

RP

B 300

4

4

Blocking ports

Fig. 1 Vidyala

nkar

Prelim Question Paper Solution

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 19

2. Finding root port : Root bridge records the accumulated root cost of every port. The root port is the port which has minimum accumulated root cost i.e. cost from bridge

to root.

3. Choosing the designated bridge : All the connected to the same segment send frame to each other. The bridge that can carry the frame from the segment to the root with cheapest cost is

designated bridge and the particular port that connects the bridge to that segment is called designated port.

Blocking ports are the ports that are neither root ports nor designated ports.

Note : Root port cannot be chosen as designated port. A bridge can have only one Root port but more than on designated port. IP ADDRESSING To identify each node on the Internet, we have to assign a unique address to each node.

A node (such as a router or a multihomed host) may have multiple network interfaces with each interface connected to a different network.

An IP address has a fixed length of 32 bits. The address structure was originally defined to have a twolevel hierarchy: network ID and host ID.

The network ID identifies the network the host is connected to. Consequently, all hosts connected to the same network have the same network ID.

The host ID identifies the network connection to the host rather than the actual host.

An implication of this powerful aggregation concept is that a router can forward packets based on the network ID only, thereby shortening the size of the routing table significantly.

The host ID is assigned by the network administrator at the local site.

The network ID for an organization may be assigned by the ISP. An ISP in turn may request the network ID from its regional Internet registry: American Registry for Internet Numbers (ARIN), Reseaux IP Europeens (RIPE), or Asia Pacific Network information Center (APNIC).

When TCP/IP is used only within an intranet (an internal and private internet), the local network administrator may wish to assign the network ID on its own.

However, the address will not be recognized by a host on the global Internet.

The formats of the “classful” IP address are shown in figure 1. The bit position shows the number of bits from the most significant bit.

The IP address structure is divided into five address classes: Class A, Class B, Class C, Class D and Class E, identified by the most significant bits of the address as shown in the figure.

Class A addresses have seven bits for network IDs and 24 bits for host IDs, allowing up to 126 networks and about 16 million hosts per network.

Class B addresses have 14 bits for network IDs and 16 bits for host IDs, allowing about 16,000 networks and about 64,000 hosts for each network.

7. (b)

0 Net ID Host ID

1 0 Net ID Host ID

1 1 0 Net ID Host ID

1 1 1 0 Multicast address

1 1 1 1 Reserved for experiments

Bit position 0 1 2 3 8 16 31 Class A

Class B

Class C

Class D

Class E

Fig. 1 : The five classes of IP addresses

Vidyala

nkar

Vidyalankar : B.E. CCN

1113/Engg/BE/Pre Pap/2013/EXTC/Soln/CCN 20

Class B addresses have 14 bits for network IDs and 16 bits for host IDs, allowing about 16,000 networks and about 64,000 hosts for each network.

Class C addresses have 21 bits for network IDs and 8 bits for host IDs, allowing about 2 million networks and 254 hosts per network.

Class D addresses are used for multicast services that allow a host to send information to a group of hosts simultaneously.

Class E addresses are reserved for experiments. An ID that contains all 1s or all 0s has a special purpose. A host ID that contains all 1s is

meant to broadcast the packet to all hosts on the network specified by the network ID. If the network ID also contains all 1s, the packet is broadcast on the local network.

A host ID that contains all 0s refers to the network specified by the network ID, rather than to a host. It is possible for a host not to know its IP address immediately after being booted up.

In this case the host may transmit packets with all 0s in the source address in an attempt to find out its own IP address.

The machine is identified by its MAC address. Other hosts interpret the packet as originating from “this” host.

IP addresses are usually written in dotteddecimal notation so that they can be communicated conveniently by people.

The address is broken into four bytes with each byte being represented by a decimal number and separated by a dot. For example, an IP address of

10000000 10000111 01000100 00000101 is written as 128.135.68.5 in dotteddecimal notation.

Vidyala

nkar