q.1(a) explain the following fields of an ip datagram ...vidyalankar.org/upload/it_(yogesh...

29
0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 1 Vidyalankar T.Y. B.Sc. (IT) : Sem. VI Internet Technologies Time : 2½ Hrs. Prelim Question Paper Solution Marks : 75 Q.1 Answer any TWO of the following: [10] Q.1(a) Explain the following fields of an IP datagram : HLEN, Total Length, Identification, Flags, Time to Live. [5] (A) Header length (HLEN) This 4-bit field defines the total length of the datagram header in 4byte words. This field is needed because the length of the header is variable (between 20 and 60 bytes). When there are no options, the header length is 20 bytes, and the value of this field is 5 (5 x 4 = 20). When the option field is at its maximum size, the value of this field is 15(15x4 = 60). Total length This is a 16-bit field that defines the total length (header plus data) of the IP datagram in bytes. To find the length of the data coming from the upper layer, subtract the header length from the total length. The header length can be found by multiplying the value in the HLEN field by four. Length of data = total length - header length Identification This field is used in fragmentation. Flags This field is used in fragmentation. Time to live A datagram has a limited lifetime in its travel through an internet. This field was originally designed to hold a timestamp, which was decremented by each visited router. The datagram was discarded when the value became zero. However, for this scheme, all the machines must have synchronized clocks and must know how long it takes for a datagram to go from one machine to another. Today, this field is mostly used to control the maximum number of hops (routers) visited by the datagram. When a source host sends the datagram, it stores a number in this field. This value is approximately two times the maximum number of routes between any two hosts. Each router that processes the datagram decrements this number by one. If this value, after being decremented, is zero, the router discards the datagram. This field is needed because routing tables in the Internet can become corrupted. A datagram may travel between two or more routers for a long time without ever getting delivered to the destination host. This field limits the lifetime of a datagram. Another use of this field is to intentionally limit the journey of the packet. For example, if the source wants to confine the packet to the local network, it can store 1 in this field. When the packet arrives at the first router, this value is decremented to 0, and the datagram is discarded. Q.1(b) Explain any two modules of IP Package. [5] (A) Header-Adding Module The header-adding module receives data from an upper-layer protocol along with the destination IP address. It encapsulates the data in an IP datagram by adding the IP header. Processing Module The processing module is the heart of the IP package. In our package, the processing module receives a datagram from an interface or from the header-adding module. It treats both cases the same. A datagram must be processed and routed regardless of where it comes from. Vidyalankar

Upload: doantu

Post on 14-Mar-2018

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 1

Vidyalankar T.Y. B.Sc. (IT) : Sem. VI Internet Technologies

Time : 2½ Hrs. Prelim Question Paper Solution Marks : 75

Q.1 Answer any TWO of the following: [10]Q.1(a) Explain the following fields of an IP datagram : HLEN, Total Length,

Identification, Flags, Time to Live. [5]

(A) Header length (HLEN) This 4-bit field defines the total length of the datagram header in 4byte words. This field is

needed because the length of the header is variable (between 20 and 60 bytes). When there are no options, the header length is 20 bytes, and the value of this field is 5 (5 x 4 = 20). When the option field is at its maximum size, the value of this field is 15(15x4 = 60).

Total length This is a 16-bit field that defines the total length (header plus data) of the IP datagram in bytes.

To find the length of the data coming from the upper layer, subtract the header length from the total length. The header length can be found by multiplying the value in the HLEN field by four.

Length of data = total length - header length Identification This field is used in fragmentation. Flags This field is used in fragmentation. Time to live A datagram has a limited lifetime in its travel through an internet. This field was originally

designed to hold a timestamp, which was decremented by each visited router. The datagram was discarded when the value became zero. However, for this scheme, all the machines must have synchronized clocks and must know how long it takes for a datagram to go from one machine to another. Today, this field is mostly used to control the maximum number of hops (routers) visited by the datagram. When a source host sends the datagram, it stores a number in this field. This value is approximately two times the maximum number of routes between any two hosts. Each router that processes the datagram decrements this number by one. If this value, after being decremented, is zero, the router discards the datagram.

This field is needed because routing tables in the Internet can become corrupted. A datagram may travel between two or more routers for a long time without ever getting delivered to the destination host. This field limits the lifetime of a datagram.

Another use of this field is to intentionally limit the journey of the packet. For example, if the source wants to confine the packet to the local network, it can store 1 in this field. When the packet arrives at the first router, this value is decremented to 0, and the datagram is discarded.

Q.1(b) Explain any two modules of IP Package. [5](A) Header-Adding Module The header-adding module receives data from an upper-layer protocol along with the destination

IP address. It encapsulates the data in an IP datagram by adding the IP header. Processing Module The processing module is the heart of the IP package. In our package, the processing module

receives a datagram from an interface or from the header-adding module. It treats both cases the same. A datagram must be processed and routed regardless of where it comes from.

Vidyala

nkar

Page 2: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 2

The processing module first checks to see if the datagram has reached its final destination. In this case, the packet is sent to the reassembly module.

If the node is a router, it decrements the time-to-live (TTL) field by one. If this value is less than

or equal to zero, the datagram is discarded and an ICMP message is sent to the original sender. If the value of TTL is greater than zero after decrement, the processing module sends the datagram to the forwarding module.

Q.1(c) Explain the Functions of Transport Layer of the OSI Model. [5](A) Transport Layer The network layer is responsible for sending individual datagrams from computer A to computer

B; the transport layer is responsible for delivering the whole message, which is called a segment, a user datagram, or a packet, from A to B. A segment may consist of a few or tens of datagrams. The segments need to be broken into datagrams and each datagram has to be delivered to the network layer for transmission. Since the Internet defines a different route for each datagram, the datagrams may arrive out of order and may be lost. The transport layer at computer B needs to wait until all of these datagrams to arrive, assemble them and make a segment out of them.

Traditionally, the transport layer was represented in the TCP/IP suite by two protocols: User

Datagram Protocol (UDP) and Transmission Control Protocol (TCP). A new protocol called Stream Control Transmission Protocol (SCTP) has been introduced in the last few years.

The unit of communication at the transport layer is a segment, user datagram, or a packet,

depending on the specific protocol used in this layer. Q.1(d) Comparison of IPV4 & IPV6. [5](A)

IPv4 IPv6 1) Source and destination addresses are 32

bits (4 bytes) in length. Source and destination addresses are 128 bits (16 bytes) in length.

2) IPsec support is optional. IPsec is mandatory and end-to-end. 3) Identification of packet flow for QoS

handling by routers is absent within the IPV4 header.

Packet flow identification for Qos handling by routers is included in the IPv6 header using the flow label field.

4) Fragmentation is performed by both routers and the sending host.

Fragmentation is not done by routers, only the sending host.

5) Header includes a checksum. Header does not include a checksum. 6) Header includes options. All optional data is moved to IPv6 extensions

headers. 7) Address Resolution Protocol (ARP) uses

broadcast ARP request frames to resolve an IPv4 address to a link layer address.

ARP Request frames are replaced with multicast neighbor solicitation messages.

8) Internet Group Management Protocol (IGMP) is used to manage local subnet group membership.

IGMP is replaced with Multicast Listener Discovery (MLD) messages.

9) ICMP Router Discovery is used to determine the IPv4 address of the best default gateway and is optional.

ICMP Router Discovery is replaced with ICMPv6 Router solicitation and Router Advertisement messages and is required.

10) Broadcast addresses are used to send traffic to all nodes on a subnet.

There are no IPv6 broadcast addresses. Instead, a linklocal scope all-nodes multicast address is used.

11) Must be configured either manually or through DHCP.

Does not require manual configuration or DHCP.

Vidyala

nkar

Page 3: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 3

12) Uses host address (A) resources records in the Domain Name System (DNS) to map host names to IPv4 addresses.

Uses host address (AAA) resource records in the Domain Name System (DNS) to map host names to IPv6 addresses.

13) Uses pointer (PTR) resource records in the INADDR ARPA DNS domain to map IPv4 addresses to host names.

Uses pointer (PTR) resource records in the IP6 ARPA DNS domain to map IPv6 addresses to host names.

14) Must support a 576-byte packet size (possibly fragmented).

Must support a 1280-byte packet size (without fragmentation).

Q.2 Answer any TWO of the following: [10]Q.2(a) Write a short note on ARP. [5](A) Anytime a host or a router has an IP datagram to send to another host or router, it has the logical

(IP) address of the receiver. But the IP datagram must be encapsulated in a frame to be able to pass through the physical network. This means that the sender needs the physical address of the receiver. A mapping corresponds a logical address to a physical address.

As we said before, this can be done either statically or dynamically. The association between logical and physical addresses can be statically stored in a table. The sender can look in the table and find the physical address corresponding to a logical address. But as we discussed before, this is not a good solution. Every time a physical address is changed, the table must be updated. Updating tables on all machines at frequent intervals is a very demanding task.

The mapping, however, can be done dynamically, which means that the sender asks the receiver to announce its physical address when needed. ARP is designed for this purpose.

ARP associates an IP address with its physical address. On a typical physical network, such as a LAN, each device on a link is identified by a physical or station address that is usually imprinted on the NIC.

Anytime a host, or a router, needs to find the physical address of another host or router on its network, it sends an ARP query packet. The packet includes the physical and IP addresses of the sender and the IP address of the receiver. Because the sender does not know the physical address of the receiver, the query is broadcast over the network (see Figure 1).

Every host or router on the network receives and processes the ARP query packet, but only the intended recipient recognizes its IP address and sends back an ARP response packet. The response packet contains the recipient's IP and physical addresses. The packet is unicast directly to the inquirer using the physical address received in the query packet.

In Figure 1(a), the system on the left (A) has a packet that needs to be delivered to another system (B) with IP address 141.23.56.23. System A needs to pass the packet to its data link layer for the actual delivery, but it does not know the physical address of the recipient. It uses the services of ARP by asking the ARP protocol to send a broadcast ARP request packet to ask for the physical address of a system with an IP address of 141.23.56.23.

Fig. 1 : ARP operation

Vidyala

nkar

Page 4: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 4

This packet is received by every system on the physical network, but only system B will answer it, as shown in figure 1(b). System B sends an ARP reply packet that includes its physical address. Now system A can send all the packets it has for this destination using the physical address it received.

Q.2(b) Explain the Timers used in RIP. [5](A) Timers in RIP RIP uses three times to support its operation (see Figure). The periodic timer controls the

sending of messages, the expiration timer governs the validity of a route, and the garbage collection timer advertises the failure of a route.

Fig. : RIP timers Periodic Timer The periodic timer controls the advertising of regular update messages. Although the protocol

specifies that this timer must be set to 30 s. the working model uses a random number between 25 and 35 s. This is to prevent any possible synchronization and therefore overload on an internet if routers update simultaneously.

Each router has one periodic timer that is randomly set to a number between 25 and 35. It counts

down; when zero is reached, the update message is sent, and the timer is randomly set once again.

Expiration Timer The expiration timer governs the validity of a route. When a router receives update information

for a route, the expiration timer is set to 180 s for that particular route. Every time a new update for the route is received, the timer us reset. In normal situations this occurs every 30 s. However, if there is a problem on an internet and no update is received within the allotted 180 s, the route is considered expired and the hop count of the route is set to 16, which means the destination is unreachable. Every route has its own expiration timer.

Garbage Collections Timer When the information about a route becomes invalid, the router does not immediately purge that

route from its table. Instead, it continues to advertise the route with a metric value of 16. At the same time, a timer called the garbage collection timer is set to 120 s for that route. When the count reaches zero, the route is purged from the table. This timer allows neighbors to become aware of the invalidity of a route prior to purging.

Q.2(c) What are the three phases that a mobile host should go through to communicate

with remote host? [5]

(A) To communicate with a remote host, a mobile host goes through three phases: agent discovery, registration, and data transfer, as shown in figure.

The first phase, agent discovery, involves the mobile host, the foreign agent, and the home

agent. The second phase, registration, also involves the mobile host and the two agents. Finally, in the third phase, the remote host is also involved.

Vidyala

nkar

Page 5: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 5

Fig. : Remote host and mobile host communication

Q.2(d) Explain any one module of ARP. [5](A) The cache-control module is responsible for maintaining the cache table. It periodically (for

example, every 5 s) checks the cache table, entry by entry.

If the state of the entry is FREE, it continues to the next entry. If the state is PENDING, the module increments the value of the attempts field by 1. It then checks the value of the attempts field. If this value is greater than the maximum number of attempts allowed, the state is changed to FREE and the corresponding queue is destroyed. However, if the number of attempts is less than the maximum, the module creates and sends another ARP request.

If the state of the entry is RESOLVED, the module decrements the value of the time-out field by the amount of time elapsed since the last check. If this value is less than or equal to zero, the state is changed to FREE and the queue is destroyed.

Cache-Control Module 1. Sleep until the periodic timer matures. 2. For every entry in the cache table 1. If (the state is FREE) 1. Continue. 2. If (the state is PENDING) 1. Increment the value of attempts by 1. 2. If (attempts greater than maximum) 1. Change the state to FREE. 2. Destroy the corresponding queue. 3. Else 1. Send an ARP request. 4. Continue. 3. If (the state is RESOLVED) 1. Decrement the value of time-out by the value of elapsed time. 2. If (time-out less than or equal to zero) 1. Change the state to FREE. 2. Destroy the corresponding queue. 3. Return.

Vidyala

nkar

Page 6: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 6

Q.3 Answer any TWO of the following: [10]Q.3(a) Explain the concept of Silly Window Syndrome Problem by sender in TCP and give

its solution . [5]

(A) Syndrome Created by the Sender The sending TCP may create a silly window syndrome if it is serving an application program

that creates data slowly, for example, 1 byte at a time. The application program writes 1 byte at a time into the buffer of the sending TCP. If the sending TCP does not have any specific instructions, it may create segments containing 1 byte of data. The result is a lot of 41-byte segments that are traveling through an internet.

The solution is to prevent the sending TCP from sending the data byte by byte. The sending TCP

must be forced to wait as it collects data to send in a larger block. How long should the sending TCP wait? If it waits too long, it may delay the process. If it does not wait long enough, it may end up sending small segments. Nagle found an elegant solution.

Nagle’s Algorithm Nagle’s algorithm is very simple, but it solves the problem. This algorithm is for the sending

TCP: i) The sending TCP sends the first piece of data it receives from the sending application

program even if it is only 1 byte. ii) After sending the first segment, the sending TCP accumulates data in the output buffer and

waits until either the receiving TCP sends an acknowledgment or until enough data has accumulated to fill a maximum-size segment. At this time, the sending TCP can send the segment.

iii) Step 2 is repeated for the rest of the transmission. Segment 3 must be sent if an acknowledgment is received for segment 2 or enough data is accumulated to fill a maximum-size segment.

The elegance of Nagle's algorithm is in its simplicity and in the fact that it takes into account the speed of the application program that creates the data and the speed of the network that transports the data. If the application program is faster than the network, the segments are larger (maximum-size segments). If the application program is slower than the network, the segments are smaller (less than the maximum segment size).

Q.3(b) Describe the 3 Way handshake used for Connection Establishment in TCP. [5](A) The connection establishment described above is called three-way handshaking. In this

procedure, an application program, called the client, wants to make a connection with another application program, called the server, using TCP as the transport layer protocol.

The three-way handshaking procedure starts with the server. The server program tells its TCP

that it is ready to accept a connection. This is called a request for a passive opqn. Although the server TCP is ready to accept any connection from any machine in the world it cannot make the connection itself.

The client program makes a request for an active open. A client that wishes to connect to a

server tells its TCP that it needs to be connected to a particular server. The TCP can now start the three-way handshaking process as shown in Figure.

The steps of the process are as follows: i) The client sends the first segment, a SYN segment. The segment includes the source and

destination port numbers. The destination port number clearly defines the server to which the client wants to be connected. The segment also contains the client initialization sequence number (ISN) used for numbering the bytes of data sent from the client to the server. If the client wants to define the MSS that it can receive from the server, it can add the corresponding option here. Also, if the client needs a large window, it defines the window

Vidyala

nkar

Page 7: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 7

scale factor here using the appropriate option. This segment defines the wish of the client to make a connection with certain parameters. Note that this segment does not contain any acknowledgment number. It does not define the window size either; a window size definition makes sense only when a segment includes an acknowledgment.

ii) The server sends the second segment, a SYN and ACK segment. This segment has a dual

purpose. First, it acknowledges the receipt of the first segment using the ACK flag and acknowledgment number field. The acknowledgment number is the client initialization sequence number plus one. The server must also define the client window size. Second, the segment is used as the initialization segment for the server. It contains the initialization sequence number used to number the bytes sent from the server to the client. It also contains the window scale factor option (if needed) to be used by the server and the MSS defined by the server. As we said before, this is two segments combined into one.

iii) The client sends the third segment. This is just an ACK segment. It acknowledges the receipt

of the second segment using the ACK flag and acknowledgment number field. The acknowledgment number is the server initialization sequence number plus one. The client must also define the server window size. Note that data can be sent with the third packet.

A rare situation may occur when both processes issue an active open. In this case, both TCPs

transmit a SYN + ACK segment to each other and one single connection is established between them.

Connection Termination Any of the two parties involved in exchanging data (client or server) can close the connection.

When connection in one direction is terminated, the other party can continue sending data in the other direction. Therefore, four actions are needed to close the connections in both directions:

i) Host A sends a FIN segment announcing its wish for connection termination. ii) Host B sends a segment acknowledging (confirming) the request of A. After this, the

connection is closed in one direction, but not in the other. Host B can continue sending data to A.

iii) When host B has finished sending its own data, it sends a FIN segment to indicate that it wants to close the connection.

iv) Host A acknowledges (confirms) the request of B. This implies four steps. We cannot combine steps 2 and 3 here as we did in connection

establishment. Steps 2 and 3 may or may not happen at the same time. The connection may be closed in one direction, but left open in the other direction.

Fig. : Three way handshaking

Vidyala

nkar

Page 8: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 8

Q.3(c) Draw & explain UDP Packet Format. [5](A) User Datagram UDP packets, called user datagrams, have a fixed-size header of 8 bytes. Figure 1 shows the

format of a user diagram. The fields are follows :

Fig. 1: User datagram format

Source port number This is the port number used by the process running on the source host. It is 16 bits long,

which means that the port number can range from 0 to 65,535. If the source host is the client (a client sending a request), the port number, in most cases, is an ephemeral port number requested by the process and chosen by the UDP software running on the source host. If the source host is the server (a server sending a response), the port number, in most cases, is a well-known port number.

Destination port number This is the port number used by the process running on the destination host. It is also 16 bits

long. If the destination host is the server (a client sending a request), the port number, in most cases, is a well-known port number. If the destination host is the client (a server sending a response), the port number, in most cases, is an ephemeral port number. In this case, the server copies the ephemeral port number it has received in the request packet.

Length This is a 16-bit field that defines the total length of the user datagram, header plus data. The

16 bits can define a total length of 0 to 65,535 bytes. However, the total length needs to be much less because a UDP user datagram is stored in an IP datagram with the total length of 65,535 bytes. The length field in a UDP user datagram is actually not necessary. A user datagram is encapsulated in an IP datagram. There is a field in the IP datagram that defines the total length. There is another field in the IP datagram that defines the length of the header. So if we subtract the value of the second field from the first, we can deduce the length of the UDP datagram that is encapsulated in an IP datagram.

UDP length = IP length - IP header's length However, the designers of the UDP protocol felt that it was more efficient for the destination

UDP to calculate the length of the data from the information provided in the UDP user datagram rather than ask the IP software to supply this information. We should remember that when the IP software delivers the UDP user datagram to the UDP layer, it has already dropped the IP header.

Checksum This field is used to detect errors over the entire user datagram (header plus data).

Vidyala

nkar

Page 9: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 9

Q.3(d) List and explain types of TCP Timers [5](A) TCP Timers To perform its operation smoothly, TCP uses the four timers shown in Figure. Retransmission Timer To control a lost or discarded segment, TCP employs a retransmission timer that handles the

retransmission time, the waiting time for an acknowledgment of a segment. When TCP sends a segment, it creates a retransmission timer for that particular segment. Two situations may occur :

i) If an acknowledgment is received for this particular segment before the timer goes off, the timer is destroyed.

ii) If the timer goes off before the acknowledgment arrives, the segment is retransmitted and the timer is reset.

Persistence Timer To deal with the zero window-size advertisement, TCP needs another timer. Suppose the

receiving TCP announces a window size of zero. The sending TCP then stops transmitting segments until the receiving TCP sends an acknowledgment announcing a nonzero window size. This acknowledgment can be lost. Remember that acknowledgments are not acknowledged in TCP. If this acknowledgment is lost, the receiving TCP thinks that it has done its job and waits for the sending TCP to send more segments. The sending TCP has not received an acknowledgment and waits for the other TCP to send an acknowledgment advertising the size of the window. Both TCPs can continue to wait for each other forever and result in deadlock.

To correct this deadlock, TCP uses a persistence timer for each connection. When the

sending TCP receives an acknowledgment with a window size of zero, it starts a persistence timer. When the persistence timer goes off, the sending TCP sends a special segment called a probe. This segment contains only 1 byte of data. It has a sequence number, but its never acknowledged; it is even ignored in calculating the sequence number for the rest of the data. The probe alerts the receiving TCP that the acknowledgment was lost and should be resent.

The value of the persistence timer is set to the value of the retransmission time. However, if a response is not received from the receiver, another probe segment is sent and the value of the persistence timer is doubled and reset. The sender continues sending the probe segments and doubling and resetting the value of the persistence timer until the value reaches a threshold (usually 60 s). After that the sender sends one probe segment every 60 s until the window is reopened.

Keepalive Timer A keepalive timer is used in some implementations to prevent a long idle connection

between two TCPs. Suppose that a client opens a TCP connection to a server, transfers some data, and becomes silent. Perhaps the client has crashed. In this case, the connection remains open forever.

To remedy this situation, most implementations equip a server with a keepalive timer. Each

time the server hears from a client, it resets this timer. The time-out is usually two hours. If the server does not hear from the client after two hours, it sends a probe segment. If there is no response after 10 probes, each of which is 75 s apart, it assumes that the client is down and terminates the connection.

Fig. : TCP timers

Vidyala

nkar

Page 10: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 10

Time Waited Timer The time-waited timer is used during connection termination. When TCP closes a con-

nection, it does not consider the connection really closed. The connection is held in limbo for a time-waited period (see Figure 27). This allows duplicate FIN segments, if any, to arrive at the destination to be discarded. The value for this timer is usually two times the expected lifetime of a segment.

Q.4 Answer any TWO of the following: [10]Q.4(a) Explain the DHCP Client Transition Diagram [5](A)

Fig. : DHCP client transition diagram. INIT State The client broadcasts a DHCPDISCOVER message.

SELECTING State Those servers that can provide this type of service respond with a DHCPDISCOVER message.

In these messages, the servers offer an IP address. They can also offer the lease duration. The default is 1 hour. The server that sends a DHCPOFFER locks the offered IP address so that it is not available to any other clients.

REQUESTING State The client remains in the requesting state until it receives a DHCPACK message from the server

that creates the biding between the client physical address and its IP address. After receipt of the DHCPACK, the client goes to the bound state.

BOUND State In this state, the client can use the IP address until the lease expires. When 50 percent of the

lease period is reached, the client sends another DHCPREQUEST to ask for renewal. RENEWING State The client remains in the renewing state until one of two events happens. It can receive a

DHCPACK, which renews the lease agreement. REBINDING State The client remains in the rebinding state until one of three events happens. If the client receives

a DHCPNACK or the lease expires, it goes back to the initializing state and tries to get another IP address. If the client receives a DHCPACK, it goes to the bound state and resets the timer.

Vidyala

nkar

Page 11: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 11

Q.4(b) Write a short note on Recursive Resolution in DNS [5](A) Recursive Resolution Figure shows the recursive resolution.

Fig. : Recursive resolution.

The client (resolver) can ask for a recursive answer from a name server. This means that the resolver expects the server to supply the final answer. If the server is the authority for the domain name, it checks it database and responds. If the server is not the authority, it sends the request to another server (the parent usually) and waits for the response. If the parent is the authority, it responds; otherwise, it sends the query to yet another server. When the query is finally resolved, the response travels back until it finally reaches the requesting client.

Q.4(c) Describe DHCP operation on different networks [5](A) Different Networks As in other applicationlayer processes, a client can be in one network and the server in another,

separated by several other networks. Figure 18 shows the situation.

Fig. : Client and server on two different networks.

However, there is one problem that must be solved. The DHCP request is broadcast because the

client does not know the IP address of the server. A broadcast IP datagram cannot pass through any router. A router receiving such a packet discards it. Recall that an IP address of all 1s is a limited broadcast address.

Q.4(d) List and explain features of SCTP [5](A) SCTP Features Let us first discuss the general features of SCTP and then compare them with those of TCP. Transmission Sequence Number (TSN) The unit of data in TCP is a byte. Data transfer in TCP is controlled by numbering bytes using a

sequence number. On the other hand, the unit of data in SCTP is a data chunk, which may or

Vidyala

nkar

Page 12: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 12

may not have a one-to-one relationship with the message coming from the process because of fragmentation. Data transfer in SCTP is controlled by numbering the data chunks. SCTP uses a transmission sequence number (TSN) to number the data chunks. In other words, the TSN in SCTP plays the analogous role as the sequence number in TCP. TSNs are 32 bits long and randomly initialized between 0 and 232 - 1. Each data chunk must carry the corresponding TSN in its header.

In SCTP, a data chunk is numbered using a TSN. Stream Identifier (SI) In TCP, there is only one stream in each connection. In SCTP, there may be several streams in

each association. Each stream in SCTP needs to be identified using a stream identifier (SI). Each data chunk must carry the SI in its header so that when it arrives at the destination, it can be properly placed in its stream. The SI is a 16-bit number starting from 0.

To distinguish between different streams, SCTP uses an SI. Stream Sequence Number (SSN) When a data chunk arrives at the destination SCTP, it is delivered to the appropriate stream and

in the proper order. This means that, in addition to an SI, SCTP defines each data chunk in each stream with a stream sequence number (SSN).

To distinguish between different data chunks belonging to the same stream, SCTP uses SSNs. Q.5 Answer any TWO of the following: [10]Q.5(a) Write a short note on NVT (Network Virtual Terminal) in Telnet [5](A) Network Virtual Terminal (NVT) The mechanism to access a remote computer is complex. This is because every computer and its

operating system accepts a special combination of characters as tokens. For example, the endoffile token in a computer running the DOS operating system is Ctrl+z, while the UNIX operating system recognizes Ctrl+d.

We are dealing with heterogeneous systems. If we want to access any remote computer in the world, we must first know what type of computer we will be connected to, and we must also install the specific terminal emulator used by that computer. TELNET solves this problem by defining a universal interface called the Network Virtual Terminal (NVT) character set. Via this interface the client TELNET translates characters (data or commands) that come from the local terminal into NVT form and delivers them to the network. The server TELNET, on the other hand, translates data and commands from NVT form into the form acceptable by the remote computer. For an illustration of this concept. (see Figure 1)

Fig. 1 : Concept of NVT.

NVT Character Set NVT uses two sets of characters, one for data and one for control. Both are 8bit bytes. (see

Figure 2)

Fig. 2 : Format of data and control characters.

Vidyala

nkar

Page 13: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 13

Data Characters. For data, NVT normally uses what is called NVT ASCII. This is an 8bit character set in which the seven lowest order bits are the same as US ASCII and the highest order bit is 0. (see Figure 2) Although it is possible to send an 8bit ASCII (with the highest order bit set to be 0 or 1), this must first be agreed upon between the client and the server using option negotiation.

Control Characters. To send control characters between computers (from client to server or

vice versa), NVT uses an 8bit character set in which the highest order bit is set to 1. (see Figure 4) Table 1 lists some of the control characters and their meanings. Later we will categorize these control characters on the basis of their functionalities.

Table 1 : Some NVT control characters.

Character Decimal Binary Meaning EOF 236 11101100 End of file EOR 239 11101111 End of record SE 240 11110000 Suboption end NOP 241 11110001 No operation DM 242 11110010 Data mark BRK 243 11110011 Break IP 244 11110100 Interrupt process AO 245 11110101 Abort output AYT 246 11110110 Are you there? EC 247 11110111 Erase character EL 248 11111000 Erase line GA 249 11111001 Go ahead SB 250 11111010 Suboption begin WILL 251 11111011 Agreement to enable option WONT 252 11111100 Refusal to enable option DO 253 11111101 Approval to option request DONT 254 11111110 Denial of option request IAC 255 11111111 Interpret (the next character) as

control Embedding TELNET uses only one TCP connection. The server uses the well-known port 23 and the client

uses an ephemeral port. The same connection is used for sending both data and control characters. TELNET accomplishes this by embedding the control characters in the data stream. However, to distinguish data from control characters, each sequence of control characters is preceded by a special control character called interpret as control (IAC). For example, imagine a user wants a server to display a file (file 1) on a remote server. She types:

cat file1 in which cat is a Unix command that displays the content of the file on the screen. However, the

name of the file has been mistyped (filea instead of file1). The user uses the backspace key to correct this situation.

cat filea<backspace>1 However, in the default implementation of TELNET, the user cannot edit locally; the editing is

done at the remote server. The backspace character is translated into two remote characters (IAC

Vidyala

nkar

Page 14: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 14

EC), which is embedded in the data and sent to the remote server. What is sent to the server is shown in Figure 3.

Fig. 3 : An example of embedding

Q.5(b) What is FTP? Explain Control & Data Connection in FTP. [5](A) File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file

from one host to another. Two systems may have different ways to represent text data. Two systems may have different directory structures.

FTP differs from other clientserver applications in that it established two connections between

the hosts. Once connection is used for data transfer, the other for control information (commands and responses). Separation of commands and data transfer makes FTP more efficient. The control connection uses very simple rules of communication. We need to transfer only a line of command or a line of response at a time.

FTP uses two wellknown TCP ports: Port 21 is used for the control connection, and port 20 is used for the data connection. Figure 1 shows the basic model of FTP.

Fig. 1 : FTP.

Connections The two FTP connections, control and data, use different strategies and different port numbers. Control Connection The control connection is created in the same way as other application programs described so

far. There are two steps: The server issues a passive open on the well-known port 21 and waits for a client. The client uses an ephemeral port and issues an active open.

Figure 2 shows the initial connection between the server and the client.

Fig. 2 : Opening the control connection.

Vidyala

nkar

Page 15: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 15

Data Connection The data connection uses the well-known port 20 at the server site. However, the creation of a

data connection is different from what we have seen so far. The following shows how FTP creates a data connection:

The client, not the server, issues a passive open using an ephemeral port. This must be done by the client because it is the client that issues the commands for transferring files.

The client sends this port number to the server using the PORT command. The server receives the port number and issues an active open using the wellknown port 20

and the received ephemeral port number. The steps for creating the initial data connection are shown in figure 3.

Fig. 3 : Creating the data connection.

Q.5(c) Explain the use of Web Cookies. [5](A) Cookies The World Wide Web was originally designed as a stateless entity. A client sends a request; a

server responds. Their relationship is over. The original design of WWW, retrieving publicly available documents, exactly fits this purpose. Today the Web has other functions; some are listed below:

Websites are being used as electronic stores that allow users to browse through the store, select wanted items, put them in an electronic cart, and pay at the end with a credit card.

Some websites need to allow access to registered clients only. Some websites are used as portals: The user selects the Web pages he wants to see. Some websites are just advertising. For these purposes, the cookie mechanism was devised.

Creating and Storing Cookies : The creation and storing of cookies depend on the implementation; however, the principle is the same.

1) When a server receives a request from a client, it stores information about the client in a file or a string. The information may include the domain name of the client, the contents of the cookie (information the server has gathered about the client such as name, registration number, and so on), a timestamp, and other information depending on the implementation.

2) The server includes the cookie in the response that it sends to the client. 3) When the client receives the response, the browser stores the cookie in the cookie

directory, which is sorted by the domain server name. Using Cookies : When a client sends a request to a server, the browser looks in the cookie

directory to see if it can find a cookie sent by that server. If found, the cookie is included in the

Vidyala

nkar

Page 16: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 16

request. When the server receives the request, it knows that this is an old client, not a new one. Note that the contents of the cookie are never read by the browser or disclosed to the user. It is a cookie made by the server and eaten by the server. Now let us see how a cookie is used for the four previously mentioned purposes:

1) An electronic store (e-commerce) can use a cookie for its client shoppers. When a client selects an item and inserts it into a cart, a cookie that contains information about the item, such as its number and unit price, is sent to the browser. If the client selects a second item, the cookie is updated with the new selection information. And so on. When the client finishes shopping and wants to check out, the last cookie is retrieved and the total charge is calculated.

2) The site that restricts access to registered clients only sends a cookie to the client when the client registers for the first time. For any repeated access, only those clients that send the appropriate cookie are allowed.

3) A Web portal uses the cookie in a similar way. When a user selects her favorite pages, a cookie is made and sent. If the site is accessed again, the cookie is sent to the server to show what the client is looking for.

4) A cookie is also used by advertising agencies. An advertising agency can place banner ads on some main website that is often visited by users. The advertising agency supplies only a URL that gives the banner address instead of the banner itself. When a user visits the main website and clicks the icon of an advertised corporation, a request is sent to the advertising agency. The advertising agency sends the banner, a GIF file for example, but it also includes a cookie with the ID of the user. Any future use of the banners adds to the database that profiles the Web behavior of the user. The advertising agency has compiled the interests of the user and can sell this information to other parties. This use of cookies has made them very controversial. Hopefully, some new regulations will be devised to preserve the privacy of users.

Q.5(d) Write a short on WWW. [5](A) The WWW today is a distributed clientserver service, in which a client using a browser can

access a service using a server. However, the service provided is distributed over many locations called sites. Each site holds one or more documents, referred to as Web pages. Each Web page, however, can contain some links to other Web pages in the same or other sites. In other words, a Web page can be simple or composite. A simple Web page has no link to other Web pages; a composite Web page has one or more links to other Web pages. Each Web page is a file with a name and address.

Web Client (Browser) A variety of vendors offer commercial browsers that interpret and display a Web document, and

all of them use nearly the same architecture. Each browser usually consists of three part: a controller, client protocol, and interpreters. (see Figure 1)

Fig. 1 : Browser.

Web Server The Web page is stored at the server. Each time a client request arrives, the corresponding

document is sent to the client. The improve efficiency, servers normally store requested files in a cache in memory; memory is faster to access than disk.

Vidyala

nkar

Page 17: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 17

Uniform Resource Locator (URL) A client that wants to access a Web page needs the file name and the address. To facilitate the

access of documents distributed throughout the world, HTTP uses locators. The uniform resource locator (URL) is a standard locator for specifying any kind of information on the Internet. The URL defines four things: protocol, host computer, port, and path (see Figure 2)

Fig. 2 : URL

The protocol is the clientserver application program used to retrieve the document. Many

different protocols can retrieve a document; among them are Gopher, FTP, HTTP, News, and TELNET. The most common today is HTTP.

The host is the domain name of the computer on which the information is located. Web pages

are usually stored in computers, and computers are given domain name aliases that usually begin with the characters “www”. This is not mandatory, however, as the host can have any domain name.

The URL can optionally contain the port number of the server. If the port is included, it is

inserted between the host and the path, and it is separated from the host by a colon. Path is the pathname of the file where the information is located. Note that the path can itself

contain slashes that, in the UNIX operating system, separate the directories from the subdirectories and files. In other words, the path defines the complete file name where the document is stored in the directory system.

Q.6 Answer any TWO of the following: [10]Q.6(a) Explain Message Access Agents(MAA) ie POP3 & IMAP4 [5](A) The first and the second stages of mail delivery use SMTP. However, SMTP is not involved in

the third stage because SMTP is a push protocol; it pushes the message from the client to the server. In other words, the direction of the bulk data (messages) is from the client to the server. On the other hand, the third stage needs a pull protocol; the client must pull messages from the server. The direction of the bulk data are from the server to the client. The third stage uses a message access agent.

Currently two message access protocols are available: Post Office Protocol version 3 (POP3)

and Internet Mail Access Protocol, version 4 (IMAP4). Figure 1 shows the position of these two protocols in the most common situation (fourth scenario).

Fig. 1 : POP3 and IMAP4

POP3 Post Office Protocol, version 3 (POP3) is simple and limited in functionality. The client POP3

software is installed on the recipient computer; the server POP3 software is installed on the mail server.

Mail access starts with the client when the user needs to download its email from the mailbox on the

mail server. The client opens a connection to the server on TCP port 110. It then sends its user name

Vidyala

nkar

Page 18: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 18

and password to access mailbox. The user can then list and retrieve the mail messages, one by one. Figure 2 shows an example of downloading using POP3.

Fig. 2 : POP3.

POP3 has two modes: the delete mode and the keep mode. In the delete mode, the mail is deleted from the mailbox after each retrieval. In the keep mode, the mail remains in the mailbox after retrieval. The delete mode is normally used when the user is working at her permanent computer and can save and organize the received mail after reading or replying. The keep mode is normally used when the user accesses her mail away from her primary computer (e.g., a laptop). The mail is read but kept in the system for later retrieval and organizing.

Q.6(b) List & explain all MIME Headers used in Email [5](A) MIME defines five headers that can be added to the original email header section to define the

transformation parameters: MIMEVersion ContentType ContentTransferencoding ContentId ContentDescription Figure 1 shows the MIME headers. We will describe each header in detail.

Fig. 1 : MIME header.

MIMEVersion This header defines the version of MIME used. The current version is 1.1. ContentType This header defines the type of data used in the body of the message. The content type and the

content subtype are separated by a slash. Depending on the subtype, the header may contain other parameters. MIME allows seven different types of data, listed in Table 1.

Text : The original message is in 7bit ASCII format and no transformation by MIME is needed. There are two subtypes currently used, plain and HTML.

Multipart : The body contains multiple, independent parts. The multipart header needs to define the boundary between each part. A parameter is used for this purpose. The parameter is a string token that comes before each part; it is on a separate line by itself and is preceded by two hyphens. The body is terminated using the boundary token, again preceded by two

Vidyala

nkar

Page 19: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 19

hyphens and then terminated with two hyphens. Four subtypes are defined for this type: mixed, parallel, digest, and alternative. In the mixed subtype, the parts must be presented to the recipient in the exact order as in the message. Each part has a different type and is defined at the boundary. The parallel subtype is similar to the mixed subtype, except that the order of the parts is unimportant.

Table 1 : Data Types and Subtypes in MIME.

Type Subtype Description Text Plain Unformatted HTML HTML format

Multipart

Mixed Body contains ordered parts of different data types Parallel Same as above, but no order Digest Similar to Mixed, but the default is

message/RFC822 Alternative Parts are different versions of the same message

Message RFC822 Body is an encapsulated message Partial Body is a fragment of a bigger message ExternalBody Body is a reference to another message

Image JPEG Image is in JPEG format GIF Image is in GIF format

video MPEG Video is in MPEG format Audio Basic Single channel encoding of voice at 8 KHz Application PostScript Adobe PostScript

Octetstream General binary data (eightbit bytes) The digest subtype is also similar to the mixed subtype except that the default type/subtype

is message/RFC822 as defined below. In the alternative subtype, the same message is repeated using different formats. The following is an example of a multipart message using a mixed subtype:

contentType: multipart/mixed; boundary=xxxx xxxx ContentType: text/plain; . . . xxxx ContentType: image/gif; . . . xxxx

ContentTransferEncoding This header defines the method used to encode the message into 0s and 1s for transport: ContentTransferEncoding: <type>

The five types of encoding methods are listed in Table 2.

Table 2 : ContentTransferEncoding Type Description

7bit NVT ASCII characters and short lines 8bit NonASCII characters and short lines Binary NonASCII characters with unlimitedlength lines Base64 6bit blocks of data are encoded into 8bit ASCII characters Quotedprintable NonASCII characters are encoded as an equal sign plus an

ASCII code

Vidyala

nkar

Page 20: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 20

7bit : This is 7bit NVT ASCII encoding. Although no special transformation is needed, the length of the line should not exceed 1,000 characters.

8bit : This is 8bit encoding. NonASCII characters can be sent, but the length of the line still should not exceed 1,000 characters. MIME does not do any encoding here; the underlying SMTP protocol must be able to transfer 8bit nonASCII characters. It is, therefore, not recommended. Base64 and quotedprintable types are preferable.

Binary : This is 8bit encoding. NonASCII characters can be sent, and the length of the line can exceed 1,000 characters. MIME does not do any encoding here; the underlying SMPT protocol must be able to transfer binary data. It is, therefore, not recommended. Base64 and quotedprintable types are preferable.

Base64 : This is a solution for sending data made of bytes when the highest bit is not necessarily zero. Base64 transforms this type of data to printable characters, which can then be sent as ASCII characters or any type of character set supported by the underlying mail transfer mechanism. Base64 divides the binary data (made of streams of bits) into 24bit blocks. Each block is then divided into four sections, each made of 6 bits (See Figure 2).

Fig. 2 : Base64.

Each 6bit section is interpreted as one character according to Table 3. Table 3 : Base 64 Converting Table.

Value

CodeValu

e Cod

e Valu

e Cod

e Valu

e Cod

e Value

Code

Value

Code

0 A 11 L 22 W 33 h 44 s 55 3 1 B 12 M 23 X 34 i 45 t 56 4 2 C 13 N 24 Y 35 J 46 u 57 5 3 D 14 O 25 Z 36 k 47 v 58 6 4 E 15 P 26 a 37 l 48 w 59 7 5 F 16 Q 27 b 38 m 49 x 60 8 6 G 17 R 28 c 39 n 50 y 61 9 7 H 18 S 29 d 40 o 51 z 62 + 8 I 19 T 30 e 41 p 52 0 63 / 9 J 20 U 31 f 42 q 53 1 10 K 21 V 32 g 43 r 54 2

Quotedprintable. Base64 is a redundant encoding scheme; that is, 24 bits become four

characters, and eventually are sent as 32 bits. We have an overhead of 25 percent. If the data consist mostly of ASCII characters with a small nonASCII portion, we can use quotedprintable encoding. If a character is ASCII, it is sent as is. If a character is not ASCII, it is sent as three characters. The first character is the equal sign (=). The next two characters are the hexadecimal representations of the byte. Figure 3 shows an example.

Vidyala

nkar

Page 21: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 21

Fig. 3 : Quotedprintable.

ContentId This header uniquely identifies the whole message in a multiple message environment. ContentDescription This header defines whether the body is image, audio, or video.

Q.6(c) Explain Video Compression using JPEG [5](A) If the picture is not in color (gray scale), each pixel

can be represented by an 8bit integer (256 levels). If the picture is in color, each pixel can be represented by 24 bits (3 × 8 bits), with each 8 bits representing red, blue, or green (RBG). To simplify the discussion, we concentrate on a gray scale picture.

In JPEG, a gray scale picture is divided into blocks of 8 × 8 pixels (see Figure 1). The purpose of dividing the picture into blocks is to decrease the number of calculations

because, as you will see shortly, the number of mathematical operations for each picture is the square of the number of units.

The whole idea of JPEG is to change the picture into a linear (vector) set of numbers that reveals

the redundancies. The redundancies (lack of changes) can then be removed by using one of the text compression methods. A simplified scheme of the process is shown in Figure 2.

Fig. 2 : JPEG process.

Discrete Cosine Transform (DCT) : In this step, each block of 64 pixels goes through a

transformation called the discrete cosine transform (DCT). The transformation changes the 64 values so that the relative relationships between pixels are kept but the redundancies are revealed. We do not give the formula here, but we do show the results of the transformation for three cases.

Case 1 : In this case, we have a block of uniform gray, and the value of each pixel is 20. When

we do the transformations, we get a nonzero value for the first element (upper left corner); the rest of the pixels have a value of 0. The value of T(0,0) is the average (multiplied by a constant) of the P(x,y) values and is called the dc value (direct current, borrowed from electrical engineering). The rest of the values, called ac values, in T(m,n) represent changes in the pixel values. But because there are no changes, the rest of the values are 0s (see Figure 3).

Fig. 1 : JPEG gray scale.

Vidyala

nkar

Page 22: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 22

Fig. 3 : Case 1: uniform gray scale.

Fig. 4 : Case 2 : two sections

Case 2 : In the second case, we have a block with two different uniform gray scale sections. There is a sharp change in the values of the pixels (from 20 to 50). When we do the transformations, we get a dc value as well as nonzero ac values. However, there are only a few nonzero values clustered around the dc value. Most of the values are 0 (see Figure 4).

Case 3 : In the third case, we have a block that changes gradually. That is, there is no sharp

change between the values of neighboring pixels. When we do the transformations, we get a dc value, with many nonzero ac values also (Figure 5). We can say the following :

The transformation creates table T from table P. The dc value is the average value (multiplied by a constant) of the pixels. The ac values are the changes. Lack of changes in neighboring pixels creates 0s.

Fig. 5 : Case 3: gradient gray scale

Quantization : After the T table is created, the values are quantized to reduce the number of bits

needed for encoding. Previously in quantization, we dropped the fraction from each value and kept the integer part. Here, we divide the number by a constant and then drop the fraction. This reduces the required number of bits even more. In most implementations, a quantizing table (8 by 8) defines how to quantize each value. The divisor depends on the position of the value in the T table. This is done to optimize the number of bits and the number of 0s for each particular application. Note that the only phase in the process that is not completely reversible is the quantizing phase. We lose some information here that is not recoverable. As a matter of fact, the only reason that JPEG is called lossy, compression is because of this quantization phase.

Vidyala

nkar

Page 23: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 23

Compression : After quantization, the values are read from the table, and redundant 0s are removed. However, to cluster the 0s together, the table is read diagonally in a zigzag fashion rather than row by row or column by column. The reason is that if the picture changes smoothly, the bottom right corner of the T table is all 0s. Figure 6 shows the process.

Q.6(d) What are the 3 phases for a Mail Transfer in SMTP [5](A) The process of transferring a mail message occurs in three phases: connection establishment,

mail transfer, and connection termination. Connection Establishment After a client has made a TCP connection to the wellknown port 25, the SMTP server starts the

connection phase. This phase involves the following three steps, which are illustrated in Figure 1.

Fig. 1 : Connection establishment. The server sends code 220 (service ready) to tell the client that it is ready to receive mail. If

the server is not ready, it sends code 421 (service not available). The client sends the HELO message to identify itself using its domain name address. This

step is necessary to inform the server of the domain name of the client. Remember that during TCP connection establishment, the sender and receiver know each other through their IP addresses.

The server responds with code 250 (request command completed) or some other code depending on the situation.

Message Transfer After connection has been established between the SMTP client and server, a single message

between a sender and one or more recipients can be exchanged. This phase involves eight steps. Steps 3 and 4 are repeated if there is more than one recipient (see Figure 2).

The client sends the MAIL FROM message to introduce the sender of the message. It includes the mail address of the sender (mailbox and the domain name). This step is needed to give the server the return mail address for returning errors and reporting messages.

The server responds with code 250 or some other appropriate code.

Reading the table Fig. 6 :

Vidyala

nkar

Page 24: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 24

The client sends the RCPT TO (recipient) message, which includes the mail address of the recipient.

Fig. 2 : Message transfer.

The server responds with code 250 or some other appropriate code. The client sends the DATA message to initialize the message transfer. The server responds with code 354 (start mail input) or some other appropriate message. The client sends the contents of the message in consecutive lines. Each line is terminated by

a twocharacter endofline token (carriage return and line feed). The message is terminated by a line containing just one period.

The server responds with code 250 (OK) or some other appropriate code. Connection Termination After the message is transferred successfully, the client terminates the connection. This phase

involves two steps (see Figure 3) The client sends the QUIT command. The server responds with code 221 or some other appropriate code.

Fig. 3 : Connection termination.

After the connection termination phase, the TCP connection must be closed.

Vidyala

nkar

Page 25: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 25

Q.7 Answer any THREE of the following: [15]Q.7(a) Compare TCP/IP and OSI [5](A)

OSI (Open System Interconnection)

TCP/IP (Transmission Control Protocol/Internet Protocol)

1) OSI provides layer functioning and also defines functions of all the layers.

TCP/IP model is more based on protocols and protocols are not flexible with other layers.

2) In OSI model the transport layer guarantees the delivery of packets.

In TCP/IP model the transport layer does not guarantees delivery of packets.

3) Follows horizontal approach. Follows vertical approach. 4) OSI model has a separate

presentation layer. TCP/IP does not have a separate presentation layer.

5) OSI is a general model. TCP/IP model cannot be used in any other application.

6) Network layer of OSI model provide both connection oriented and connectionless service.

The Network layer in TCP/IP model provides connectionless service.

7) OSI model has a problem of fitting the protocols in the model.

TCP/IP model does not fit any protocol.

8) Protocols are hidden in OSI model and are easily replaced as the technology changes.

In TCP/IP replacing protocol is not easy.

9) OSI model defines services, interfaces and protocols very clearly and makes clear distinction between them.

In TCP/IP it is not clearly separated its services, interfaces and protocols.

10) It has 7 layers. It has 4 layers. Q.7(b) What is the purpose of ICMP? Explain the Redirection Message in ICMP. [5](A) Redirection When a router needs to send a packet destined for another network, it must know the IP address

of the next appropriate router. The same is true if the sender is a host. Both routers and hosts then must have a routing table to find the address of the router or the next router. Routers take part in the routing update process and are supposed to be updated constantly. Routing is dynamic.

The format of the redirection message is shown in figure. Note that the IP address of the

appropriate target is given in the second row.

Type : 5 Code : 0 to 3

Checksum

IP address of the target router Part of the received IP datagram including IP

header plus the first 8 bytes of datagram data

Fig. : Redirection message format Although the redirection message is considered an error-reporting message, it is different from

other error messages. The router does not discard the datagram in this case; it is sent to the appropriate router. The code field for the redirection message narrows down the redirection:

1) Code 0 : Redirection for a network-specific route. 2) Code 1 : Redirection for a host-specific route.

Vidyala

nkar

Page 26: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 26

3) Code 2 : Redirection for a network-specific route based on a specified type of service. 4) Code 3 : Redirection for a host-specific route based on a specified type of service. A redirection message is sent from a router to a host on the same local network. Q.7(c) Write a short on Types of Records in DNS [5](A) Types of Records As we saw in the previous section, two types of records are used in DNS. The question records

are used in the question section of the query and response messages. The resource records are used in the answer, authoritative and additional information sections of the response message.

Question Record A question record is used by the client to get information from a server. This contains the

domain name. Figure 1 shows the format of a question record. The list below describes question record fields.

Fig. 1 : Question record format

Resource Record Each domain name (each node on the tree) is associated with a record called the resource record.

The server database consists of resource records. Resource records are also what is returned by the server to the client. Figure 2 shows the format of a resource record.

Fig. 2 : Resource record format Q.7(d) List & explain types of TFTP Messages [5](A) TFTP There are occasions when we need to simply copy a file without the need for all of the features

of the FTP protocol. For example, when a diskless workstation or a router is booted, we need to download the bootstrap and configuration files.

Trivial File Transfer Protocol (TFTP) is designed for these types of file transfer. It is so simple

that the software package can fit into the readonly memory of a diskless workstation. It can be used at bootstrap time. The reason that it fits on ROM is that it requires only basic IP and UDP. However, there is no security for TFTP.TFTP can read or write a file for the client. Reading means copying a file from the server site to the client site. Writing means copying a file from client site to the server site.

TFTP uses the services of UDP on the wellknown port 69.

Vidyala

nkar

Page 27: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 27

Messages There are five types of TFTP messages, RRQ, WRQ, DATA, ACK and ERROR, as shown in

Figure 1.

Fig. 1 : Message categories.

RRQ : The read request (RRQ) message is used by the client to establish a connection for

reading data from the server. Its format is shown in Figure 2.

Fig. 2 : RRQ format

The RRQ message fields are as follows: OpCode : The first field is a 2-byte operation code. The value is 1 for the RRQ message. File name : The next field is a variable-size string (encoded in ASCII) that defines the name of the file. Since the file name varies in length, termination is signaled by a 1-byte field of 0s. Mode : The next field is another variable-size string defining the transfer mode. The mode field is terminated by another 1-byte field of 0s. The mode can be one of two strings: "netascii" (for an ASCII file) or "octet" (for a binary file). The file name and mode fields can be in upper- or lowercase, or a combination of both.

WRQ : The write request (WRQ) message is used by the client to establish a connection for

writing data to the server. The format is the same as RRQ except that the OpCode is 2 (see Figure 3).

Fig. 3 : WRQ format

DATA : The data (DATA) message is used by the client or the server to send blocks of data.

Its format is shown in Figure 4. The DATA message fields are as follows: OpCode : The first field is a 2-byte operation code. The value is 3 for the DATA message.

Fig. 4 : DATA format

Block number : This is a 2-byte field containing the block number. The sender of the data

(client or server) uses this field for sequencing. All blocks are numbered sequentially starting with 1. The block number is necessary for acknowledgment as we will see shortly.

Data : This block must be exactly 512 bytes in all DATA messages except the last block,

which must be between 0 and 511 bytes. A non-512 byte block is used as a signal that the sender has sent all the data. In other words, it is used as an end-of-file indicator. If the data in the file happens to be an exact multiple of 512 bytes, the sender must send one extra block of

Vidyala

nkar

Page 28: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Vidyalankar : T.Y. B.Sc. (IT) IT

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 28

zero bytes to show the end of transmission. Data can be transferred in either NVT ASCII (netascii) or binary octet (octet).

ACK : The acknowledge (ACK) message is used by the client or server to acknowledge the

receipt of a data block. The message is only 4 bytes long. Its format is shown in Figure 5.

Fig. 5 : ACK format

The ACK message fields are as follows:

OpCode : The first field is a 2-byte operation code. The value is 4 for the ACK message. Block number : The next field is a 2-byte field containing the number of the block received. The ACK message can also be a response to a WRQ. It is sent by the server to indicate that it is ready to receive data from the client. In this case the value of the block number field is 0.

Q.7(e) What is Domain? Explain type of Domains. [5](A) DNS IN THE INTERNET

DNS is a protocol that can be used in different platforms. In the Internet, the domain name space (tree) is divided into three different sections: generic domains, country domains, and the inverse domain. (see Figure 1)

Fig. 1 : DNS used in the Internet. Generic Domains

Fig. 2 : Generic domains.

The generic domains define registered hosts according to their generic behavior. Each node in the tree defines a domain, which is an index to the domain name space database. (see Figure 2) Looking at the tree, we see that the first level in the generic domains section allows 14 possible labels. These labels describe the organization types as listed in Table 1.

Vidyala

nkar

Page 29: Q.1(a) Explain the following fields of an IP datagram ...vidyalankar.org/upload/IT_(Yogesh Sir)_Soln.pdf · ... needs to find the physical address of another host or router on its

Prelim Question Paper Solution

0315/BSc/IT/TY/Pre_Pap/2015/IT_Soln 29

Table 1 : Generic domain labels.

Label Description aero Airlines and aerospace companies biz Business or firms (similar to "com") com Commercial organizations coop Cooperative business organizations edu Educational institutions gov Government institutions info Information service providers int International organizations mil Military groups museum Museums and other non-profit organizations name Personal names (individuals) net Network support centers org Non-profit organizations pro Professional individual organizations

Country Domains The country domains section use twocharacter country abbreviations (e.g., us for United States). Second labels can be organizational, or they can be more specific, national designations. The United States, for example, uses state abbreviations as a subdivision of us (e.g., ca.us.). Figure 3 shows the country domains sections.

Fig. 3 : Country domains.

Q.7(f) List & Describe all file Management Commands of FTP [5](A) Table shows File management commands.

Command Arguments(s) Description CWD Directory name Change to another directory CDUP Change to parent directory DELE File name Delete a file LIST Directory name List subdirectories of files NLIST Directory name List subdirectories or files without attributes MKD Directory name Create a new directory PWD Display name of current directory RMD Directory name Delete a directory RNFR File name (old) Identify a file to be renamed RNTO File name (new) Rename the file SMNT File system name Mount a file system

Vidyala

nkar