Вы находитесь на странице: 1из 121

QB on IT for TY BSc.

(IT)

Vinod Vazes

Question Bank on Internet Technology Specially designed for Sixth Semester B.Sc. (IT) Students

These notes are prepared for students personal use. Any commercial use of this material is strictly prohibited.

vinod vaze

QB on IT for TY BSc. (IT)

Guide to solution code Sr. No. Starting with: 001 101 201 301 401 501 601 701 801 901 Chapter

TCP / IP (Transmission Control / Internet protocol) ARP (Address Resolution Protocol) RARP (Reverse Address Resolution Protocol) RIP (Routing Information Protocol) OSPF (Open Shortest Path First) Protocol BGP (Border Gateway Protocol) Socket Programming (using TCP and UDP socket) RMI (Remote Method Invocation) CORBA Wireless LAN

vinod vaze

QB on IT for TY BSc. (IT)

TCP / IP (Transmission Control / Internet protocol) 001 What is fragmentation? Why is it required to fragment an IP datagram? Explain the functions of the following fields related to fragmentation in an IP Datagram: i) Identification ii) Flags iii) Fragmentation Offset. Explain fragmentation offset with an example. (May 2006) Answer: A datagram can travel through different networks. Each router decapsulates the IP datagram from the frame it receives, processes it and then encapsulates it in another frame. The format and size of the received frame depends on the protocol used by the physical network though which the frame has just traveled. In order to make the IP protocol independent of the physical network, the packagers decided to make the maximum length of the IP datagram equal to the largest maximum transfer unit (MTU) i.e. 65535 bytes. This makes transmission more efficient if we use a protocol with an MTU of this size. However, for other physical networks, we must divide the datagram to make it possible to pass through these networks. This is called fragmentation. A datagram can be fragmented by the source host or any router in the path. The reassembly of the datagram, however, is done only by the destination host because each fragment becomes an independent datagram. Whereas the fragmented datagram can travel through different routes, but all fragments belonging to the same datagram should finally arrive at the destination host. When a datagram is fragmented, following fields are updated: a) Required parts of the header must be copied by all fragments. b) The option field may or may not be copied. c) The host or router that fragments the datagram must change the values of total length, Flags & Fragmentation Offset. d) Value of checksum must be recalculated. e) Rest of the fields must be copied. Identification: 8

vinod vaze

QB on IT for TY BSc. (IT) a) b) 16-bit field that identifies a datagram originating from the source host. The combination of the identification and the source IP must uniquely define a datagram as it leaves the source host. To guarantee uniqueness, the IP protocol uses a counter to label the datagrams. When the IP protocol sends a datagram, it copies the current value of the counter to the identification field and increments the counter by one. As long as the counter remains in the memory, uniqueness is guaranteed. When a datagram is fragmented, the value in the identification field is copied into all fragments. The identification number helps in reassembling the datagram since all fragments with the same identification number should be assembled into one datagram.

c) d) e)

Flags: It is a 3-bit field. Following are the bits: a) The first is a reserved bit. b) The second bit is called the Do not fragment bit. If the value is 1, the machine must not fragment the datagram. If it cannot pass the datagram through any available physical network, it discards the datagram and sends an ICMP error message to the source. If the value is 0, the datagram can be fragmented. c) The third bit is called the More fragment bit. It its value is 1, then the datagram is not the last fragment, there are more fragments after this one. But if the value is 0, it means that this is the last or only fragment. Fragmentation Offset: This is a 13-bit field. It shows the relative position of this fragment with respect to the whole datagram. If each fragment follows a different path and arrives out of order, the final destination host can reassemble the original datagram from the fragments received using the following strategy a) b) c) d) Example: The first fragment has an offset field value of zero. Divide the length of the first fragment by 8. The second fragment has an offset value equal to that result. Divide the total length of the first and second fragment by 8. The third fragment has an offset value equal to that result. Continue the process. The last fragment has a more bit value of 0.

vinod vaze

QB on IT for TY BSc. (IT) A datagram of 4000 bytes fragmented into 3 fragments. The bytes in the original datagram are numbered from 0 to 3999. The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8=0. The second fragment carries bytes 1400 to 2799. The offset value is 1400/8 =175. The third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8=350. The value of the offset is measured in units of 8 bytes. 002 How does transmission control protocol avoid congestion? Explain in detail. (October 2005) An internet is a combination of networks and connecting devices (e.g., routers). A Packet started at sender may pass through several routers before reaching its final destination. A router has a buffer that stores the incoming packets, processes them and Forwards them. If a router receives packets faster than it can process, congestion might occur and some packets could be dropped. To avoid congestion, the sender TCP uses 2 strategies. a) b) Slow Start and Addictive Increase Multiplicative decrease

Slow Start 1. At the beginning of a connection, TCP sets the congestion window size to the maximum segment size. 2. For each segment that is acknowledged, TCP increases the size of the congestion window by one maximum segment size, until it reaches a threshold of half the allowable window size. This is called slow start. 3. Here the size of the congestion window increases exponentially. Addictive Increase a) To avoid congestion before it happens, one must slow down this exponential growth. b) After the size reaches the threshold, the size is increased one segment for each acknowledgement even if an acknowledgement is for several segments. 4. This additive increase strategy continues as long as the acknowledgements arrive before their corresponding time-outs or the congestion window size reaches the receiver window value. Multiplicative Decrease a) If congestion occurs, the congestion window size must be

vinod vaze

QB on IT for TY BSc. (IT) decreased. A Lost segment indicates that congestion has occurred. If the sender does not receive an acknowledgement for a segment before its retransmission timer has matured, it assumes that there is congestion. This strategy says that, if a time-out occurs, the threshold Must be set to half of the last congestion window size, and the congestion window size should start from one again. Thus the sender returns to the slow start phase. The size of threshold is reduced to half each time a time-out occurs. Thus the size of the threshold is reduced exponentially (multiplicative decrease).

b) c) c)

Explanation: In the above Figure, we assume that the maximum window size is 32 segments. The threshold is set to 16 segments (half of the window size). In the slow start procedure, the window size starts from 1 and grows exponentially until it reaches the threshold with the condition that there is no timeout. After reaching the threshold, the additive increase procedure allows the window size to increase linearly until a timeout occurs or the maximum window size is reached. In the above drawn figure, the timeout occurs what the segment 8 is sent. At this moment, the multiplicative decrease procedure takes over and reduces the threshold to half of the previous window size. The previous window size was when the timeout happened so the new threshold is now 10. 003 Draw the TCP state transition diagram. Explain the states, which the

vinod vaze

QB on IT for TY BSc. (IT) TCP client can attain. Ans:

vinod vaze

QB on IT for TY BSc. (IT)

State

Description

CLOSED There is no connection LISTEN Passive open received; waiting for SYN SYN-SENT SYN sent; waiting for ACK SYN-RCVD SYN+ACK sent; waiting for ACK EATABLISHED Connection established; data transfer in progress FIN-WAIT-1 First FIN sent; waiting for ACK FIN-WAIT-2 ACK to first FIN received; waiting for second FIN CLOSE-WAIT First FIN received, ACK sent; waiting for application to close TIME-WAIT Second FIN received, ACK sent; waiting for 2MSL time-out LAST-ACK Second FIN sent; waiting for ACK CLOSING Both sides have decided to close simultaneously 004 Distinguish between Transmission Control Protocols and User Datagram Protocol User Datagram Protocol. Ans: 1 2 3 4 5 6 7 8 9 Parameter Common in both Reliability Expand the acronym Orientation Connection orientation Overheads Speed Protocol Data unit Flow control mechanism Error control TCP UDP UDP and TCP are transport-layer protocols that create a process-to-process communication Reliable UDP is an unreliable protocol Transmission User Datagram Protocol Control Protocol Byte oriented Message oriented Connection Connectionless oriented Considerable Little Slower Faster The TCP packet The UDP packet is called is called a a user datagram. segment. TCP uses a UDP has no flow control sliding window mechanism at all. mechanism for flow control. TCP provides UDP has no Error control error control. Byte mechanism at all. oriented. [Only checks the UDP

10

vinod vaze

QB on IT for TY BSc. (IT) header by checksum] No Acknowledgement, No guaranteed delivery No sequence guarantee No congestion control Nothing of this sort.

11

Error Detection and correction Mechanism

12

Timers

13

Preference & Use

Error detection is handled in TCP by the checksum, CRC acknowledgment, and time-out. Congestion control TCP uses four timers retransmission, persistence, keep-alive, and time-waited in its operation. TCP is preferred & used for: Reliable, bytestream delivery between processes.

14

Headers & Overheads: Example of application Connection

15 16

The TCP header is much larger than the UDP header TELNET Required to have explicit connection between the hosts.

UDP is preferred & Used for one-shot, client-server type request-reply queries, Example: DNS Where prompt delivery is more important than accurate delivery, such as: Transmitting speech or video Transmission of Real time data Can be used by a system having its own error correction and flow correction mechanism such as TFTP, RIP & SNMP The UDP header is much smaller than the TCP header DNS No prior connection at all: It is connectionless

vinod vaze

QB on IT for TY BSc. (IT) Three Way Handshake Use SCTP [Stream Control Transmission Protocol] which combines the good features of both TCP and UDP

17

Latest trends

005 Define Internet Protocol Datagram in detail Ans: Packets in the IP layer are called datagrams. A datagram is variable length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery. It is customary in TCP/IP to show the header in 4 bytes sections. A brief description of each field is in order.

Version (VER): These 4 bits define the version of IP protocol. Currently the version is 4. However, version 6 may totally replace version 4 in the future. This field tells the IP software running in the processing machine that the datagram has the format of version 4. All fields may be interpreted as specified in the 4th version of the protocol. If the machine is using some other version of IP datagram is discarded rather than interpreted incorrectly.

vinod vaze

QB on IT for TY BSc. (IT)

Header length (HLEN): This 4 bit field defines the total length of the datagram of header in 4-byte word. This field is needed because the length of the header is variable. When there are no options, the header length is 20 bytes, and the value of the field is 5. When the option is field at its maximum size, the value of this field is 15. Differentiated services (DS): IETF has changed the interpretation and name of this bit field. This field, previously called service type, is now called differentiated services. Total length: This is 16-bit field that defines the total length of IP datagram in bytes. To find the length of data coming from the upper layer, subtract the header length from the total length. The header length can be founded by multiplying the value in the HLEN field by 4. The total length field defines the total length of the datagram including the header. 006 An IP packet has arrived with the first 8 bits as shown: <---------------01000010 The receiver discards the packer? Why? Ans: There is an error in this packet. The 4 left most bits (0100) show the version, which is correct. The next 4 bits 0010) show the wrong header length (2*4=8). The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission. 007 What are the different timers that TCP uses? How do we calculate the retransmission time and the round trip time? Ans: TCP TIMERS
Timers

Retransmission

Persistence

Keep alive

TIME-WAIT

vinod vaze

QB on IT for TY BSc. (IT) Retransmission Timer: To retransmit a lost segment, TCP employs a retransmission timer that handles the retransmission time-out (RTO), the waiting time for an acknowledgement of a segment. When TCP sends a segment, it creates a retransmission timer for that particular segment. Two situations may occur: 1. If an acknowledgement is received for this particular segment before the timer goes off, the timer is destroyed. 2. If the timer goes off before the acknowledgement arrives, the segment is retransmitted and the timer is reset. Round trip time (RTT): To calculate the retransmission time-out (RTO), we first need to calculate the round-trip time (RTT). However, calculating RTT in TCP is an involved process that we explain step by step with some examples. Measured RTT we need to find how long it takes to send a segment and receive an acknowledgement for it. This is the measured RTT. We need to remember that the segment and their acknowledgements do not have a one-to-one relationship; several segments mat be acknowledged together. The measured round trip time for a segment is the time required for the segment to reach the destination and be acknowledged, although the acknowledgement may include other segments. Note that in TCP, only one RTT measurement can be in progress at any time. This means that if any RTT measurement is started, no other measurement starts until the value of this RTT is finalized. We use the notation RTTM to stand for measured RTT. 008 What are the services offered by the Transmission Control Protocol to the processes an Application layer? Explain any two devices. Ans: The services offered by the Transmission Control Protocol to the processes an Application layer are as follows: 1. Process- To-Process communication 2. Stream delivery Service 3. Connection-Oriented Service 4. Full-Duplex Communication 5. Reliable Service 6. Process-To-Process Communication Like UDP, TCP provides process-to-process communication using port

vinod vaze

QB on IT for TY BSc. (IT) numbers Port 7 9 11 13 17 19 20 21 23 25 53 67 79 80 111 Protocol Echo Discard Users Daytime Quote Chargen FTP, Data FTP, Control TELNET SMTP DNS BOOTP Finger HTTP RPC Description Echoes a received datagram back to the sender Discards any datagram that is received Active users Returns the date and time Returns the quote of the day Returns a string of characters File Transfer Protocol (data connection) File Transfer Protocol (control connection) Terminal Network Simple Mail Transfer Protocol Domain Name server Bootstrap Protocol Finger Hypertext Transfer Protocol Remote Procedure Call

Connection-Oriented Service: TCP, unlike UDP, is a Connection-Oriented protocol. When a process at site A wants to send and receive data from another process at site B, the following occurs: a) The two TCPs establish a connection between them. b) Data are exchanged in both directions. c) The connection is terminated. Note that this is a virtual connection, not a physical connection. The TCP segment is encapsulated in an IP datagram and can be send out of order, or lost, or corrupted, and then resent. Each may use a different path to reach the destination. There is no physical connection. TCP creates a stream-oriented environment in which it accepts the responsibility of delivering the bytes in order to the other site. The situation is similar to creating a bridge that spans multiple islands and passing all of the bytes from one island to another in one single connection. 009 Transmission Control Protocol is a Connection-Oriented Protocol. How does it terminate the connection? Explain in detail the process of connection termination. Ans: Any of the two parties involved in exchanging data (client or server) can close the connection, although it is usually initiated by the client. Most

vinod vaze

QB on IT for TY BSc. (IT) implementation today allows two options for connection termination: three-way handshake and four-way handshake with a half-close option. Three-Way Handshaking: Most implementation today allow three-way handshaking for connection termination a) In a normal situation, the client TCP, after receiving a close command from the client process, sends the first segment, a FIN segment in which the FIN flag is set. Note that a FIN segment can include the last chunk of the data sent by the client or it can be just a control segment. If it is only a control segment, it consumes only one sequence number. The server TCP after receiving the FIN segment informs its process of the situation and sends the second segment, a FIN+ACK segment, to confirm the receipt of the FIN segment from the client and at the same time to announce the closing of the connection in the other direction. This segment can also contain the last chunk of data from the server. If it does not carry data, it consumes only one sequence number. The client TCP sends the last segment, an ACK to confirm the receipt of the FIN segment from the TCP server. This segment contains the acknowledgement number, which is one plus the sequence number received in the FIN segment from the server. This segment cannot carry data and consumes no sequence numbers.

b)

c)

Half-Close: In TCP, one end can stop sending data while still receiving data. This is called a half-close. Although either end can issue a half-close, it is normally initiated by the client. It can occur when the server needs all the data before processing can begin. A good example is sorting. When the client sends all the data to the server to be sorted, the server needs to receive all the data before sorting can start. This means the client, after sending all data, can close the connection in the outbound direction. However, the inbound direction must remain open to receive the sorted data. The server, after receiving the data still needs time for sorting; its outbound direction must remain open. The client half-closes the connection by sending a FIN segment. The server accepts the half-close by sending the ACK segment. The data transfer from the client to the server stops. The server, however, can still

vinod vaze

QB on IT for TY BSc. (IT) send data. When the server has sent all of the process data, it sends a FIN segment, which is acknowledged by an ACK from the client. After half closing the connection, data can travel from the server to the client and acknowledgements can travel from the client to the server. The client cannot send more data to the server. Note the sequence numbers we have used. The second segment (ACK) consumes no sequence numbers. Although the client has received sequence number Y-1 and is expecting Y, the server sequence number is still Y-1. When the connection finally closes, the sequence number of the last ACK segment is still X, because no sequence numbers are consumed during data transfer in that direction. 010 Transmission control protocol is a connection-oriented protocol. How does it establish the connection? Explain in details the process of connection establishment? Ans: TCP is a connection-oriented. A connection-oriented transport protocol establishes a virtual path between the source and destination. All of the segments belonging to message are then send over this virtual path. Using a single pathway for the entire message facilities the acknowledgement process as well as retransmission of damaged or lost frames. You may wonder how TCP, which uses the services of IP to deliver individual segments to the receiver, but it, controls the connection itself. The point is that the TCP connection is virtual, not physical. TCP operates at higher level. TCP uses the services of IP to deliver individual segments to the receiver, but it controls the connection itself. If a segment is lost or corrupted, it is retransmitted. Unlike TCP, IP is unaware of this retransmission. If a segment arrives out of order, TCP holds it until the missing segment arrives; IP is unaware of this reordering. In TCP, connection-oriented transmission requires three phases: connection establishment, data transfer and connection termination. Connection Establishment: TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they are able to send segments to each other simultaneously. This implies that each party must initialize communication and get approval from the other party before any data is transferred. Three-Way Handshake: The connection establishment in TCP is called three-way handshake. In our example application program, called the client, wants to make a

vinod vaze

QB on IT for TY BSc. (IT) connection with another application program, called the server, using TCP as the transport layer protocol. The process starts with the server. The server program tells its TCP that it is ready to accept the connection. This is called a request for a passive open. 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 issues a request for an active open. A client that wishes to connect to an open server tells its TCP that it needs to be connected to a particular server. TCP can now start a three-way handshake process. Each segment has values for all its header fields and perhaps for some of its option fields too. However we show only the few fields necessary to understand each phase. We show the sequence number, the acknowledgement number, the control flags and the window size is not empty. Simultaneous open: 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. SYN Flooding Attack: The connection establishment procedure in TCP is susceptible to serious security problem called SYN flooding attack. This happens when a malicious attacker sends a large number of SYN segments to a server pretending that each of them is coming from a different client faking the source IP address in the datagrams. The server assumes that the clients are issuing an active open, allocates the necessary resources, such as creating TCB tables and setting timers. The TCP server then sends the SYN+ACK segments to the fake clients, which are lost. During this time, however, a lot of resources are occupied without being used. If, during this short period of time, the number of SYN segments is large, the server eventually runs out of resources and may crash. Data transfer: After connection is established, bidirectional data transfer can take place. The client and server can send data and acknowledgements in both directions. The client sends 2000 bytes of data in two segments. The server then sends 2000 byes in one segment. The client sends one more segment. The first three segments carry both data and acknowledgments, but last segment carries only an acknowledgment because there is no more data to be sent. Note the values of segments and acknowledgment numbers. The data segments sent by the clients have the PSH flag set so

vinod vaze

QB on IT for TY BSc. (IT) that the TCP knows to deliver data to the server as soon as they are received. Most TCP implementations have the option to set or not set this flag. Pushing data: There are occasions in which application program has no need for flexibility. Consider an application program that communicates interactively with another application program on the other end. The application program on one site wants to send a keystroke to the application at the other site and receive an immediate response. Delayed transmission and delayed delivery of other data may not be acceptable by the application program. TCP can handle such a situation. The application program at the sending site can request a push operation. This means that the sending TCP must not wait for the windows to be filled. It must create a segment and send it immediately. The sending TCP must also send the push bit to let the receiving TCP know that the segment includes data that must be delivered to the receiving application program as soon as possible and not to wait for more data to come. Connection Termination: Any of the two parties involved in exchanging data (client or server) can close the connection, although it is usually initiated by the client. Most implementation today allows two options for connection termination: three-way handshake and four-way handshake with a half-close option. Three-Way Handshaking: Most implementation today allow three-way handshaking for connection termination 4. In a normal situation, the client TCP, after receiving a close command from the client process, sends the first segment, a FIN segment in which the FIN flag is set. Note that a FIN segment can include the last chunk of the data sent by the client or it can be just a control segment. If it is only a control segment, it consumes only one sequence number. 5. The server TCP after receiving the FIN segment informs its process of the situation and sends the second segment, a FIN+ACK segment, to confirm the receipt of the FIN segment from the client and at the same time to announce the closing of the connection in the other direction. This segment can also contain the last chunk of data from the server. If it does not carry data, it consumes only one sequence number. 6. The client TCP sends the last segment, an ACK to confirm the

vinod vaze

QB on IT for TY BSc. (IT) receipt of the FIN segment from the TCP server. This segment contains the acknowledgement number, which is one plus the sequence number received in the FIN segment from the server. This segment cannot carry data and consumes no sequence numbers. Half-Close: In TCP, one end can stop sending data while still receiving data. This is called a half-close. Although either end can issue a half-close, it is normally initiated by the client. It can occur when the server needs all the data before processing can begin. A good example is sorting. When the client sends all the data to the server to be sorted, the server needs to receive all the data before sorting can start. This means the client, after sending all data, can close the connection in the outbound direction. However, the inbound direction must remain open to receive the sorted data. The server, after receiving the data still needs time for sorting; its outbound direction must remain open. The client half-closes the connection by sending a FIN segments. The server accepts the half-close by sending the ACK segment. The data transfer from the client to the server stops. The server, however, can still send data. When the server has sent all of the process data, it sends a FIN segment, which is acknowledged by an ACK from the client. After half closing the connection, data can travel from the server to the client and acknowledgements can travel from the client to the server. The client cannot send more data to the server. Note the sequence numbers we have used. The second segment (ACK) consumes no sequence numbers. Although the client has received sequence number Y-1 and is expecting Y, the server sequence number is still Y-1. When the connection finally closes, the sequence number of the last ACK segment is still X, because no sequence numbers are consumed during data transfer in that direction. 011 Draw the IP packet format and explain each of its fields. Which fields of the IP header change from router to router? Ans: Packets in the IP layer are called datagrams. A datagram is variable length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery. It is customary in TCP/IP to show the header in 4 bytes sections. A brief description of ach field is in order.

vinod vaze

QB on IT for TY BSc. (IT)

Version (VER): These 4 bits defines the version of IP protocol. Currently the version is 4. However, version 6 may totally replace version 4 in the future. This field tells the IP software running in the processing machine that the datagram has the format of version 4. All fields may be interpreted as specified in the 4th version of the protocol. If the machine is using some other version of IP datagram is discarded rather than interpreted incorrectly. Header length (HLEN): This 4-bit field defines the total length of the datagram of header in 4 byte word. This field is needed because the length of the header is variable. When there are no options, the header length is 20 bytes, and the value of the field is 5. When the option is field at its maximum size, the value of this field is 15. Differentiated services (DS): IETF has changed the interpretation and name of this bit field. This field, previously called service type, is now called differentiated services. Total length: This is 16-bit field that defines the total length of IP datagram in bytes. To find the length of data coming from the upper layer, subtract the header vinod vaze

QB on IT for TY BSc. (IT) length from the total length. The header length can be founded by multiplying the value in the HLEN field by 4. The total length field defines the total length of the datagram including the header. 012 Explain Ans: Three-Way Handshaking: Most implementation today allow three-way handshaking for connection termination the three way Establishment handshake method TCP connection

I n a normal situation, the client TCP, after receiving a close command from the client process, sends the first segment, a FIN segment in which the FIN flag is set. Note that a FIN segment can include the last chunk of the data sent by the client or it can be just a control segment. If it is only a control segment, it consumes only one sequence number. The server TCP after receiving the FIN segment informs its process of the situation and sends the second segment, a FIN+ACK segment, to confirm the receipt of the FIN segment from the client and at the same time to announce the closing of the connection in the other direction. This segment can also contain the last chunk of data from the server. If it does not carry data, it consumes only one sequence number.

vinod vaze

QB on IT for TY BSc. (IT) The client TCP sends the last segment, an ACK to confirm the receipt of the FIN segment from the TCP server. This segment contains the acknowledgement number, which is one plus the sequence number received in the FIN segment from the server. This segment cannot carry data and consumes no sequence numbers. 013 What do you understand by 4-way handshaking in TCP? Explain Ans: Half-Close: In TCP, one end can stop sending data while still receiving data. This is called a half-close. Although either end can issue a half-close, it is normally initiated by the client. It can occur when the server needs all the data before processing can begin. A good example is sorting. When the client sends all the data to the server to be sorted, the server needs to receive all the data before sorting can start. This means the client, after sending all data, can close the connection in the outbound direction. However, the inbound direction must remain open to receive the sorted data. The server, after receiving the data still needs time for sorting; its outbound direction must remain open. The client half-closes the connection by sending a FIN segment. The server accepts the half-close by sending the ACK segment. The data transfer from the client to the server stops. The server, however, can still send data. When the server has sent all of the process data, it sends a FIN segment, which is acknowledged by an ACK from the client. After half closing the connection, data can travel from the server to the client and acknowledgements can travel from the client to the server. The client cannot send more data to the server. Note the sequence numbers we have used. The second segment (ACK) consumes no sequence numbers. Although the client has received sequence number Y-1 and is expecting Y, the server sequence number is still Y-1. When the connection finally closes, the sequence number of the last ACK segment is still X, because no sequence numbers are consumed during data transfer in that direction. The diagram next page shows the details.:

vinod vaze

QB on IT for TY BSc. (IT)

014 Explain in detail the Internet protocol datagram. A datagram is carrying 1024 bytes of data. If there is no option information, what is the value of the header length field and total length field? Ans: Packets in the IP layer are called datagrams. A datagram is variable length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery. It is customary in TCP/IP to show the header in 4 bytes sections.

vinod vaze

QB on IT for TY BSc. (IT) A brief description of each field is in order. Version (VER): These 4 bits defines the version of IP protocol. Currently the version is 4. However, version 6 may totally replace version 4 in the future. This field tells the IP software running in the processing machine that the datagram has the format of version 4. All fields may be interpreted as specified in the 4th version of the protocol. If the machine is using some other version of IP datagram is discarded rather than interpreted incorrectly. Header length (HLEN): This 4-bit field defines the total length of the datagram of header in 4byte word. This field is needed because the length of the header is variable. When there are no options, the header length is 20 bytes, and the value of the field is 5. When the option is field at its maximum size, the value of this field is 15. Differentiated services (DS): IETF has changed the interpretation and name of this bit field. This field, previously called service type, is now called differentiated services. Total length: This is 16-bit field that defines the total length of IP datagram in bytes. To find the length of data coming from the upper layer, subtract the header length from the total length. The header length can be founded by multiplying the value in the HLEN field by 4. The total length field defines the total length of the datagram including the header.

vinod vaze

QB on IT for TY BSc. (IT)

015 How does transmission control protocol avoid transmission? Explain in detail. Ans: If we start with the slow start algorithm, the size of congestion window increases exponentially. To avoid congestion before it happens, one must slow down this exponential growth. TCP defines another algorithm called congestion avoidance, which increases additively instead of exponentially. When the size of the congestion window reaches the slow start threshold, the whole window of segments is acknowledged, the size of the congestion window is increased by one. To show the idea, we apply this algorithm, to the same scenario as slow start although as we will see that the congestion avoidance usually starts when the size of the window is much greater than one. After the sender has received acknowledgements for a complete window size of segments, the size of the window is increased by one segment. 016 Explain in detail the Internal Protocol datagram. A datagram is carrying 1024 bytes of data. If there is no option information, what is the value of the header length field and the total length field? (October 2005) Answer: An IP packet consists of a header section and a data section. Header The header consists of 13 fields, of which only 12 are required. The 13th field is optional (red background in table) and aptly named: options. The fields in the header are packed with the most significant byte first , and for the diagram and discussion, the most significant bits are considered to come first. The most significant bit is numbered 0, so the version field is actually found in the 4 most significant bits of the first byte, for example. Version The first header field in an IP packet is the 4-bit version field. For IPv4, this has a value of 4 (hence the name IPv4). Internet Header Length (IHL) The second field is a 4-bit Internet Header Length (IHL) telling the number of 32-bit words in the header. Since an IPv4 header may

vinod vaze

QB on IT for TY BSc. (IT) contain a variable number of options, this field specifies the size of the header (this also coincides with the offset to the data). The minimum value for this field is 5 (rfc791), which is a length of 532 = 160 bits. Being a 4-bit field the maximum length is 15 words or 480 bits. Type of Service (TOS) In RFC 791, the following 8 bits were allocated to a Type of Service (TOS) field:

Bit 0-2: precedence Bit 3: 0 = Normal Delay, 1 = Low Delay Bit 4: 0 = Normal Throughput, 1 = High Throughput Bit 5: 0 = Normal Reliability, 1 = High Reliability Bits 6-7: Reserved for future use This field is now used for DiffServ and ECN. The original intention was for a sending host to specify a preference for how the datagram would be handled as it made its way through an internetwork. For instance, one host could set its IPv4 datagrams' TOS field value to prefer low delay, while another might prefer high reliability. In practice, the TOS field has not been widely implemented. However, a great deal of experimental, research and deployment work has focused on how to make use of these eight bits. These bits have been redefined, most recently through DiffServ working group in the IETF and the Explicit Congestion Notification codepoints. New technologies are emerging that require real-time data streaming and therefore will make use of the TOS field. An example is Voice over IP (VoIP) that is used for interactive data voice exchange.

Total Length This 16-bit field defines the entire datagram size, including header and data, in bytes. The minimum-length datagram is 20 bytes (20 bytes header + 0 bytes data) and the maximum is 65,535 the maximum value of a 16-bit word. The minimum size datagram that any host is required to be able to handle is 576 bytes, but most modern hosts handle much larger packets. Sometimes subnetworks impose further restrictions on the size, in which case datagrams must be fragmented. Fragmentation is handled in either the host or packet switch in IPv4 (see Fragmentation and reassembly). Identification

vinod vaze

QB on IT for TY BSc. (IT)

This field is an identification field and is primarily used for uniquely identifying fragments of an original IP datagram. Some experimental work has suggested using the ID field for other purposes, such as for adding packet-tracing information to datagrams in order to help trace back datagrams with spoofed source addresses. Flags A 3-bit field follows and is used to control or identify fragments. They are (in order, from high order to low order):

Reserved; must be zero. As an April Fools joke, proposed for use in RFC 3514 as the "Evil bit". Don't Fragment (DF) More Fragments (MF) If the DF flag is set and fragmentation is required to route the packet then the packet will be dropped. This can be used when sending packets to a host that does not have sufficient resources to handle fragmentation. When a packet is fragmented all fragments have the MF flag set except the last fragment, which does not have the MF flag set. The MF flag is also not set on packets that are not fragmented clearly an unfragmented packet can be considered the last fragment.

Fragment Offset The fragment offset field, measured in units of 8-byte blocks, is 13bits long and specifies the offset of a particular fragment relative to the beginning of the original unfragmented IP datagram. The first fragment has an offset of 0. This allows a maximum offset of 65,528 ( ), which would exceed the maximum IP packet length of 65,535 with the header length included. Time To Live (TTL) An 8-bit time to live (TTL) field helps prevent datagrams from persisting (e.g. going in circles) on an internetwork. Historically the TTL field limited a datagram's lifetime in seconds, but has come to be a hop count field. Each packet switch (or router) that a datagram crosses decrements the TTL field by one. When the TTL field hits zero, the packet is no longer forwarded by a packet switch and is discarded. Typically, an ICMP message (specifically the time vinod vaze

QB on IT for TY BSc. (IT) exceeded) is sent back to the sender that it has been discarded. The reception of these ICMP messages is at the heart of how traceroute works. Protocol This field defines the protocol used in the data portion of the IP datagram. The Internet Assigned Numbers Authority maintains a list of Protocol numbers and were originally defined in RFC 790. Common protocols and their decimal values are shown below. Header Checksum The 16-bit checksum field is used for error-checking of the header. At each hop, the checksum of the header must be compared to the value of this field. If a header checksum is found to be mismatched, then the packet is discarded. Note that errors in the data field are up to the encapsulated protocol to handle indeed, both UDP and TCP have checksum fields. Since the TTL field is decremented on each hop and fragmentation is possible at each hop then at each hop the checksum will have to be recomputed. The method used to compute the checksum is defined within RFC 791: The checksum field is the 16-bit one's complement of the one's complement sum of all 16-bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero. In other words, all 16-bit words are summed together using one's complement (with the checksum field set to zero). The sum is then one's complemented and this final value is inserted as the checksum field. Source address An IP address is a group of 4 8-bit octets for a total of 32 bits. The value for this field is determined by taking the binary value of each octet and concatenating them together to make a single 32-bit value. For example, the address 10.9.8.7 (00001010. 00001001. 00001000. 00000111 in binary) would be 00001010000010010000100000000111. This address is the address of the sender of the packet. Note that this address may not be the "true" sender of the packet due to

vinod vaze

QB on IT for TY BSc. (IT) network address translation. Instead, the source address will be translated by the NATing machine to its own address. Thus, reply packets sent by the receiver are routed to the NATing machine, which translates the destination address to the original sender's address. Destination address Identical to the source address field but indicates the receiver of the packet. Options Additional header fields may follow the destination address field, but these are not often used. Note that the value in the IHL field must include enough extra 32-bit words to hold all the options (plus any padding needed to ensure that the header contains an integral number of 32-bit words). The list of options may be terminated with an EOL (End of Options List) option; this is only necessary if the end of the options would not otherwise coincide with the end of the header. The possible options that can be put in the header are as follows: Field Copied Option Class Size (bits) 1 2 Description

Set to 1 if the options need to be copied into all fragments of a fragm packet. A general options category. 0 is for "control" options, and 2 is for " and measurement". 1, and 3 are reserved.

The header of the IP datagram is made up of 2 parts. : A fixed part (20 bytes long) and a variable part that comprises the options that can be a maximum of 40 bytes. Total Length field = Header Length + data Since there is no option information, the size of the header= 20 bytes. Therefore value of the total length field = 20 + 1024 bytes = 1044 bytes

vinod vaze

QB on IT for TY BSc. (IT)

017 The following is dump of a TCP header in hexadecimal format. 05320017 00000001 0000 0000 500207FF 00000000 (20 bytes) i) What is the source port number? ii) What is the destination port number? iii) What is the sequence number? iv) What is the acknowledgement number? v) What is the length of the header? vi) What is the type of the segment? vii) What is the window size? Ans: i) The source port number is: 1330 ii) The destination port number is: 23 iii) The sequence number is: 1 iv) The acknowledgement number is: 0 v) The length of the header is: 5 x 4 = 20 bytes vi) The type of segment is: The synchronize bit is set. Hence it is synchronize segment. vii) The size of window is: 511 018 An IP datagram has arrived with the following information in the header (in hexadecimal) 4500 00 54 00 03 00 00 20 06 00 00 7C 4E 03 02 B4 0E 0F 02 Ans.

vinod vaze

QB on IT for TY BSc. (IT)

Field Version Header Length Differentiated Service Total length Identification Flags Fragmentation Offset Time to Live Protocol Header Checksum

Number of bits 4 4 8 16 16 3 13 8 8 16

Given Value in hexadecimal 4 5 00 0054 0003 0 00 20 06 0000

Value in binary digits 0100 0101 00000000 00000000 01010100 00000000 00000011 000 00000000 0010 0000 0000 0110 00000000 00000000

S. No 1. vinod vaze

Question Classify the above header

Answer Version IPv4

QB on IT for TY BSc. (IT)

2. 3. 4

Are there any options? Is the packet fragmented? What is the size of the data?

No Yes: R00 Last fragment In 4-byte word = (54)16 (5)16 = (4F)16 = 79 and in bytes =79 * 4 =316 bytes No (20)16 = (32)10 = 32 3 Protocol is 06 = TCP

5 6 7 8

Is a checksum used? How many more routers can a packet travel to? What is the identification number of the packet? What is the type of the service?

019 Transmission control protocol is a connection-oriented protocol. How does it establish the connection? Explain in detail the process of connection establishment. (November 2004) Ans. TCP is a connection-oriented protocol. It establishes a virtual path between the source and destination. All the segments belonging to a message are then sent over this virtual path. Using a single virtual pathway for the entire message facilitates the acknowledgment process as well as retransmission of damaged or lost frames. In TCP, connectionoriented transmission requires two procedures: 1) Connection Establishment and 2) Connection Termination. Connection Establishment TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they are able to send segments to each other

vinod vaze

QB on IT for TY BSc. (IT) simultaneously. This implies that each party must initialize communication and get approval from the other party before any data transfer. Four steps are needed to establish the connection, as discussed before. However, the second and third steps can be combined to create a threestep connection, called a three-way handshake, as shown in Figure.

The steps of the process are as follows: 1. 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. 2. The server sends the second segment; a SYN and an 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. Note that the acknowledgment number is the client initialization sequence number plus 1 because no user data have been sent in segment 1. 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

vinod vaze

QB on IT for TY BSc. (IT) sequence number used to number the bytes sent from the server to the client. 3. 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. Note that the acknowledgment number is the server initialization sequence number plus 1 because no user data have been sent in segment 2. The client must also define the server window size. Data can be sent with the third packet.

vinod vaze

QB on IT for TY BSc. (IT)

020 How TCP provides reliability using error control? What is the Maximum size of TCP header? What is the minimum size of TCP header? (May 2005) Ans. TCP is a reliable transport layer protocol. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the application program on the other end in order, without error and without any part lost or duplicated. TCP provides reliability using error control. Error control includes mechanisms for detecting corrupted segments lost segments, out-of-order segments and duplicated segments. Error control also includes a mechanism for correcting errors after they are detected. Error Detection and Error Correction: Error Detection in TCP is achieved through the use of three simple tools: checksum, acknowledgment and time-out. Each segment includes the checksum field, which is used to check for a corrupted segment. If the segment is not acknowledged before the timeout, it is considered to be either corrupted or lost. The error correction mechanism used by TCP is also very simple. The source TCP starts one time-out counter for each segment sent. Each counter is checked periodically. When a counter matures, the corresponding segment is considered to be either corrupted or lost and the segment will be retransmitted. The segment consists of a 20-byte to 60-byte header, followed by data from the application program. The header is 20-byte if there are no options and up to 60-bytes if it contains options. 021 Draw the IP packet format and explain each of its field. Which fields of the IP header change from router to router? (May 2005) Ans: Figure: The IP header layout

vinod vaze

QB on IT for TY BSc. (IT)

Version Number This is a 4-bit field that contains the IP version number the protocol software is using. The version number is required so that receiving IP software knows how to decode the rest of the header, which changes with each new release of the IP standards. The most widely used version is 4, although several systems are now testing version 6 (called IPng). The Internet and most LANs do not support IP version 6 at present. Part of the protocol definition stipulates that the receiving software must first check the version number of incoming datagram before proceeding to analyze the rest of the header and encapsulated data. If the software cannot handle the version used to build the datagram, the receiving machine's IP layer rejects the datagram and ignores the contents completely. Header Length This 4bit field reflects the total length of the IP header built by the sending machine; it is specified in 32bit words. The shortest header is five words (20 bytes), but the use of optional fields can increase the header size to its maximum of six words (24 bytes). To properly decode the header, IP must know when the header ends and the data begins, which is why this field is included. (There is no start of data marker to show where the data in the datagram begins. Instead, the header length is used to compute an offset from the start of the IP header to give the start of the data block.) Type of Service

vinod vaze

QB on IT for TY BSc. (IT) The 8bit (1 byte) Service Type field instructs IP how to process the datagram properly. The field's 8 bits are read and assigned as shown in Figure 3.2, which shows the layout of the Service Type field inside the larger IP header shown in Figure 3.1. The first 3 bits indicate the datagram's precedence, with a value from 0 (normal) through 7 (network control). The higher the number, the more important the datagram and, in theory at least, the faster the datagram should be routed to its destination. In practice, though, most implementations of TCP/IP and practically all hardware that uses TCP/IP ignores this field, treating all datagram with the same priority.

Figure: The 8bit Service Type field layout The next three bits are 1bit flags that control the delay, throughput, and reliability of the datagram. If the bit is set to 0, the setting is normal. A bit set to 1 implies low delay, high throughput, and high reliability for the respective flags. The last two bits of the field are not used. Most of these bits are ignored by current IP implementations, and all datagram are treated with the same delay, throughput, and reliability settings. For most purposes, the values of all the bits in the Service Type field are set to 0 because differences in precedence, delay, throughput, and reliability between machines are virtually nonexistent unless a special network has been established. Although these Flags would be useful in establishing the best routing method for a datagram, no currently available UNIX based IP system bothers to evaluate the bits in these fields. (Although it is conceivable that the code could be modified for high security or high reliability networks.) Datagram Length (or Packet Length) This field gives the total length of the datagram, including the header, in bytes. The length of the data area itself can be computed by subtracting the header length from this value. The size of the total datagram length field is 16 bits, hence the 65,535 bytes maximum length of a datagram (including the header). This field is used to determine the length value to be passed to the transport protocol to set the total frame length. Identification This field holds a number that is a unique identifier created by the sending

vinod vaze

QB on IT for TY BSc. (IT) node. This number is required when reassembling fragmented messages, ensuring that the fragments of one message are not intermixed with others. Each chunk of data received by the IP layer from a higher protocol layer is assigned one of these identification numbers when the data arrives. If a datagram is fragmented, each fragment has the same identification number. Flags The Flags field is a 3bit field, the first bit of which is left unused (it is ignored by the protocol and usually has no value written to it). The remaining two bits are dedicated to flags called DF (Don't Fragment) and MF (More Fragments), which control the handling of the datagram when fragmentation is desirable. If the DF flag is set to 1, the datagram cannot be fragmented under any circumstances. If the current IP layer software cannot send the datagram on to another machine without fragmenting it, and this bit is set to 1, the datagram is discarded and an error message is sent back to the sending device. If the MF flag is set to 1, the current datagram is followed by more packets (sometimes called sub packets), which must be reassembled to recreate the full message. The last fragment that is sent as part of a larger message has its MF flag set to 0 (off) so that the receiving device knows when to stop waiting for datagram. Because the order of the fragments' arrival might not correspond to the order in which they were sent, the MF flag is used in conjunction with the Fragment Offset field (the next field in the IP header) to indicate to the receiving machine the full extent of the message. Fragment Offset If the MF (More Fragments) flag bit is set to 1 (indicating fragmentation of a larger datagram), the fragment offset contains the position in the complete message of the sub message contained within the current datagram. This enables IP to reassemble fragmented packets in the proper order. Offsets are always given relative to the beginning of the message. This is a 13bit field, so offsets are calculated in units of 8 bytes, corresponding to the maximum packet length of 65,535 bytes. Using the identification number to indicate which message a receiving datagram belongs to, the IP layer on a receiving machine can then use the fragment offset to reassemble the entire message. Time to Live (TTL) This field gives the amount of time in seconds that a datagram can remain on the Network before it is discarded. This is set by the sending node when the

vinod vaze

QB on IT for TY BSc. (IT) datagram is assembled. Usually the TTL field is set to 15 or 30 seconds. The TCP/IP standards stipulate that the TTL field must be decreased by at least one second for each node that processes the packet, even if the processing time is less than one second. Also, when a datagram is received by a gateway, the arrival time is tagged so that if the datagram must wait to be processed, that time counts against its TTL. Hence, if a gateway is particularly overloaded and can't get to the datagram in short order, the TTL timer can expire while waiting processing, and the datagram is abandoned. If the TTL field reaches 0, the datagram must be discarded by the current node, but a message is sent back to the sending machine when the packet is dropped. The sending machine can then resend the datagram. The rules governing the TTL field are designed to prevent IP packets from endlessly circulating through networks. Transport Protocol This field holds the identification number of the transport protocol to which the packet has been handed. The numbers are defined by the Network Information Center (NIC), which governs the Internet. There are currently about 50 protocols defined and assigned a transport protocol number. The two most important protocols are ICMP (detailed in the section titled "Internet Control Message Protocol (ICMP)" later today), which is number 1, and TCP, which is number 6. The full list of numbers is not necessary here because most of the protocols are never encountered by users. (If you really want this information, its in several RFCs mentioned in the appendixes.) Header Checksum The number in this field of the IP header is a checksum for the protocol header Field (but not the data fields) to enable faster processing. Because the Time to Live (TTL) field is decremented at each node, the checksum also changes with every machine the datagram passes through. The checksum algorithm takes the ones complement of the 16bit sum of all 16bit words. This is a fast, efficient algorithm, but it misses some unusual corruption circumstances such as the loss of an entire 16bit word that contains only 0s. However, because the data checksums used by both TCP and UDP cover the entire packet, these types of errors usually can be caught as the frame is assembled for the network transport. Sending Address and Destination Address These fields contain the 32bitIP addresses of the sending and destination devices. These fields are established when the datagram is created and are not altered during the routing.

vinod vaze

QB on IT for TY BSc. (IT)

Options The Options field is optional, composed of several codes of variable length. If more than one option is used in the datagram, the options appear consecutively in the IP header. All the options are controlled by a byte that is usually divided into three fields: a 1bit copy flag, a 2bit option class, and a 5bit option number. The copy flag is used to stipulate how the option is handled when fragmentation is necessary in a gateway. When the bit is set to 0, the option should be copied to the first datagram but not subsequent ones. If the bit is set to 1, the option is copied to all the datagram. The option class and option number indicate the type of option and its particular value. At present, there are only two option classes set. (With only 2 bits to work with in the field, a maximum of four options could be set.) When the value is 0, the option applies to datagram or network control. A value of 2 means the option is for debugging or administration purposes. Values of 1 and 3 are unused. Currently supported values for the option class and number are given in Table 3.1. Of most interest to you are options that enable the routing and timestamps to be recorded. These are used to provide a record of a datagram's passage across the internet work, which can be useful for diagnostic purposes. Both these options add information to a list contained within the datagram. (The timestamp has an interesting format: it is expressed in milliseconds since midnight, Universal Time. Unfortunately, because most systems have widely differing time settingseven when corrected to Universal Time the timestamps should be treated with more than a little suspicion.) There are two kinds of routing indicated within the Options field: loose and strict. Loose routing provides a series of IP addresses that the machine must pass through, but it enables any route to be used to get to each of these addresses (usually gateways). Strict routing enables no deviations from the specified route. If the route can't be followed, the datagram is abandoned. Strict routing is frequently used for testing routes but rarely for transmission of user datagram because of the higher chances of the datagram being lost or abandoned. Padding The content of the padding area depends on the options selected. The padding is Usually used to ensure that the datagram header is a round number of bytes. A Datagram's Life To understand how IP and other TCP/IP layers work to package and send a datagram from one machine to another, I take a simplified look at a

vinod vaze

QB on IT for TY BSc. (IT) typical datagram's passage. When an application must send a datagram out on the network, it performs a few simple steps. First, it constructs the IP datagram within the legal lengths stipulated by the local IP implementation. The checksum is calculated for the data, and then the IP header is constructed. Next, the first hop (machine) of the route to the destination must be determined to route the datagram to the destination machine directly over the local network or to a gateway if the internet work is used. If routing is important, this information is added to the header using an option. Finally, the datagram is passed to the network for its manipulation of the datagram. As a datagram passes along the internetwork, each gateway performs a series of tests. After the network layer has stripped off its own header, the gateway IP layer calculates the checksum and verifies the integrity of the datagram. If the checksums don't match, the datagram is discarded and an error message is returned to the sending device. Next, the TTL field is decremented and checked. If the datagram has expired, it is discarded and an error message is sent back to the sending machine. After determining the next hop of the route, either by analysis of the target address or from a specified routing instruction within the Options field of the IP header, the datagram is rebuilt with the new TTL value and new checksum. If fragmentation is necessary because of an increase in the datagram's length or a limitation in the software, the datagram is divided and new datagram with the correct Header information is assembled. If a routing or timestamp is required, it is added as well. Finally, the datagram is passed back to the network layer. When the datagram is finally received at the destination device, the system performs a checksum calculation and assuming the two sums matchchecks to see if there are other fragments. If more datagram are required to reassemble the entire message, the system waits, meanwhile running a timer to ensure that the datagram arrive within a reasonable time. If all the parts of the larger message have arrived but the device can't reassemble them before the timer reaches 0, the datagram is discarded and an error message is returned to the sender. Finally, the IP header is stripped off, the original message is reconstructed if it was fragmented, and the message is passed up the layers to the upper layer application. If a reply was required, it is then generated and sent back to the sending device. When extra information is added to the datagram for routing or timestamp recording, the length of the datagram can increase. Handling all these conditions is part of IP's forte, for which practically every problem has a resolution system.

vinod vaze

QB on IT for TY BSc. (IT)

Following fields of the IP header may change from router to router. Total length Flags Fragmentation offset Time to live Header checksum 022 Ans: Three-way handshaking: The connection establishment is called as 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 open. Although the server TCP is ready to accept any connection from any machine in the world it can not make connection it self. The client program makes a request for an active open. A client wishes to connect to a server tells its TCP that it needs to be connected to a particular server The steps of the processes as follows: 1. The client sends the first segment, a SYN segment. The segment included the source and destination port numbers. The destination port number clearly defines the server to which the clients want 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 scale factor here using the appropriate option. This segment defines the wish of the client to make a connection with certain parameters. 2. The server sends the second segment, a SYN and AC segment. This segment has a dual purpose. First, it acknowledges the receipt of the first segment using the ACK flag and acknowledgement number field. The acknowledgement number is the client initialization sequence number plus one. The server must also define the client window size second, the segment is used to number the bytes sent from the server to client. It also contains 8

vinod vaze

QB on IT for TY BSc. (IT) the window scale factor option (if needed) to be used by the server and the MSS defined by the server. 3. The client sends the third segment. This is just an ACK segment. It acknowledges The receipts of the second segment sign the ACK flag and acknowledgement number field. The acknowledgement number is the server initialization sequence number plus one. The client must also define the server window size. 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.

Figure: Three Way handshake

vinod vaze

QB on IT for TY BSc. (IT)

023 After receiving the request for an active close, the client TCP closes 8 communication in the client server direction. However communication is the other direction is still open. When the server program has finished sending data in the server client direction, it can request from its TCP to close the connection in the server client direction. This is Normally a positive close. The four steps are: o The client TCP sends the first segment, a FIN segment. o The server TCP sends the second segment, an ACK segment to confirm the Receipt of the FIN segment from the client. In this segment, it uses the Acknowledgement number, which is one plus the sequence number received in the FIN segment. o The server TCP can continue sending data in the server client direction. When it does not have any more data to send, it

vinod vaze

QB on IT for TY BSc. (IT) sends the third segment. This segment is a FIN segment. o The client TCP sends the fourth segment, an ACK segment, to confirm the receipt of the FIN segment contains the acknowledgement number, which is one plus the sequence number is received in the FIN segment from the server. Figure: Four Way Handshake

024 Draw the TCP state transition diagram. Explain the states, which the 8 TCP client can attain? Ans: A connection progresses through a series of states during its lifetime (listed below). CLOSED is fictional because it represents the state when there is no TCB, and therefore, no connection. Briefly the meanings of the states are:

vinod vaze

QB on IT for TY BSc. (IT)

LISTEN represents waiting for a connection request from any remote TCP and Port. SYNSENT represents waiting for a matching connection request after having sent a connection request. SYNRECEIVED represents waiting for a confirming connection request ACKNOWLEDGMENT after having both received and sent a connection request.

vinod vaze

QB on IT for TY BSc. (IT) ESTABLISHED represents an open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection. FINWAIT1 represents waiting for a connection termination request from the Remote TCP or an acknowledgment of the connection termination request previously sent. FINWAIT2 represents waiting for a connection termination request from the Remote TCP. CLOSEWAIT represents waiting for a connection termination request from the Local user. CLOSING represents waiting for a connection termination request Acknowledgment from the remote TCP. LASTACK represents waiting for an acknowledgment of the connection Termination request previously sent to the remote TCP (which includes an Acknowledgment of its connection termination request). TIMEWAIT represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request. CLOSED represents no connection state at all. A TCP connection progresses from one state to another in response to events. The events are the user calls, OPEN, SEND, RECEIVE, CLOSE, ABORT, and STATUS; The incoming segments, particularly those containing the SYN, ACK, RST and FIN flags; And timeouts.

vinod vaze

QB on IT for TY BSc. (IT)

025 What is Kerns Algorithm? Ans: Karns Algorithm: Suppose that a segment is not acknowledged during the retransmission period and it is therefore retransmitted. When the sending TCP receives an acknowledgment for this segment, it does not know if the acknowledgment is for the original segment or for the retransmitted one. The value of the new RTT therefore must be calculated based on the departure of the segment. However, if the original segment was lost and the acknowledgment is for the retransmitted one, the value of the current RTT must be calculated from the time the segment was retransmitted. This is a dilemma that was solved by Karn. Karns solution is very simple. Do not consider the RTT of a retransmitted segment in the calculation of the new RTT. Do not update the value of RTT until you send a segment and receive an acknowledgment without the need for retransmission. 026 The sending TCP may create a silly window syndrome if it is serving an 4 application program that creates data slowly, for example, 1byte 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, The solution is to prevent sending TCP from sending this 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. Nagles Algorithm: Nagle Algorithm is very simple, but it solves the problem. This algorithm is for the sending TCP: 1. The sending TCP sends the first piece of data it receives from the sending application program even if it is only 1 byte. 2. 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

vinod vaze

QB on IT for TY BSc. (IT) maximum-size segment. At this time, the sending TCP can send the segment. 3. Step 2 is repeated for the rest of 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. Syndrome Created by the Receiver: The receiving TCP may create a silly window syndrome if it is serving an application program that consumes data slowly, for example, 1 byte at a time. Suppose that the program consumes data 1 byte at a time. Also suppose that the input buffer of the receiving TCP is 4K. The sender sends the first 4 Kbytes of data. The receiver stores it in its buffer. Now its buffer is full. It advertises a window size, which means the sender should stop sending data. The receiving application reads the first byte of data from the input buffer of the receiving TCP. Now there is 1 byte of space in the incoming buffer. The receiving TCP announces a window size of 1byte, which means that the sending TCP, which is eagerly waiting to send data, takes this advertisement as good news sends a segment carrying only 1-byte of data. The procedure will continue. One byte of data is consumed and a segment carrying 1 byte of data is sent. Again we have efficiency problem and a silly-window syndrome. Two Solutions have been proposed to prevent the silly window syndrome created by an application program that consumes data slower than they arrive. Clarks Solution: Clarks solution is to send an acknowledgment as soon as the data arrives, but to announce a window size of zero until either there is enough space to accommodate a segment of maximum size or until half of the buffer is empty.

vinod vaze

QB on IT for TY BSc. (IT)

027 What happens when a router receives packets faster than it processes them? How can such a situation be avoided? Ans: 1. When a router receives packets than it processes them then the packets will be discarded. Because the data that is received is typically buffered in memory, as the processor cannot deal with it immediately. If there is too much data arriving to be processed, the data buffer can often overflow, and all newly arriving data will be discarded. 2. Thus, there is a need for a mechanism, which can tell hosts to stop sending data segments, and to wait until the data has been properly processed. The transport layer copes with these problems by issuing a Not Ready indicator, which tells a transmitter not to send any more data, until the hosts sends a Ready indicator. After this the transmitter can send data.

vinod vaze

QB on IT for TY BSc. (IT)

028 Transmission control protocol using error control? What is max size of TCP header? What is the minimum size of TCP header? Ans: Error Control Error control refers to the set of procedures that are used to ensure error free transmission of data over the network. It thus involves an error detection mechanism and retransmission of messages in which error were detected. Retransmission Timer - To control a lost or discarded segment, TCP employs a retransmission timer that handles the retransmission time, the waiting time for an acknowledgement of a segment. When TCP sends a segment, it creates a retransmission timer for that particular segment. Two situations may occur: 1) If an acknowledgement is received for this particular segment before the timer goes off, the timer is destroyed. 2) If the timer goes off before the acknowledgement arrives, the segment is retransmitted and the timer is reset. The minimum size of TCP header is 5 words i.e. 20 bytes. The maximum size of TCP header is 15 words i.e. 60 bytes. 029 What are the different states for transmission control protocol? What are the states, which the TCP client can attain? A TCP connection is in the FIN-WAIT-1 state. The following events occur one after another 1. An ACK segment is received. 2. A FIN segment is received. Time-out occurs. What is the state of the connection after each event? What is action after each event? Ans: States for TCP

vinod vaze

QB on IT for TY BSc. (IT) LISTEN SYN-SENT SYN-RECEIVED ESTABLISHED FIN-WAIT-1 FIN-WAIT-2 CLOSE-WAIT CLOSING LAST-ACK TIME-WAIT CLOSED

A TCP connection is in the FIN-WAIT-1 state. In which TCP is waiting for a connection termination request or an acknowledgment of a connection termination from the remote TCP. 1. TCP has received the ACK segment for connection termination. 2. A FIN segment is received which indicates that the sender has no more data to send. This is the equivalent of an end-of-transmission marker. OR 1) Application sends close message Action: Application will send FIN request to the remote machine. And then waits for remote machine to send ACK or Acknowledgment. And goes into FIN-WAIT-1 state State: FIN-WAIT- 1 (Means that application is waiting for ACK to Be received) 2) ACK segment is received Action: ACK is received from remote machine. As soon as ACK is Received this machine waits for remote machine to send FIN or connection termination request. And goes into FINWAIT-2 state State: FIN-WAIT-2 (Sender is waiting for remote machine to get FIN request) 3) FIN segment is received Action: as soon as FIN is received from server, client sends ACK to the server vinod vaze

QB on IT for TY BSc. (IT) State: FIN-WAIT-2

4) Application Sends close message Action: Practically after sending ACK to the server Client waits for Period of time = double the maximum Segment Size to Make sure that Server has received ACK sent before State: TIME-WAIT And once the timers expires after double the MSL time connection is closed.

States of TCP: ESTABLISHED, FIN WAIT 1, FIN WAIT 2, TIME WAIT, CLOSED. i) An ACK segment is received

vinod vaze

QB on IT for TY BSc. (IT) State of Connection: FIN WAIT 2 Action after event: Wait for server to finish ii) A FIN segment is received State of Connection: TIME WAIT Action after event: Send ACK, Wait for double Maximum Segment Life(MSL) Time. And the connection is closed. 030 031 100 ARP (Address Resolution Protocol) 101 Draw a sketch for Cache Table:

102 103 104 105

vinod vaze

QB on IT for TY BSc. (IT)

200 RARP (Reverse Address Resolution Protocol) 201 With the help of a neat diagram explain the fields in Reverse Address Resolution Protocol packet. (October 2005) RARP packet: Hardware type Hardware Protocol address length address length Source hardware address::: Source protocol address::: Destination hardware address::: Destination protocol address::: Protocol type Opcode

Hardware type. 16 bits. Type 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Description Ethernet. Experimental Ethernet. Amateur Radio AX.25. Proteon ProNET Token Ring. Chaos. IEEE 802. ARCNET. Hyperchannel. Lanstar. Autonet Short Address. LocalTalk. LocalNet (IBM PCNet or SYTEK LocalNET). Ultra link. SMDS.

vinod vaze

QB on IT for TY BSc. (IT) 15 16 17 18 19 20 21 22 23 24 25 26 27 28


Frame Relay.

ATM, Asynchronous Transmission Mode. HDLC. Fibre Channel. ATM, Asynchronous Transmission Mode. Serial Line. ATM, Asynchronous Transmission Mode. MIL-STD-188-220. Metricom. IEEE 1394.1995. MAPOS. Twinaxial. EUI-64. HIPARP.

Protocol type. 16 bits. Protocol 0x800 Description IP.

Hardware address length. 8 bits. Length of the hardware address in bytes. Protocol address length. 8 bits. Length of the protocol address in bytes. Opcode. 8 bits. Opcode Description Request 3 Reverse. Reply 4 Reverse. References
RFC 903 RFC 903

Source hardware address. Variable length. Source protocol address. Variable length. Destination hardware address. Variable length.

vinod vaze

QB on IT for TY BSc. (IT) Destination protocol address. Variable length. 202 Write a shot note on RARP (November 2004) Ans: RARP - It is used by a host to discover its IP address The machine can get the physical address by reading the NIC, which is unique locally. It can then use the physical address to get the logical address using the RARP protocol. A RARP request is created and broadcast on the local network. Another machine on the local network that knows all the IP addresses will respond with RARP reply. The requesting machine must be running a RARP client program, the responding machine must be running a RARP server program Packet Format Same as ARP Packet format 0 8 Hardware Address Type Header Len Paddr Len 16 24 Protocol Type Operation Sender Paddr (first 2 octals) Target h/w addr (first 2 octals) 31 4

Sender h/w addr (last 2 octals) Sender Paddr (last 2 octals)

Target Haddr (last 4 octals) Target Paddr (all 4 octals) 4 203 The RARP request packets are broadcast; RARP reply packets are unicast, Explain. (May 2005)

vinod vaze

QB on IT for TY BSc. (IT) Ans: A machine that has its physical address and needs to find its IP address sends a RARP request to all systems on the network. This packet is received by every host/router on a physical network, but only the RARP server on the right will answer it. The server sends back the RARP reply packet that includes the IP address of the requestor. 204 205 206 207 208 209 210 300 RIP (Routing Information Protocol)

301 Why does the network using routing information protocol become 8 unstable? How can this problem be overcome? (May 2004) RIP prevents routing loops from continuing indefinitely by implementing a limit on the number of hops allowed in a path from the source to a destination. The maximum number of hops in a path is 15. If a router receives a routing update that contains a new or changed entry, and if increasing the metric value by 1 causes the metric to be infinity (that is, 16), the network destination is considered unreachable. The downside of this stability feature is that it limits the maximum diameter of a RIP network to less than 16 hops. RIP includes a number of other stability features that are common to many routing protocols. These features are designed to provide stability despite potentially rapid changes in a network's topology. For example, RIP implements the split horizon and hold down mechanisms to prevent incorrect routing information from being propagated. Preventing instability The algorithm as presented up to this point will always allow a host or vinod vaze

QB on IT for TY BSc. (IT) gateway to calculate a correct routing table. However, that is still not quite enough to make it useful in practice. The proofs referred to above only show that the routing tables will converge to the correct values in finite time. They do not guarantee that this time will be small enough to be useful, nor do they say what will happen to the metrics for networks that become inaccessible. We choose a large metric value to represent "infinity". This value must be large enough that no real metric would ever get that large. For the purposes of this example, we will use the value 16. Suppose a network becomes inaccessible. All of the immediately neighboring gateways time out and set the metric for that network to 16. For purposes of analysis, we can assume that all the neighboring gateways have gotten a new piece of hardware that connects them directly to the vanished network, with a cost of 16. Since that is the only connection to the vanished network, all the other gateways in the system will converge to new routes that go through one of those gateways. It is easy to see that once convergence has happened; all the gateways will have metrics of at least 16 for the vanished network. Gateways one hop away from the original neighbors would end up with metrics of at least 17; gateways two hops away would end up with at least 18, etc. As these metrics are larger than the maximum metric value, they are all set to 16. It is obvious that the system will now converge to a metric of 16 for the vanished network at all gateways. We are trying to show why certain features are needed. Note that the letters correspond to gateways, and the lines to networks. A-----B \ /\ \/ | C / all networks have cost 1, except | / For the direct link from C to D, which |/ Has cost 10 D |<=== Target network Each gateway will have a table showing a route to each network. However, for purposes of this illustration, we show only the routes from each gateway to the network marked at the bottom of the diagram. D: directly connected, metric 1 B: route via D, metric 2 C: route via B, metric 3 A: route via B, metric 3 Now suppose that the link from B to D fails. The routes should now

vinod vaze

QB on IT for TY BSc. (IT) adjust to use the link from C to D. The routing changes start when B notices that the route to D is no longer usable. For simplicity, the chart below assumes that all gateways send updates at the same time. The chart shows the metric for the target network, as it appears in the routing table at each gateway. Time ------> D: dir, 1 dir, 1 dir, 1 dir, 1 ... dir, 1 dir, 1 B: unreach C, 4 C, 5 C, 6 C, 11 C, 12 C: B, 3 A, 4 A, 5 A, 6 A, 11 D, 11 A: B, 3 C, 4 C, 5 C, 6 C, 11 C, 12 Dir = directly connected Unreach = unreachable Here's the problem: B is able to get rid of its failed route using a timeout mechanism. But vestiges of that route persist in the system for a long time. Initially, A and C still think they can get to D via B. So, they keep sending updates listing metrics of 3. In the next iteration, B will then claim that it can get to D via either A or C. Of course, it can't. The routes being claimed by A and C are now gone, but they have no way of knowing that yet. And even when they discover that their routes via B have gone away, they each think there is a route available via the other The worst case is when a network becomes completely inaccessible from some part of the system. In that case, the metrics may increase slowly in a pattern like the one above until they finally reach infinity. For this reason, the problem is called "counting to infinity". You should now see why "infinity" is chosen to be as small as possible. If a network becomes completely inaccessible, we want counting to infinity to be stopped as soon as possible. Infinity must be large enough that no real route is that big. But it shouldn't be any bigger than required. Thus the choice of infinity is a tradeoff between network size and speed of convergence in case counting to infinity happens. The designers of RIP believed that the protocol was unlikely to be practical for networks with a diameter larger than 15. There are several things that can be done to prevent problems like this. The ones used by RIP are called "split horizon with poisoned reverse", and "triggered updates".

vinod vaze

QB on IT for TY BSc. (IT)

303 Q.: How remote objects are used with reference to distributed application? The remote objects are used with reference to distributed application by using RMI. Distributed objects are software modules that are designed to work together, but reside either in multiple computers connected via a network or in different processes inside the same computer. One object sends a message to another object in a remote machine or process to perform some task. The results are sent back to the calling object. The RMI (Java Remote Method Invocation) system is a mechanism that enables an object on one Java virtual machine to invoke methods on an object in another Java virtual machine. Any object whose methods can be invoked in this way must implement the java.rmi.Remote interface. When such an object is invoked, its arguments are marshalled and sent from the local virtual machine to the remote one, where the arguments are unmarshalled and used. When the method terminates, the results are marshalled from the remote machine and sent to the caller's virtual machine. To make a remote object accessible to other virtual machines, a program typically registers it with the RMI registry. The program supplies to the registry the string name of the remote object as well as the remote object itself. When a program wants to access a remote object, it supplies the object's string name to the registry that is on the same machine as the remote object. The registry returns to the caller a reference (called stub) to the remote object. When the program receives the stub for the remote object, it can invoke methods on the object (through the stub). A program can also obtain references to remote objects as a result of remote calls to other remote objects or from other naming services. For example, the program can look up a reference to a remote object from an LDAP server that supports the schema defined RFC 2713.

Distributed objects are implemented in Objective-C using the Cocoa API with the NSConnection class and supporting objects. Distributed objects are used in Java RMI. CORBA lets one build distributed mixed object systems. DCOM is a framework for distributed objects on the Microsoft platform. DDObjects is a framework for distributed objects using Borland Delphi.

vinod vaze

QB on IT for TY BSc. (IT)


JavaSpaces is a Sun specification for a distributed, shared memory (spaces based) Pyro is a framework for distributed objects using the Python programming language. Distributed Ruby (DRb) is a framework for distributed objects using the Ruby programming language.

304 Q. How many bytes are empty in a RIP message that advertises N Network? Ans: The format of RIP message is shown as below:

32 bits = 4 bytes
16 bits = 2 bytes 8 bits

Command. This 8-bit field specifies the type of message: request (1) or response (2) Version. This 8-bit field defines the version. In this book we use version 1, but at the end of this section, we give some new features of version 2. Family. This 16-bit field defines the family of the protocol used. For TCP/IP value is 2. Network address. The address field defines the address of the destination network. RIP has allocated 14 bytes for this field to be applicable to any Protocol. However, IP currently uses only 4 bytes. The rest of the address is filled with "0"s Distance. This 32-bit field defines the hop count from the advertising router to the destination network.

vinod vaze

QB on IT for TY BSc. (IT) Note that part of the message is repeated for each destination network. We refer to this as an entry. Thus the first line is a common factor: The first line occupies 4 bytes The remaining 5 lines are repeated for every network. If there are n networks When we observe the following the repeated row are occupied as below: Row 1 2 3 4 5 Used 2 4 0 0 4 Used by field Family Network Address ----Distance Total Empty 2 0 4 4 0 10 Total 4 4 4 4 4

Thus The numbers of bytes are empty in a RIP message that advertises N Network would be 10 x N. 305 Q. Which are the types of messages used by RIP? RIP has two types of messages: Request and response.

A request message is sent by a router that has just come up or by a rc has some time-out entries. A request can ask about specific entries or all (see Figure below)

A response can be either solicited or unsolicited. A solicited response is sent only in answer to a request. It contains information about the destination specified in the corresponding request. An unsolicited response, on the other hand, is sent

vinod vaze

QB on IT for TY BSc. (IT) periodically, every 30 s or when there is a change in the routing table. The response is sometime called an update packet. Figure 14.9 shows the response message format. 306 Q. Which are the times used by RIP? RIP uses three timers to support its operation: 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

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 2\ 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 is 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. When the information about a route becomes invalid, the router does not

vinod vaze

QB on IT for TY BSc. (IT) 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 Numerical problem: A routing table has 20 entries. It does not receive information about five routes for many timers are running at this time? Solution The 21 timers are listed below: Periodic timer: 1 Expiration timer: 20 - 5 = 15 Garbage collection timer: 5

307

Q. Write notes on RIP Version 2 RIP version 2 was designed to overcome some of the shortcomings of version 1. The designers of version 2 have not augmented the length of the message for each entry. They have only replaced those fields in version 1 that were filled with as for the TCP/IP protocol with some new fields. Format of RIP Ver 2

Figure shows the format of a RIP version 2 message. The new fields of this message are as follows:

Route tag. This field carries information such as the autonomous

vinod vaze

QB on IT for TY BSc. (IT) system number. It can be used to enable RIP to receive information from an interdomain routing protocol.

Subnet mask. This is a 4-byte field that carries the subnet mask (or prefix). This means that RIP2 supports classless addressing and CIDR. Next-hop address. This field shows the address of the next hop. This is particularly useful if two autonomous systems share a network (a backbone, for example). Then the message can define the router, in the same autonomous system or another autonomous system, to which the packet next goes. Classless Addressing: Probably the most important difference between the two versions of RI is classwise versus classless addressing. RIPv1 uses classwise addressing. The only entry III the message format is the network address (with a default mask). RIPv2 adds one field for the subnet mask, which can be used to define a network prefix length. This means that in this version, we can use classless addressing. A group of networks can be combined into one prefix and advertised collectively,

End of notes

308 309 310 311 312 313 314 vinod vaze

QB on IT for TY BSc. (IT)

400 OSPF [Open Shortest Path First] 401 Show the autonomous system with the following specifications: (i) There are eight networks (N1 to N8) (ii) There are eight routers (R1 to R8) (iii) N1, N2, N3, N4, AND N5 are Ethernet networks (iv) N6 is a Token Ring (v) N7 and N8 are point-to-point networks (vi) R1 connects N1 and N2 (vii) R2 connects N1 and N7 (viii) R3 connects N2 and N3 (ix) R4 connects N7 and N5 (x) R5 connects N6 and N3 (xi) R6 connects N6 and N4 (xii) R7 connects N6 and N5 (xiii) R8 connects N8 and N5 Draw the graphical representation of the above autonomous system as seen by OSPF. (May 2004)

vinod vaze

QB on IT for TY BSc. (IT)

500 BGP [Border Gateway Protocol] Explain the Path Vector Routing. Compare it with Distance Vector 501 Routing message packet used by Border Gateway and Link State Routing. Explain the field of Update Protocol. (May 2006) Ans: Distance vector and link state routing are both intra-domain routing protocols. They are used inside an autonomous system, but not between autonomous systems. Both of these routing protocols become intractable in large networks and cannot be used in Inter-domain routing. Distance vector routing is subject to instability if there are more than few hops in the domain. Link state routing needs huge amount of resources to calculate routing tables. It also creates heavy traffic because of flooding. Path vector routing is used for inter-domain routing. It is similar to Distance vector routing. In path vector routing we assume there is one node (there can be many) in each autonomous system which acts on behalf of the entire autonomous system. This node is called the speaker node. The speaker node creates a routing table and advertises it to neighboring speaker nodes in neighboring autonomous systems. The idea is the same as Distance vector routing except that only speaker nodes in each autonomous system can communicate with each other. The speaker node advertises the path, not the metric of the nodes, in its autonomous system or other autonomous systems. Path vector routing is discussed in RFC 1322; the path vector routing algorithm is somewhat similar to the distance vector algorithm in the sense that each border router advertises the destinations it can reach to its neighboring router. However, instead of advertising networks in terms of a destination and the distance to that destination, networks are advertised as destination addresses and path descriptions to reach those destinations. A route is defined as a pairing between a destination and the attributes of the path to that destination, thus the name, path vector routing, where the routers receive a vector that contains paths to a set of destinations. The path, expressed in terms of vinod vaze

QB on IT for TY BSc. (IT) the domains (or confederations) traversed so far, is carried in a special path attribute that records the sequence of routing domains through which the reachability information has passed. The path represented by the smallest number of domains becomes the preferred path to reach the destination. BGP Update Message Fields BGP packets in which the type field in the header identifies the packet to be a BGP update message packet include the following fields. Upon receiving an update message packet, routers will be able to add or delete specific entries from their routing tables to ensure accuracy. Update messages consist of the following packets: Unfeasible Routes Length---Indicates the total length of the withdrawn routes field or that the field is not present. Withdrawn Routes---Contains a list of IP address prefixes for routes being withdrawn from service. Total Path Attribute Length---Indicates the total length of the path attributes field or that the field is not present. Path Attributes---Describes the characteristics of the advertised path. The following are possible attributes for a path: Origin: Mandatory attribute that defines the origin of the path information AS Path: Mandatory attribute composed of a sequence of autonomous system path segments Next Hop: Mandatory attribute that defines the IP address of the border router that should be used as the next hop to destinations listed in the network layer reachability information field Mult Exit Disc: Optional attribute used to discriminate between multiple exit points to a neighboring autonomous system Local Pref: Discretionary attribute used to specify the degree of preference for an advertised route Atomic Aggregate: Discretionary attribute used to disclose information about route selections Aggregator: Optional attribute that contains information about aggregate routes Network Layer Reachability Information---Contains a list of IP address prefixes for the advertised routes

vinod vaze

QB on IT for TY BSc. (IT)

502 What different types of message BGP uses? Explain use of each Message Type? (May 2005) Ans: BGP Message Types Four BGP message types are specified in RFC 1771, A Border Gateway Protocol 4 (BGP-4): open message, update message, notification message, and keep-alive message. The open message opens a BGP communications session between peers and is the first message sent by each side after a transport-protocol connection is established. Open messages are confirmed using a keepalive message sent by the peer device and must be confirmed before updates, notifications, and keep-alive can be exchanged. An update message is used to provide routing updates to other BGP systems, allowing routers to construct a consistent view of the network topology. Updates are sent using the Transmission-Control Protocol (TCP) to ensure reliable delivery. Update messages can withdraw one or more unfeasible routes from the routing table and simultaneously can advertise a route while withdrawing others. The notification message is sent when an error condition is detected. Notifications are used to close an active session and to inform any connected routers of why the session is being closed. The keep-alive message notifies BGP peers that a device is active. Keepalive are sent often enough to keep the sessions from expiring. An OSPF network can be divided into sub-domains called areas. An area 503 is a logical collection of OSPF networks, routers, and links that have the same area identification.. A router within an area must maintain a topological database for the area to which it belongs. The router doesn't have detailed information about network topology outside of its area, thereby reducing the size of its database. Areas limit the scope of route information distribution. It is not possible to do route update filtering within an area. The link-state database (LSDB) of routers within the same area must be synchronized and be exactly the same; however, route summarization and filtering is possible between different areas. The main benefit of creating areas is a reduction in the number of routes to propagateby the filtering and the summarization of routes. Each OSPF network that is divided into different areas must follow these

vinod vaze

QB on IT for TY BSc. (IT) rules: A backbone areawhich combines a set of independent areas into a single domainmust exist. Each non-backbone area must be directly connected to the backbone area (though this connection might be a simple logical connection through a virtual link,). The backbone area must not be partitioneddivided into smaller piecesunder any failure conditions, such as link or router down events.

Metric The OSPF allows the administrator to assign a cost, called the metric, to each route. The metric can be based on a type of service. As a matter of fact, a router can have multiple routing tables, each based on different type of service Links: A point-to-point link is a dedicated link that connects exactly two communication facilities (e.g., two nodes of a network, an intercom station at an entryway with a single internal intercom station, a radio path between two points, etc.). Transience means passing with time. Something which has the property of transience is said to be transient, or often simply a transient or transient state . Example include: A transient astronomical event is a phenomenon that is relatively shortlived by astronomical standards. Examples include supernovae, comets, and meteors. Virtual link When the link between two routers is broken , the administration may create a virtual link between them using a longer path that probably goes through a several routers. 504

vinod vaze

QB on IT for TY BSc. (IT)

505 What are the different types of message used by Border Gateway 8 Protocol? Explain the Border Gateway Protocol Header; explain the fields of Open message packet. (October 2005) Ans: All BGP message types use the basic packet header. Open, update, and notification messages have additional fields, but keep-alive messages use only the basic packet header. Figure 35-3 illustrates the fields used in the BGP header. The section that follows summarizes the function of each field. BGP Packet-Header Fields Each BGP packet contains a header whose primary purpose is to identify the function of the packet in question. The following descriptions summarize the function of each field in the BGP header illustrated in Figure 35-3. Marker---Contains an authentication value that the message receiver can predict Length---Indicates the total length of the message in bytes. Type---Type --- Specifies the message type as one of the following: Open Update Notification Keep-alive Data---Contains upper-layer information in this optional field. BGP Open Message Fields BGP packets in which the type field in the header identifies the packet to be a BGP open message packet include the following fields. These fields provide the exchange criteria for two BGP routers to establish a peer relationship. Version---Provides the BGP version number so that the recipient can determine whether it is running the same version as the sender. Autonomous System---Provides the autonomous system number of the sender Hold-Time---Indicates the maximum number of seconds that can

vinod vaze

QB on IT for TY BSc. (IT) elapse without receipt of a message before the transmitter is assumed to be nonfunctional. BGP Identifier---Provides the BGP identifier of the sender (an IP address), which is determined at startup and is identical for all local interfaces and all BGP peers. Optional Parameters Length---Indicates the length of the optional parameters field (if present). Optional Parameters---Contains a list of optional parameters (if any). Only one optional parameter type is currently defined: authentication information. 8

506 Explain the Path Vector Routing. Compare it with Distance Vector 507 Routing message packet used by Border Gateway and Link State Routing. Explain the field of Update Protocol. (May 2006) Ans: Distance vector and link state routing are both intra-domain routing protocols. They are used inside an autonomous system, but not between autonomous systems. Both of these routing protocols become intractable in large networks and cannot be used in Inter-domain routing. Distance vector routing is subject to instability if there are more than few hops in the domain. Link state routing needs huge amount of resources to calculate routing tables. It also creates heavy traffic because of flooding. Path vector routing is used for inter-domain routing. It is similar to Distance vector routing. In path vector routing we assume there is one node (there can be many) in each autonomous system which acts on behalf of the entire autonomous system. This node is called the speaker node. The speaker node creates a routing table and advertises it to neighboring speaker nodes in neighboring autonomous systems. The idea is the same as Distance vector routing except that only speaker nodes in each autonomous system can communicate with each other. The speaker node advertises the path, not the metric of the nodes, in its autonomous system or other autonomous systems. Path vector routing is discussed in RFC 1322; the path vector routing algorithm is somewhat similar to the distance vector algorithm in the sense that each border router advertises the destinations it can reach to its neighboring router. However, instead of advertising networks in terms of a destination and the distance to that destination, networks are advertised as destination addresses and path descriptions to reach those destinations. A route is defined as a pairing

vinod vaze

QB on IT for TY BSc. (IT) between a destination and the attributes of the path to that destination, thus the name, path vector routing, where the routers receive a vector that contains paths to a set of destinations. The path, expressed in terms of the domains (or confederations) traversed so far, is carried in a special path attribute that records the sequence of routing domains through which the reachability information has passed. The path represented by the smallest number of domains becomes the preferred path to reach the destination. BGP Update Message Fields BGP packets in which the type field in the header identifies the packet to be a BGP update message packet include the following fields. Upon receiving an update message packet, routers will be able to add or delete specific entries from their routing tables to ensure accuracy. Update messages consist of the following packets: Unfeasible Routes Length---Indicates the total length of the withdrawn routes field or that the field is not present. Withdrawn Routes---Contains a list of IP address prefixes for routes being withdrawn from service. Total Path Attribute Length---Indicates the total length of the path attributes field or that the field is not present. Path Attributes---Describes the characteristics of the advertised path. The following are possible attributes for a path: Origin: Mandatory attribute that defines the origin of the path information AS Path: Mandatory attribute composed of a sequence of autonomous system path segments Next Hop: Mandatory attribute that defines the IP address of the border router that should be used as the next hop to destinations listed in the network layer reachability information field Mult Exit Disc: Optional attribute used to discriminate between multiple exit points to a neighboring autonomous system Local Pref: Discretionary attribute used to specify the degree of preference for an advertised route

vinod vaze

QB on IT for TY BSc. (IT) Atomic Aggregate: Discretionary attribute used to disclose information about route selections Aggregator: Optional attribute that contains information about aggregate routes Network Layer Reachability Information---Contains a list of IP address prefixes for the advertised routes

508

What different types of message BGP uses? Explain use of each Message Type? (May 2005) Ans: BGP Message Types Four BGP message types are specified in RFC 1771, A Border Gateway Protocol 4 (BGP-4): open message, update message, notification message, and keep-alive message. The open message opens a BGP communications session between peers and is the first message sent by each side after a transport-protocol connection is established. Open messages are confirmed using a keepalive message sent by the peer device and must be confirmed before updates, notifications, and keep-alive can be exchanged. An update message is used to provide routing updates to other BGP systems, allowing routers to construct a consistent view of the network topology. Updates are sent using the Transmission-Control Protocol (TCP) to ensure reliable delivery. Update messages can withdraw one or more unfeasible routes from the routing table and simultaneously can advertise a route while withdrawing others. The notification message is sent when an error condition is detected. Notifications are used to close an active session and to inform any connected routers of why the session is being closed. The keep-alive message notifies BGP peers that a device is active. Keepalive are sent often enough to keep the sessions from expiring.

vinod vaze

QB on IT for TY BSc. (IT)

509 What are the different types of message used by Border Gateway Protocol? Explain the Border Gateway Protocol Header; explain the fields of Open message packet. (October 2005) Ans: All BGP message types use the basic packet header. Open, update, and notification messages have additional fields, but keep-alive messages use only the basic packet header. Figure 35-3 illustrates the fields used in the BGP header. The section that follows summarizes the function of each field. BGP Packet-Header Fields Each BGP packet contains a header whose primary purpose is to identify the function of the packet in question. The following descriptions summarize the function of each field in the BGP header illustrated in Figure 35-3. Marker---Contains an authentication value that the message receiver can predict Length---Indicates the total length of the message in bytes.

Type---Type --- Specifies the message type as one of the following: Open Update Notification Keep-alive Data---Contains optional field.

upper-layer

information

in

this

BGP Open Message Fields BGP packets in which the type field in the header identifies the packet to be a BGP open message packet include the following fields. These fields provide the exchange criteria for two BGP routers to establish a peer relationship. Version---Provides the BGP version number so that the recipient can determine whether it is running the same version as the sender.

vinod vaze

QB on IT for TY BSc. (IT) Autonomous System---Provides the autonomous system number of the sender Hold-Time---Indicates the maximum number of seconds that can elapse without receipt of a message before the transmitter is assumed to be nonfunctional. BGP Identifier---Provides the BGP identifier of the sender (an IP address), which is determined at startup and is identical for all local interfaces and all BGP peers. Optional Parameters Length---Indicates the length of the optional parameters field (if present).

Optional Parameters---Contains a list of optional parameters (if any). Only one optional parameter type is currently defined: authentication information. 510

Type 1 - Router LSA - the router lists the links to other routers or networks in the same area, together with the metric. Type 1 LSAs are flooded across their own area only. The link-state ID of the type 1 LSA is the originating router ID. Type 2 - Network LSA - the designated router on a broadcast segment (e.g. Ethernet) lists which routers are joined together by the segment. Type 2 LSAs are flooded across their own area only. The link-state ID of the type 2 LSA is the IP interface address of the DR. Type 3 - Summary LSA - an Area Border Router (ABR) takes information it has learned on one of its attached areas and it can summarizes it (but not by default) before sending it out on other areas it is connected to. This summarization helps provide scalability by removing detailed topology information for other areas, because their routing information is summarized into just an address prefix and metric. The summarization process can also be configured to remove a lot of detailed address prefixes and replace them with a single summary prefix, also helping scalability. The link-state ID is the destination network number for type 3 LSAs. Type 4 - ASBR-Summary LSA - this is needed because Type 5

vinod vaze

QB on IT for TY BSc. (IT) External LSAs are flooded to all areas and the detailed next-hop information may not be available in those other areas. This is solved by an Area Border Router flooding the information for the router (i.e. the Autonomous System Border Router) where the type 5 originated. The link-state ID is the router ID of the described ASBR for type 4 LSAs.

Type 5 - External LSA - these LSAs contain information imported into OSPF from other routing processes. They are flooded to all areas (except stub areas). For "External Type 1" LSAs routing decisions are made by adding the OSPF metric to get to the ASBR and the external metric from there on, while for "External Type 2" LSAs only the external metric is used. The link-state ID of the type 5 LSA is the external network number.

511 512 513 514 515 601 Socket Programming 602 Socket Programming 603 Socket Programming 604 Socket Programming

vinod vaze

QB on IT for TY BSc. (IT)

605 Socket Programming 606 Socket Programming 607 Socket Programming 608

Socket Programming

609 Socket Programming 610 Socket Programming

700 RMI Remote Method Invocation 701 1. Get the Internet address of the remote host. 2. Open a Socket connection to the server 3. Convert the data to be transmitted into an ASCII value or a byte stream. 4. Read the server response and convert the ASCII value into the required type. The task of converting the argument type to the ASCII is called Marshaling the value. The Task of converting the return value to the client data type is called unmarshaling the value. In RMI marshaling and un-marshaling are done automatically for objects as well as primitive data types. To do this, it uses java serialization facility. It serializes the argument and return values transfers them over the network and de-serialises them for use. Therefore any object that implements the interface java.io. serializeable can be sent or received as vinod vaze

QB on IT for TY BSc. (IT) a argument or return value. RMI 702 Write a short note on distributing and installing RMI software (May 2004) Ans: Distributing and Installing RMI Software RMI adds support for a Distributed Class model to the Java platform and extends Java technology's reach to multiple JVMs. It should not be a surprise that installing an RMI system is more involved than setting up a Java runtime on a single computer. In this section, you will learn about the issues related to installing and distributing an RMI based system. For the purposes of this section, it is assumed that the overall process of designing a DC system has led you to the point where you must consider the allocation of processing to nodes. And you are trying to determine how to install the system onto each node. RMI 703 With the help of a neat diagram describe the RMI architecture (May 2004) & (November 2004) Ans: RMI Architecture Layers With an understanding of the high-level RMI architecture, take a look under the covers to see its implementation. The RMI implementation is essentially built from three abstraction layers. The first is the Stub and Skeleton layer, which lies just beneath the view of the developer. This layer intercepts method calls made by the client to the interface reference variable and redirects these calls to a remote RMI service. The next layer is the Remote Reference Layer. This layer understands how to interpret and manage references made from clients to the remote service objects. In JDK 1.1, this layer connects clients to remote service objects that are running and exported on a server. The connection is a one-to-one (unicast) link. In the Java 2 SDK, this layer was enhanced to support the activation of dormant remote service objects via Remote

vinod vaze

QB on IT for TY BSc. (IT)

Object Activation. The transport layer is based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.

By using a layered architecture each of the layers could be enhanced or replaced without affecting the rest of the system. For example, the transport layer could be replaced by a UDP/IP layer without affecting the upper layers.

Stub and Skeleton Layer The stub and skeleton layer of RMI lie just beneath the view of the Java developer. In this layer, RMI uses the Proxy design pattern as described in the book, Design Patterns by Gamma, Helm, Johnson and Vlissides. In the Proxy pattern, an object in one context is represented by another (the proxy) in a separate context. The proxy knows how to forward method calls between the participating objects. The following class diagram illustrates the Proxy pattern.

In RMI's use of the Proxy pattern, the stub class plays the role of the proxy, and the remote service implementation class plays the role of the vinod vaze

QB on IT for TY BSc. (IT)

RealSubject. A skeleton is a helper class that is generated for RMI to use. The skeleton understands how to communicate with the stub across the RMI link. The skeleton carries on a conversation with the stub; it reads the parameters for the method call from the link, makes the call to the remote service implementation object, accepts the return value, and then writes the return value back to the stub. In the Java 2 SDK implementation of RMI, the new wire protocol has made skeleton classes obsolete. RMI uses reflection to make the connection to the remote service object. You only have to worry about skeleton classes and objects in JDK 1.1 and JDK 1.1 compatible system implementations. Remote Reference Layer The Remote Reference Layers defines and supports the invocation semantics of the RMI connection. This layer provides a RemoteRef object that represents the link to the remote service implementation object. The stub objects use the invoke() method in RemoteRef to forward the method call. The RemoteRef object understands the invocation semantics for remote services. The JDK 1.1 implementation of RMI provides only one way for clients to connect to remote service implementations: a unicast, point-to-point connection. Before a client can use a remote service, the remote service must be instantiated on the server and exported to the RMI system. (If it is the primary service, it must also be named and registered in the RMI Registry). The Java 2 SDK implementation of RMI adds a new semantic for the client-server connection. In this version, RMI supports activatable remote objects. When a method call is made to the proxy for an activatable object, RMI determines if the remote service implementation object is dormant. If it is dormant, RMI will instantiate the object and restore its state from a disk file. Once an activatable object is in memory, it behaves just like JDK 1.1 remote service implementation objects. Other types of connection semantics are possible. For example, with multicast, a single proxy could send a method request to multiple implementations simultaneously and accept the first reply (this improves response time and possibly improves availability). In the future, Sun may

vinod vaze

QB on IT for TY BSc. (IT)

add additional invocation semantics to RMI.

Transport Layer The Transport Layer makes the connection between JVMs. All connections are stream-based network connections that use TCP/IP. Even if two JVMs are running on the same physical computer, they connect through their host computer's TCP/IP network protocol stack. (This is why you must have an operational TCP/IP configuration on your computer to run the Exercises in this course). The following diagram shows the unfettered use of TCP/IP connections between JVMs.

As you know, TCP/IP provides a persistent, stream-based connection between two machines based on an IP address and port number at each end. Usually a DNS name is used instead of an IP address; this means you could talk about a TCP/IP connection between flicka.magelang.com: 3452 and rosa.jguru.com: 4432. In the current release of RMI, TCP/IP connections are used as the foundation for all machine-to-machine connections. On top of TCP/IP, RMI uses a wire level protocol called Java Remote Method Protocol (JRMP). JRMP is a proprietary, stream-based protocol that is only partially specified is now in two versions. The first version was released with the JDK 1.1 version of RMI and required the use of Skeleton classes on the server. The second version was released with the Java 2 SDK. It has been optimized for performance and does not require skeleton classes. (Note that some alternate implementations, such as BEA Web logic and Ninja do not use JRMP, but instead use their own wire level protocol. ObjectSpace's Voyager does recognize JRMP and will interoperate with RMI at the wire level.) Some other changes with the Java 2 SDK are that RMI service interfaces are not required to extend from java.rmi.Remote and their service methods do not necessarily throw

vinod vaze

QB on IT for TY BSc. (IT)

RemoteException. 4 704 RMI How does RMI overcome the issues arising due to firewalls? Explain in detail. (November 2004) Ans: Firewall Issues Firewalls are inevitably encountered by any networked enterprise application that has to operate beyond the sheltering confines of an Intranet. Typically, firewalls block all network traffic, with the exception of those intended for certain "well-known" ports. Since the RMI transport layer opens dynamic socket connections between the client and the server to facilitate communication, the JRMP traffic is typically blocked by most firewall implementations. But luckily, the RMI designers had anticipated this problem, and a solution is provided by the RMI transport layer itself. To get across firewalls, RMI makes use of HTTP tunneling by encapsulating the RMI calls within an HTTP POST request. Now, examine how HTTP tunneling of RMI traffic works by taking a closer look at the possible scenarios: the RMI client, the server, or both can be operating from behind a firewall. The following diagram shows the scenario where an RMI client located behind a firewall communicates with an external server.

In the above scenario, when the transport layer tries to establish a

vinod vaze

QB on IT for TY BSc. (IT)

connection with the server, it is blocked by the firewall. When this happens, the RMI transport layer automatically retries by encapsulating the JRMP call data within an HTTP POST request. The HTTP POST header for the call is in the form: http://hostname: port If a client is behind a firewall, it is important that you also set the system property http.proxyHost appropriately. Since almost all firewalls recognize the HTTP protocol, the specified proxy server should be able to forward the call directly to the port on which the remote server is listening on the outside. Once the HTTP-encapsulated JRMP data is received at the server, it is automatically decoded and dispatched by the RMI transport layer. The reply is then sent back to client as HTTP-encapsulated data. The following diagram shows the scenario when both the RMI client and server are behind firewalls, or when the client proxy server can forward data only to the well-known HTTP port 80 at the server.

In this case, the RMI transport layer uses one additional level of indirection! This is because the client can no longer send the HTTPencapsulated JRMP calls to arbitrary ports as the server is also behind a firewall. Instead, the RMI transport layer places JRMP call inside the HTTP packets and send those packets to port 80 of the server. The HTTP POST header is now in the form http://hostname: 80/cgi-bin/java-rmi?forward=<port> This causes the execution of the CGI script, java-rmi.cgi, which in turn vinod vaze

QB on IT for TY BSc. (IT)

invokes a local JVM, unbundles the HTTP packet, and forwards the call to the server process on the designated port. RMI JRMP-based replies from the server are sent back as HTTP REPLY packets to the originating client port where RMI again unbundles the information and sends it to the appropriate RMI stub. Of course, for this to work, the java-rmi.cgi script, which is included within the standard JDK 1.1 or Java 2 platform distribution, must be preconfigured with the path of the Java interpreter and located within the web server's cgi-bin directory. It is also equally important for the RMI server to specify the host's fully-qualified domain name via a system property upon startup to avoid any DNS resolution problems, as: java.rmi.server.hostname=host.domain.com Note: Rather than making use of CGI script for the call forwarding, it is more efficient to use a servlet implementation of the same. You should be able to obtain the servlet's source code from Sun's RMI FAQ. It should be noted that notwithstanding the built-in mechanism for overcoming firewalls, RMI suffers a significant performance degradation imposed by HTTP tunneling. There are other disadvantages to using HTTP tunneling too. For instance, your RMI application will no longer be able to multiplex JRMP calls on a single connection, since it would now follow a discrete request/response protocol. Additionally, using the javarmi.cgi script exposes a fairly large security loophole on your server machine, as now; the script can redirect any incoming request to any port, completely bypassing your firewalling mechanism. Developers should also note that using HTTP tunneling precludes RMI applications from using callbacks, which in itself could be a major design constraint. Consequently, if a client detects a firewall, it can always disable the default HTTP tunneling feature by setting the property: RMI 705 Write the programs for the following using RMI: i To invoke a remote method to find length of a string. ii. To invoke a remote method to for changing the case of letters in a given string. (May 2005) Ans: 1] To invoke a remote method to find length of a string :-

vinod vaze

QB on IT for TY BSc. (IT) Import java.io. *; Import java.net.*; Class echo Client { Public static void main(String args[]) { Int port=9999; Socket s; String msg=; Try { Buffer reader br=new buffered reader (new input Stream Reader(System. in)); InetAddress Addr=InetAddress.getByName(nul); S=new Socket(add.port); Output streamWriter osw=new Output streamWriter( s.getOutputStream()); PrintWrite pw=new PrintWriter(osw); Buffer reader br 1=new Buffer reader (new input Stream Reader( s.getinputStream()); String str=br.readline(); Pw.println(str); Pe.flush(); Msg=br1.readline(); System.out.printline(Answer from Server+msg); } } Catch(Exception e) {} } }

2] To invoke a remote method to for changing the case of letters in a given string. (May 2005): Import java.io.*; Import java.net.*; Class case Client { Public static viod main(String args[])

vinod vaze

QB on IT for TY BSc. (IT) { Int port=9999; Socket s; String msg=; Try { Buffer reader br=new buffered reader(new input Stream Reader(System.in)); InetAddress Addr=InetAddress.getByName(nul); S=new Socket(add,port); Output streamWriter osw=new Output streamWriter( s.getOutputStream()); PrintWrite pw=new PrintWriter(osw); Buffer reader br 1=new Buffer reader (new input Stream Reader( s.getinputStream()); String str=br.readline(); Pw.println(str); Pe.flush(); Msg=br1.readline(); System.out.printline(Answer from Server+msg); } } Catch(Exception e) {} } } 706 RMI What are the different types of parameters in RMI? How are they passed between java virtual machines? (October 2005), (May 2006) Ans: Parameters in RMI 4 Primitive parameters - When a primitive data type is passed as a parameter to a remote method, the RMI system passes it by value. RMI will make a copy of a primitive data type and send it to the remote method. If a method returns a primitive data type, it is also returned to the calling JVM by value. Object Parameters - When an object is passed to a remote method, the

vinod vaze

QB on IT for TY BSc. (IT) semantics change from the case of the single JVM. RMI sends the object itself, not the reference of object. It is the object that is passed by value, nor the reference to the object. Similarly when a remote method returns an object, a copy of the whole object is returned to the calling program. RMI uses a technology called Object Serialization to transform an object into a linear format that can then be sent over the network wire. Remote Object Parameters - A client program can obtain a reference to a remote object through the RMI registry program. Another way a client can obtain a remote reference RMI 707 Explain in detail the steps involved in building a RMI system. (October 2005) Ans: Assuming that the RMI system is already designed, you take the following steps to build a system: 1. Write and compile Java code for interfaces 2. Write and compile Java code for implementation classes 3. Generate Stub and Skeleton class files from the implementation classes 4. Write Java code for a remote service host program 5. Develop Java code for RMI client program 6. Install and run RMI system rmiIntf.java : import java.rmi.*; interface rmiIntf extends Remote { int add(int a, int b ) throws RemoteException; } rmiServerImpl.java : import java.rmi.*; import java.rmi.server.*; public class rmiServerImpl extends Unicast RemoteObject implements rmiServerIntf { rmiServerImpl()throws RemoteException {

vinod vaze

QB on IT for TY BSc. (IT) } Public int add(int a, int b ) throws RemoteException { Return a+b; } } rmiServer.java : import java.rmi.*; import java.net.*; public class rmiServer { Public static viod main(String args[]) { Try { rmiServerImpl adsi=new rmiServerImpl(); Naming.rebind(Server,adsi); } Catch(Exception e) {} } } rmiClient.java : import java.rmi.*; public class rmiClient extends Applet { Public static viod main(String args[]) { rmiIntf=(rmiIntf)Naming.lookup(Server); System.out printline(Addition:+rif.add(5,4)); } } RMI 708 What are the components required to build a working RMI system? (May 2006) Ans:It is now time to build a working RMI system and get hands-on 8

vinod vaze

QB on IT for TY BSc. (IT)

experience. In this section, you will build a simple remote calculator service and use it from a client program. A working RMI system is composed of several parts. Interface definitions for the remote services Implementations of the remote services Stub and Skeleton files A server to host the remote services An RMI Naming service that allows clients to find the remote services A class file provider (an HTTP or FTP server) A client program that needs the remote services In the next sections, you will build a simple RMI system in a step-by-step fashion. You are encouraged to create a fresh subdirectory on your computer and create these files as you read the text.

To simplify things, you will use a single directory for the client and server code. By running the client and the server out of the same directory, you will not have to set up an HTTP or FTP server to provide the class files. (Details about how to use HTTP and FTP servers as class file providers will be covered in the section on Distributing and Installing RMI Software) Assuming that the RMI system is already designed, you take the following steps to build a system: 7. Write and compile Java code for interfaces 8. Write and compile Java code for implementation classes 9. Generate Stub and Skeleton class files from the implementation classes 10. Write Java code for a remote service host program 11. Develop Java code for RMI client program 12. Install and run RMI system Practical No. 1: 709 Write two programs: 1. DatagramSender.java and 2. DatagramReceiver.java Using Datagram Socket and Datagram Packet in which DatagramSender.Java transmits a datagram and DatagramReceiver.Java executes an infinite loop to receive and 8

vinod vaze

QB on IT for TY BSc. (IT) display datagrams (May 2004) Ans : //DatagramSender import java.net.*; class DatagramSender { public static void main(String args[]) { try { InetAddress ia=InetAddress.getByName(args[0]); Int port = Integer.parseInt(args[1]); DatagramSocket ds = new DatagramSocket(); Byte buffer[] = args[2].getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, port); ds.send(dp); } catch(Exception e) { e.printStackTrace(); } } } //DatagramReceiver import java.net.*; classDatagramReceiver { private final static int BUFSIZE = 20; public static void main(String args[) { try { int port = Integer.parseInt(args[0]); DatagramSocket ds = new DatagramSocket(port); byte buffer[] = new byte[BUFSIZE]; while(true) { DatagramPacket dp = new DatagramPacket(buffer, buffer.length); ds.receive(dp); String str = new String(dp.getData()); System.out.println(sr); } }

vinod vaze

QB on IT for TY BSc. (IT) catch(Exception e) { e.printStackTrace(); } } } Q 2 : Write a Client/Server application where a client contacts the server to cote in a random integer. Use Socket and Serve Socket. (May 2004) Ans : ServerSocket import java.io.*; import java.net.*; import java.util.*; class ServerSocket { public static void main(String args[]) { try { int port = Integer.parseInt(args[0]); Random random = new Random(); ServerSocket ss = new ServerSocket(port); while(true) { Socket s = ss.accept(); OutputStream os = s.getOutputStream(); DataOutputStream dos = new DataOutputStream(os); dos.writeInt(random.nextInt()); s.close(); } } catch(Exception e) { System.out.println(Excpetion : + e); } } } Socket import java.io.*; import java.net.*;

vinod vaze

QB on IT for TY BSc. (IT) class Socket { public static void main(String args[]) { try { String server = args[0]; int port = Integer.parseInt(args[1]); Socket s = new Socket(server, port); InputStream is = s.getInputStream() DataInputStream dis = new DataInputStream(is); int i = dis.readInt(); System.out.println(i); s.close() } catch(Exception e) { System.out.println(Exception : + e); } } } Q3 : Write a program that prints the Internet Address of the local host if we do Not specify and command line parameters or all Internet addresses of another host if we specify the host name on the command line, (November 2004) Ans : import java .net.*; class InetAddress { public static void main(String args[]) { try { InetAdress ias[] = InetAdress.getAllByName(args[0]); for(int i =0; i < ias.length; i++) { System.out.println(ias[i].getHostName()); System.out.println(ias[i].gethostAddress()); byte bytes[] = ias[i].getAddress(); for(int j=0; j<bytes.length; j++)

vinod vaze

QB on IT for TY BSc. (IT) { if(j>0) System.out.print(.); if(bytes[j]>=0) System.out.print(bytes[j]); else System.out.print(bytes[j] + 256); } System.out.println(); } } catch(Exception e) { e.printStackTrace(); } } } Q 4. Write a program that constructs a Socket object to connect to the host port using TCP, Once the connection is established, a message Connection established must be pirated, and the connection must be closed, Handle the errors with appropriate messages (November 2004) Ans : program import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; public class SimpleSocketCreate { public static void main(String[] args) { String host = localhost; int port = 4000; try { System.out.println(Attempting to connect to a TCP service on + host + : + port + ); Socket socket = new Socket(host, port); System.out.println(Connection established !); } catch(UnknownHostException e) { System.err.println(Could not resolve host name : e.getMessage());

vinod vaze

QB on IT for TY BSc. (IT) } catch(IOException e) { System.err.println(A communication error occurred : + e.getClass().getName() + : + e.getMessage(); } catch(SecurityException e) { System.err.println(The security manager refused permission to + conncet to the remote TCP service : + e.getMessage()); } } } Q5 : Write a client/server program for the following: A client reads a line from its standard input (keyboard) and sends the line out its socket to the server. The server reads a line from its connection socket. The server converts the line to uppercase. The server sends the modified line out its connection socket to the client. The client reads the modified line from its socket and prints the line on its standard output (monitor) (November 2004) Ans : //TCPClient import java.io.*; import java.net.*; class TCPClient { public static void main(String argv[]) throws Exception { String sentences; String modifidSentence; BufferedReader inFronUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket(hostname, 6789); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFormServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

vinod vaze

QB on IT for TY BSc. (IT) Sentence = inFromUser.readLine(); outToServer.writeBytes(sentence + \n); modifiedSentence = inFromServer.readLine(); System.out.println(FROM SERVER : + modifiedSentence); clientSocket.close(); } } //TCPServer import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; String capitalizedSentence; ServerSocket welcomeSocket = new ServerSocket(6789); while(true) { Socket connectionSocket = welcomeSocket.accept() BufferedReader inFromClient = new BufferedReader(new InputStreamReader(conectionSocket.getInputStream())); DataOutputStream outToClient = new DataOutputStream( connectionSocket.getOutputStream()); clientSentence = inFromClient.readLine(); capitalizedSentence = clientSentence.toUpperCase() + \n; outToClient.writebytes(capitalizedSentence); } } } Q:6 : Write the code for the following. The server program should create and bind to a socket, at a well known Port and listen for client connections. Once it receives data from a Client, it should echo this back to the client and close the connection. (May 2005) Ans : //smtpClient import java.io.*; import java.net.*; public class smtpClient

vinod vaze

QB on IT for TY BSc. (IT) { public static void main(String[] args) { Socket smtpSocket = null; DataOutputStream os = null; DataInputStream is = null; try { smtpSocket = new Socket(hostname, 25); os = new DataOutputStream(smtpSocket.getOutputStream()); is = new DatInputStream(smtpSocket.getInputStream()); } catch(UnknownHostException e) { System.err.println(Dont know about host: hostname); } catch(IOException e) { System.err.println(Couldnt get I/O for the connection to : hostname); } if(smtpSocket!=null && os!=null && is!=null) { try { os.writeBytes(HELLO\n); os.writeBytes(RCPT To:k3is@yahoo.com\n); os.writeBytes(MAIL From:k2is@yahoo.com\n); os.writeBytes(DATA\n); os.writeBytes(From:k3is@yahoo.com\n); os.writeBytes(Subject: testing\n); os.writeBytes(Hi there\n); os.writeBytes(\n.\n); String responseLine; while((responseLine = is.readLine() != null) { System.out.println(Server: + responseLine); if(responseLine.indexOf(Ok) != 1) { break; } } os.close(); is.close() smtpSocket.close(); } catch(UnknownHostException e)

vinod vaze

QB on IT for TY BSc. (IT) { System.err.println(Trying to connect to unknown host: + e); } catch(IOException e) { System.err.println(IOException: + e); } } } } //EchoServer import java.io.*; import java.net.*; public class Echo { public static void main(String args[]) { ServerSocket echoServer = null; String line; DataInputStream is; PrintStream os; Socket clientSocket = null; try { echoServer = new ServerSocket(9999); } catch(IOException e) { System.out.println(e); } try { clientSocket = echoServer.accept(); is = new DataInputStream(clientSocket.getInputStream()); os = new PrintStream(clientSocket.getOutputStream()); while(true) { line = is.readLine(); os.println(line); } } catch(IOException e) { System.out.println(e); } }

vinod vaze

QB on IT for TY BSc. (IT) }

800 801

CORBA What is an Object Adapter as defined in CORBA specification? Ans: Object Adapters The CORBA specification defines the concept of an object adapter. An object adapter is a framework for implementing CORBA objects. It provides an API that object implementations use for various low level services. According to the CORBA specification, an object adapter is responsible for the following functions: Generation and interpretation of object references Method invocation Security of interactions Object and implementation activation and deactivation Mapping object references to the corresponding implementations Registration of implementations 8

object

The architecture supports the definition of many kinds of object adapters. The specification includes the definition of the basic object adapter (BOA). In the previous section, you saw some server code that uses the services of VisiBroker's implementation of the BOA. The BOA has been implemented in various CORBA products. Unfortunately, since the specification of the BOA was not complete, the various BOA implementations differ in some significant ways. This has compromised server portability. To address this shortcoming, an entirely new object adapter was added, the portable object adapter (POA). Unfortunately, the POA is not yet supported in many products. In any event, the BOA and the POA are described here. Activation on Demand by the Basic Object Adapter (BOA) One of the main tasks of the BOA is to support on-demand object activation. When a client issues a request, the BOA determines if the

vinod vaze

QB on IT for TY BSc. (IT) object is currently running and if so, it delivers the request to the object. If the object is not running, the BOA activates the object and then delivers the request. The BOA defines four different models for object activation: Shared server Multiple active objects share the same server. The server services requests from multiple clients. The server remains active until it is deactivated or exits. Unshared server Only one object is active in the server. The server exits when the client that caused its activation exits. Server-per-method Each request results in the creation of a server. The server exits when the method completes. Persistent server The server is started by an entity other than the BOA (you, operating services, etc.). Multiple active objects share the server. Portable Object Adapter (POA) According to the specification, "The intent of the POA, as its name suggests, is to provide an object adapter that can be used with multiple ORB implementations with a minimum of rewriting needed to deal with different vendors' implementations." However, most CORBA products do not yet support the POA. The POA is also intended to allow persistent objects -- at least, from the client's perspective. That is, as far as the client is concerned, these objects are always alive, and maintain data values stored in them, even though physically, the server may have been restarted many times, or the implementation may be provided by many different object implementations. The POA allows the object implementor a lot more control. Previously, the implementation of the object was responsible only for the code that is executed in response to method requests. Now, additionally, the implementor has more control over the object's identity, state, storage, and lifecycle. The POA has support for many other features, including the following: Transparent object activation Multiple simultaneous object identities Transient objects Object ID namespaces Policies including multithreading, security, and object management Multiple distinct POAs in a single server with different policies and

vinod vaze

QB on IT for TY BSc. (IT) namespaces For more detail on the POA, please see the specification. A word on multithreading. Each POA has a threading policy that determines how that particular POA instance will deal with multiple simultaneous requests. In the single thread model, all requests are processed one at a time. The underlying object implementations can therefore be lazy and thread-unsafe. Of course, this can lead to performance problems. In the alternate ORB-controlled model, the ORB is responsible for creating and allocating threads and sending requests in to the object implementations efficiently. The programmer doesn't need to worry about thread management issues; however, the programmer definitely has to make sure the objects are all thread-safe. 802 CORBA Explain the CORBA architecture. Discuss the advantages of the applications built using Common Object Request BrokerArchitecture (October 2005) Ans: CORBA Architecture CORBA defines an architecture for distributed objects. The basic CORBA paradigm is that of a request for services of a distributed object. Everything else defined by the OMG is in terms of this basic paradigm. The services that an object provides are given by its interface. Interfaces are defined in OMG's Interface Definition Language (IDL). Distributed objects are identified by object references, which are typed by IDL interfaces. The figure below graphically depicts a request. A client holds an object reference to a distributed object. The object reference is typed by an interface. In the figure below the object reference is typed by the Rabbit interface. The Object Request Broker, or ORB, delivers the request to the object and returns any results to the client. In the figure, a jump request returns an object reference typed by the AnotherObject interface. Object Request BrokerArchitecture:The Object Request Broker (ORB) is the CORBA software product that is used when constructing distributed application components. The ORBs primary responsibility is to facilitate the creation and transmission of request and reply messages that occur between clients and object.

vinod vaze

QB on IT for TY BSc. (IT) 8 803 CORBA Enumerate the benefits of distributed applications built using CORBA Architecture (May 2004) Ans:Distributed Applications CORBA products provide a framework for the development and execution of distributed applications. But why would one want to develop a distributed application in the first place? As you will see later, distribution introduces a whole new set of difficult issues. However, sometimes there is no choice; some applications by their very nature are distributed across multiple computers because of one or more of the following reasons: The data used by the application are distributed The computation is distributed The users of the application are distributed

Data are Distributed Some applications must execute on multiple computers because the data that the application must access exist on multiple computers for administrative and ownership reasons. The owner may permit the data to be accessed remotely but not stored locally. Or perhaps the data cannot be co-located and must exist on multiple heterogeneous systems for historical reasons. Computation is Distributed Some applications execute on multiple computers in order to take advantage of multiple processors computing in parallel to solve some problem. Other applications may execute on multiple computers in order to take advantage of some unique feature of a particular system. Distributed applications can take advantage of the scalability and heterogeneity of the distributed system. Users are Distributed Some applications execute on multiple computers because users of the application communicate and interact with each other via the application. Each user executes a piece of the distributed application on his or her computer, and shared objects, typically execute on one or more servers. A typical architecture for this kind of application is illustrated below.

vinod vaze

QB on IT for TY BSc. (IT) Prior to designing a distributed application, it is essential to understand some of the fundamental realities of the distributed system on which it will execute. 804 CORBA 805 CORBA 806 CORBA

900 Wireless LAN 901 What are the Restrictions and potential problems with WLAN? Ans: Radio signal interference Radio signal interference in WLAN systems can go two ways: The WLAN can cause interference to other devices operating in or near its frequency band. Or conversely, other devices can interfere with WLAN operation, provided their signal is stronger. The result is a scrambled signal, which of course prevents the nodes from exchanging information between each other or access points. WLANs using infrared technology generally experience line-of-sight problems. An object blocking this line between the two WLAN units is very likely to interrupt the transmission of data. Connection problem TCP/IP provides reliable connection over wired LANs, but in WLAN it is susceptible to losing connections, especially when the terminal is operating within the marginal WLAN coverage. Another connection related issue is IP addressing. The wireless terminals can roam between access points in the same IP subnet but connections are lost if the terminal moves from one IP subnet to another. Network security This is an important aspect in WLAN. It is difficult to restrict access to a WLAN physically, because radio signals can propagate outside the

vinod vaze

QB on IT for TY BSc. (IT) intended coverage of a specific WLAN, for example an office building. Some security measures against the problem are using encryption, access control lists on the access points and network identifier codes. The technical operation of WLANs also works against the intruder: Frequency hopping and direct sequence operation makes eavesdropping impossible for everyone else than the most sophisticated. 902 Explain data transfer in WLAN using Infrared technology Ans.: DEFINITON: -Wireless LAN stands for Wireless Local Area Network. It is a flexible data communications system implemented to extend or substitute for, a wired LAN. Radio frequency (RF) technology is used by a wireless LAN to transmit and receive data over the air, minimizing the need for wired connections. A WLAN enables data connectivity and user mobility. WORKING OF WLAN 1. WLANs use radio, infrared and microwave transmission to transmit data from one point to another without cables. 2. Therefore WLAN offers way to build a Local Area Network without cables. This WLAN can then be attached to an already existing larger network, EX:INTERNET 3. A wireless LAN consists of nodes and access points. A node is a computer or a peripheral (such as a printer) that has a network adapter, in WLANs case with an antenna. Access points function as transmitters and receivers between the nodes themselves or between the nodes and another network. WLAN data transfer in itself is implemented by one of the following technologies: 1. 2. Frequency Hopping Spread Spectrum (FHSS) Direct Sequence Spread Spectrum (DSSS) 4. Infrared (IR)

DATA TRANSFER IN WLAN USING INFRARED:1. Infrared (IR) systems use very high frequencies, just below visible light in the electromagnetic spectrum, to carry data. 2. Like light, IR cannot penetrate opaque objects; it is either directed (line-of-sight) or diffuse technology. 3. Inexpensive directed systems provide very limited range (3 ft) and

vinod vaze

QB on IT for TY BSc. (IT) are occasionally used in specific WLAN applications. 4. High performance directed IR is impractical for mobile users and is therefore used only to implement fixed subnetworks. Diffuse (or reflective) IR WLAN systems do not require line-of-sight, but cells are limited to individual rooms.

vinod vaze

QB on IT for TY BSc. (IT)

903 Enumerate the benefits of Wireless LAN (November 2004) & (May 2005) The popularity of wireless LANs is a testament primarily to their convenience, cost efficiency, and ease of integration with other networks and network components. The majority of computers sold to consumers today come pre-equipped with all necessary wireless LAN technology. The benefits of wireless LANs include: 1. Convenience: The wireless nature of such networks allows users to access network resources from nearly any convenient location within their primary networking environment (home or office). With the increasing saturation of laptop-style computers, this is particularly relevant. 2. Mobility: With the emergence of public wireless networks, users can access the internet even outside their normal work environment. Most chain coffee shops, for example, offer their customers a wireless connection to the internet at little or no cost. 3. Productivity: Users connected to a wireless network can maintain a nearly constant affiliation with their desired network as they move from place to place. For a business, this implies that an employee can potentially be more productive as his or her work can be accomplished from any convenient location. 4. Deployment: Initial setup of an infrastructure-based wireless network requires little more than a single access point. Wired networks, on the other hand, have the additional cost and complexity of actual physical cables being run to numerous locations (which can even be impossible for hard-to-reach locations within a building). 5. Expandability: Wireless networks can serve a suddenly-increased number of clients with the existing equipment. In a wired network, additional clients would require additional wiring. 6. Cost: Wireless networking hardware is at worst a modest increase from wired counterparts. This potentially increased cost is almost always more than outweighed by the savings in cost and labor associated to running physical cables. 904 What are the components necessary for implementing WLAN? Explain. (May 2004) Ans :

vinod vaze

QB on IT for TY BSc. (IT) Components necessary for a WLAN The list of components necessary for a WLAN is surprisingly short. Only wireless network interface cards and access points are needed for communication to take place. Wireless NIC: It performs the same functions as a wired NIC with one major exception: there is no port for a twisted pair wire or coax cable connection to the network. Instead, in its place is an antenna to send and receive radio frequency signals. Access Points (AP): It is a device that contains a radio transceiver (to send and receive signals) along with an RJ45 wired network interface, which allows it to connect by cable to a standard wired network. An access point has two basic functions. First, the access point acts as the base station for the wireless network. All the devices that have a wireless NIC transmit to the AP, which in turn redirects the signal to the other wireless devices. The second function of an AP is to act as a link between the wireless and wired networks. The AP can be connected to the standard network by a cable, allowing the wireless devices to access the network data. The range of an access point acting as the base station is approximately 115 meters (375 feet) in a typical office environment. The number of users a signal access point can support varies, but is generally over 100.

vinod vaze

QB on IT for TY BSc. (IT)

905 State and explain the uses of WLAN. (May 2004) Ans : Uses of WLAN Hospital applications using wireless LAN capable handheld or notebook computers deliver patient information instantly and securely to doctors and nurses. Small workgroups and audit teams can increase productivity due to quick network setup. Students, professors, and staff at universities, corporate training centers, and other schools can access the Internet, the college catalog, and actual course content. Network managers can use wireless LANs to reduce the overhead caused by moves, extensions to networks, and other changes. Installing networked computers in older buildings becomes easier by using wireless LAN as a cost effective network infrastructure solution Preconfigured wireless LAN setups need no local computer support and make trade show and branch office setups simple. Wireless LAN in warehouses can be used to retrieve and updated information on centralized databases, thereby increasing productivity. Network managers, senior executives, and line managers can make quicker decisions because they have real-time information at their fingertips

906 Compare wired LAN and wireless LAN (May 2004) Ans : 1 2 3 4 5 6 7 Wired LAN Wired LAN doesnt provide mobility. Range of coverage is less. Not easy to Use. Installation speed is less Simplicity is less Less Flexible Scalability is less. Wireless LAN Wireless LAN provides mobility. Range of coverage is more. Easy to use Installation speed is more. Simplicity is more More Flexible. Scalability is more.

vinod vaze

QB on IT for TY BSc. (IT)

907 Explain the setup of Adhoc network. (May 2004) Ans : Adhoc network (Distributed control): The Adhoc network (also called peer-to-peer mode) is simply a set of WLAN wireless stations that communicate directly with one another without using access point or any connection to the wired network. For example, this adhoc network can be formed by two laptops with a network interface card. There is no central controller; mobile terminals can communicate using peer-to-peer connections with other terminals independently. The network may still include a gateway node to create an interface with a fixed network. As an example this kind of setups might be very useful in a meeting where employees bring laptop computers together to communicate and share information even when the network is not provided by the company. Or an adhoc network could be set up in a hotel room or in the airport or where the access to the wired network is barred. 908 Wireless LAN (IEEE 802.11b) IrDA (Infra Red Data Association Standard) HomeRF (Home Radio Frequency)

Bluetooth: Bluetooth is a short range radio technology that allow virtually any digital devices telecommunications, personal computing, networking, automotive, consumer electronic to communicate without wrestling with numerous cords or cables. It employs radio frequencies in the 2.42.5GHz band the so called industrial, scientific, and medical (ISM) band, which is open for public use. The hardware required for Bluetooth is very small in size and power consumption. This comes with different interfaces, like a PCMCIA card, USB connector (in which case it is called Wireless USB). Hence it is easy to connect to any Table PC. Features of Bluetooth: Speed: 721 Mbps Scalability: Easy to expand and includes new devices Flexibility: Instant network, conference anywhere. Security: Identification for each Bluetooth device is unique. Low cost of Ownership: No wires, lower cost The first generation of the technology delivers performance up to 1 Mbps with data transfer rate at around 721 Kbps. Subsequent versions may carry anywhere from 2 Mbps to 12 Mbps of throughput. Bluetooth does

vinod vaze

QB on IT for TY BSc. (IT) not require a line-of-sight to work. Therefore, a Bluetooth mobile phone can link to a laptop while the later device is sitting in a briefcase. Bluetooth is meant for use in a PAN (Personal Area Network) standard to connect peripherals to a computer. The distances covered are 10100m depending on the version. It is more useful in the case of self-detecting devices that move in and out of range. Advantages of Bluetooth: Low power consumption. Secure, as each Bluetooth product has a unique identification. Flexible in adding new devices, hence good for later additions to the system. Does not require lineofsight. Low cost. Disadvantages of Bluetooth: Low speed for our application. Need to develop interface to browser from port. Not widely used with PC to PC communication. Difficult to develop and deploy. IrDA: IrDA is a standard defined by the Infrared Data Association. It specifies a way to transfer data using infrared radiation. The IrDA specifications include standards for both the physical devices and the protocols they use to communicate with each other. IrDA devices communicate using infrared LEDs. Wavelength used is 875 mm + or production tolerance (around 30 nm). The best speed for IrDA v 1,0 are in the range of range from 2.4 to 115.2 Kbps. Features: Speed: 115.2 kbps, diffused IrDA gives lower speed. Scalability: Cannot scale easily to communicate with multiple hosts. Flexibility: Instant network, conference anywhere. Security: Lineofsight (also diffused), cannot penetrate walls. Low cost of Ownership: No wires, lower cost. The main attraction of IrDA is that it remains within the walls of the dentists office and hence is more secure. The main requirement here is vinod vaze

QB on IT for TY BSc. (IT) to have diffused IrDA, in order to use it in our application. There are very few diffused IrDA products in the market and diffusion further reduces the speed supported. Advantages: Secure, does not penetrate walls. Can easily communicate with peripheral devices, like printers. Low cost and can be used to transfer information from the Tablet PC to another PC Disadvantages: Low speed. Line-of-sight required, diffused IrDA available, but not very popular. Very small range of coverage. Generally used for communication with peripherals and not for networking PCs.

vinod vaze

QB on IT for TY BSc. (IT)

909 What are the restrictions and potential problems with WLAN (November 2004) & (May 2005) Ans : Radio signal interference Radio signal interference in WLAN systems can go two ways: The WLAN can cause interference to other devices operating in or near its frequency band. Or conversely, other devices can interfere with WLAN operation, provided their signal is stronger. The result is a scrambled signal, which of course prevents the nodes from exchanging information between each other or access points. WLANs using infrared technology generally experience line-of-sight problems. An object blocking this line between the two WLAN units is very likely to interrupt the transmission of data. Connection problem TCP/IP provides reliable connection over wired LANs, but in WLAN it is susceptible to losing connections, especially when the terminal is operating within the marginal WLAN coverage. Another connection related issue is IP addressing. The wireless terminals can roam between access points in the same IP subnet but connections are lost if the terminal moves from one IP subnet to another. Network security This is an important aspect in WLAN. It is difficult to restrict access to a WLAN physically, because radio signals can propagate outside the intended coverage of a specific WLAN, for example an office building. Some security measures against the problem are using encryption, access control lists on the access points and network identifier codes. The technical operation of WLANs also works against the intruder: Frequency hopping and direct sequence operation makes eavesdropping impossible for everyone else than the most sophisticated. Ans : Infrared (IR) systems use very high frequencies, just below visible 910 light in the electromagnetic spectrum, to carry data. Like light, IR cannot penetrate opaque objects; it is either directed (line-of-sight) or diffuse technology. Inexpensive directed systems provide very limited range (3 ft) and are occasionally used in specific WLAN applications. High Diffuse (or reflective) IR WLAN systems do not require line-of-sight, but cells are limited to individual rooms. Wireless infrared transmits data using infrared (IR) light, IR shares many of the same properties as visible light: It travels in straight lines, and it does not penetrate physical objects such as walls and ceilings. Because

vinod vaze

QB on IT for TY BSc. (IT) the availability of infrared light is limitless, data transmission using IR do not have to be regulated like that of other wireless technologies. Another advantage of infrared is that it is secure. Because IR does not penetrate through walls, the signals stays confined inside the room and eliminates unauthorized eavesdropping. Also, the components needed or infrared transmissions are small and consume little power. Infrared wireless transmission can be either directed or diffused. A directed transmission requires that the emitter and detector be aimed directly at one another. The emitter sends a narrowly focused beam of infrared light to the detector, which has a small receiving or viewing area. Directed infrared is commonly used in WANs. A diffused transmission, on other hand, relies on reflected light. Emitters on diffused infrared transmission have a wide focused beam that is pointed at the ceiling of a room and uses it as the reflection point. When the emitter transmits an infrared signal, it bounces off the ceiling and fills the room with t he signal. The detectors are also pointed at the same reflection point and can detect the reflected signal. LANs typically use diffused infrared transmission.

911 Explain the setup of Infrastructure LAN. (May 2005) Ans : Setup of Infrastructure LAN The infrastructure LAN network consists of an arbitrary number of mobile terminals in addition to access points. The access points are located between mobile terminals and the fixed network. All data transmission is controlled and conveyed by the access points and they are also responsible for sharing resources between terminals. The range of an access point using radio frequencies is roughly 100 meters. The range varies widely with the geometry and other physical properties of the space in which it is used. 912 Explain the different technologies to implement data transfer in case of WLAN. (May 2005) Ans : WLAN data transfer in itself is implemented by one of the following technologies: Frequency Hopping Spread Spectrum (FHSS)

vinod vaze

QB on IT for TY BSc. (IT) Direct Sequence Spread Spectrum (DSSS) Infrared (IR)

Frequency Hopping Spread Spectrum (FHSS) Frequency Hopping Spread Spectrum (FHSS) uses a narrowband carrier that changes frequency in a pattern known to both transmitter and receiver. Properly synchronized, the net reflect is to maintain a single logical channel. To an unintended receiver, FHSS appears to be short duration impulse noise. Frequency hopping is the simpler of two spread-spectrum techniques. A frequency synthesizer is used to generate a carrier in the ordinary way. There is one difference, however: instead of operating at a fixed frequency, the synthesizer changes frequency many times per second according to a preprogrammed sequence of channels. This sequence is known as a pseudorandom noise (PN) sequence because, to an outside observer who has not been given the sequence, the transmitted frequency appears to hop about in a completely random and unpredictable fashion. In reality, the sequence is not random at all, and a receiver which has been programmed with the same sequence can easily follow the transmitter as it hops and the message can be decode normally. Since the frequency hopping signal typically spends only a few milliseconds or less on each channel, any interference to it from a signal on that frequency will be of short duration. If an analog modulation scheme is used for voice, the interference will appear as a click and may pass unnoticed. If the spread-spectrum signal is modulated using digital techniques, an error-correcting code can be employed that will allow these brief interruptions in the received signal to be ignored, and the user will probably not experience any signal degradation at all. Thus reliable communication can be achieved in spite of interference. Direct Sequence Spread Systems (DSSS) The direct sequence form of spread spectrum communication is commonly used with digital modulation schemes. The idea is to modulate the transmitter with a bit stream consisting of pseudorandom noise (PN) that has a much higher rate than the actual data to be communicated. The term pseudorandom means that the bit stream appears at first glance to be a random sequence of zeros and ones but is actually generated in such a way as to repeat exactly from time to time. The data to be transmitted is combined with the PN. One common technique is to invert all the bits of the PN stream during the time the real data is represented by a one and to leave the PN bit stream unchanged when a data zero is

vinod vaze

QB on IT for TY BSc. (IT) to be transmitted. The extra bits transmitted in this way are called chips, and resulting bit rate is known as the chipping rate. Most direct-sequence Spread-spectrum systems use a chipping rate at least ten times as great as the bit rate of the actual information to be transmitted. The use of the high speed PN sequence results in an increase in the bandwidth of the signal, regardless of what modulation scheme is used to encode the bits into the signal. For any given modulation scheme, the bandwidth is proportional to the bit rate. It follows from Hartleys Law that a directsequence system transmitting a total of ten bits for each information bit will use ten times as much bandwidth as a narrowband signal with the same type of modulation and the same information rate. That is, the sideband will expand ten times as far from the carrier. Direct-sequence spread-spectrum scheme typically use some form of phase shift keying (PSK). Infrared (IR) Infrared (IR) systems use very high frequencies, just below visible light in the electromagnetic spectrum, to carry data. Like light, IR cannot penetrate opaque objects; it is either directed (line-of-sight) or diffuse technology. Inexpensive directed systems provide very limited range (3 ft) and are occasionally used in specific WLAN applications. High performance directed IR is impractical for mobile users and is therefore used only to implement fixed subnet-works. Diffuse (or reflective) IR WLAN systems do not require line-of-sight, but cells are limited to individual rooms. Wireless infrared transmits data using infrared (IR) light, IR shares many of the same properties as visible light: It travels in straight lines, and it does not penetrate physical objects such as walls and ceilings. Because the availability of infrared light is limitless, data transmission using IR do not have to be regulated like that of other wireless technologies. Another advantage of infrared is that it is secure. Because IR does not penetrate through walls, the signals stays confined inside the room and eliminates unauthorized eavesdropping. Also, the components needed or infrared transmission are small and consume little power. Infrared wireless transmission can be either directed or diffused. A directed transmission requires that the emitter and detector be aimed directly at one another. The emitter sends a narrowly focused beam of infrared light to the detector, which has a small receiving or viewing area. Directed infrared is commonly used in WANs. A diffused transmission, on other hand, relies on reflected light. Emitters on diffused infrared transmission have a wide-focused beam that is pointed at the ceiling of a room and uses it as the reflection point. When

vinod vaze

QB on IT for TY BSc. (IT) the emitter transmits an infrared signal, it bounces off the ceiling and fills the room with t he signal. The detectors are also pointed at the same reflection point and can detect the reflected signal. LANs typically use diffused infrared transmission.

913 What are the different Wireless LAN standards? Compare the Standards based on their Application frequency range and Data rate. (October 2005) Ans : In July 1997, the IEEE published a standard for Wireless LAN. This standard is named 802.11, and in September 1999, they ratified the 802.11b (High rate) to the standard. IEEE 802.11 (FHSS) Frequency Hopping Spread Spectrum IEEE 802.11 (DSSS) Direct Sequence Spread Spectrum IEEE 802.11 (Infrared) ( 800 to 950 nm) IEEE 802.11a (OFDM) Orthogonal Frequency Division Multiplexing IEEE 802.11b HR DSSS) High Rate DSSS IEEE 802 (g) (OFDM) Achieves 22 or even 54 Mbps Application Wireless Ethernet Wireless AATM Wireless Ethernet IEEE 802.11 802.11 (a) 802.11 (b) 802.11(g) Technique FHSS DSSS OFDM DSSS-HR OFDM Band 2.4 GHz 2.4 GHz Infrared 5.725 GHz 2.4 GHz 2.4 GHz Modulation FSK PSK PPM PSK or QAM PSK /CCK Different Data Rate (Mbps) 1 and 2 1 and 2 1 and 2 6 to 54 5.5 and 11 22 and 54

FSK: Frequency Shift Keying PSK: Phase Shift Keying QAM: Quadrature Amplitude Modulation PPM: Pulse Position Modulation CCK: Complementary Code Keying ISM: Industrial Scientific and Medical 914 Discuss the security issues with wireless network (October 2005) & vinod vaze

QB on IT for TY BSc. (IT) (May 2006) Ans : Network security This is an important aspect in WLAN because it is different than the wired LAN & difficult to control. It is difficult to restrict access to a WLAN physically, because radio signals can propagate outside the intended coverage of a specific WLAN, for example an office building / college. Desired Security Services: 1. Message confidentiality 2. Message Integrity 3. Message Authentication 4. Message Non-repudiation and 5. Entity Authentication Some security remedial measures against the problem are: 1. using encryption, 2. access control lists (ACL) on the access points (AP) and 3. Network identifier codes. The technical operation of WLANs also works against the intruder: Ways to achieve these services: 1. FHSS: Frequency Hopping Spread Spectrum and 2. DSSS: Direct Sequence Spread Spectrum Frequency Hopping and Direct Sequence operation makes eavesdropping impossible for everyone else, other than the authenticated. In FHSS: The intruder does not know the spreading sequence thus he cannot make any sense of the data. He gets only noise. In DHSS: Since each bit is spread by a unique code, (The famous Barker sequence) the intruder does not know the code. Thus spread signal can also provide Privacy. Wireless Application Protocol (WAP) Security: WAP is a communication protocol that enables wireless mobile devices to have an access to the Internet. WAP architecture includes a WAP Gateway between the client and the server. Security Layer (also called Wireless Transport Layer Security

vinod vaze

QB on IT for TY BSc. (IT) (WTLS) Protocol). When present provides features of: 1. 2. 3. 4. Server Authentication Client Authentication Privacy Secure Connection as required by many modern e-commerce and m-commerce applications and 5. Data Integrity Similar services can be achieved by SSL; However SSL needs reliable transport layer. Whereas WTLS doesnt require a reliable transport layer. WTLS defines a sequence number field in the frame which is not the case of SSL.(Secure Socket Layer) 915 What is the range of coverage of wireless LAN? What can cause the interference in coverage? Explain (October 2005) Ans : Range of coverage The distance over which RF and IR waves can communicate depends on product design (including transmitted power and receiver design) and the propagation path, especially in indoor environments. Interactions with typical building objects, such as walls, metal, and even people, can affect the propagation of energy, and thus also the range and coverage of the system. IR is blocked by solid objects, which provides additional limitations. Most wireless LAN systems use RF, because radio waves can penetrate many indoor walls and surfaces. The range of a typical WLAN node is about 100 m. Coverage can be extended, and true freedom of mobility achieved via roaming. This means using access points to cover an area in such a way that their coverages overlap each other. Thereby the user can wander around and move from the coverage area of one access point to another without even knowing he has, and at the same time seamlessly maintain the connection between his node and an access point. Explain the difference between frequency hopping spread spectrum 916 and direct Sequence spread spectrum. (May 2006) Ans : Direct Sequence Spread Spectrum (DSS) generates a redundant bit pattern for each bit to be transmitted. This bit pattern is called a chip (or chipping code). The longer the chip, the greater the probability that the original data can be recovered (the more bandwidth requires also). Even if vinod vaze

QB on IT for TY BSc. (IT) one or more bits in the chip are damages during transmission, statistical techniques can recover the original data without the need for retransmission. To an unintended receiver, DSSS appears as low-power, wide-band noise and is ignored by most narrowband receivers. The type of receiver for spread-spectrum reception depends on how the signal is generated. For frequency-hopped transmission what is needed is a relatively conventional narrowband receiver that hops in the same way as and is synchronized with the transmitter. This requires that the receiver be given the frequency-hopping-sequence, and there be some form of synchronizing signal (such as the signal usually sent at the start of a data frame in digital communication) to keep the transmitter and receiver synchronized. Some means must also be provided to allow the receiver to detect the start of a transmission, since, if this is left to chance, the transmitter and receiver will most likely be on different frequencies when a transmission begins. One way to synchronize the transmitter and receiver is to have the transmitter send a tone on a prearrange channel at the start of each transmission, before it begins hopping. The receiver can synchronize by detecting the end of the tone and then begin hopping according to the prearranged PN sequence. Of course, this method fails if there happens to be an interfering signal on the designated synchronizing channel at the time synchronization is attempted. A more reliable method of synchronizing frequency-hopping systems is for the transmitter to visit several channels in a prearranged order before beginning a normal transmission. The receiver can monitor all of these channels sequentially, and once it detects the transmission, it can sample the next channel in the sequence for verification and synchronization. Direct-sequence-spread-spectrum transmission requires different reception techniques. Narrowband receivers will not work with these signals, which occupy a wide bandwidth on a continuous basis. A wideband receiver is required, but a conventional wideband receiver would output only noise. In order to distinguish the desired signal, a technique called autocorrelation is used. Essentially this involves multiplying the received signal by a signal generated at the receiver fro the PN code. When the input signal corresponding to the PN code, the output from the auto-correlator will be large; at other times this output will be very small. Of course, once again the transmitter and receiver will probably not be

vinod vaze

QB on IT for TY BSc. (IT) synchronized at the start of a transmission, so the transmitter sends a preamble signal, which is a prearranged sequence of ones and zeros, to let the receiver synchronize with the transmitter.

+ 0 32 64 96

Bits 0 47 3 Versio Header n length

815

16 18

1931

Type of Service Total Length (now DiffServ and ECN) Identification Flags Fragment Offset Time to Live Protocol Header Checksum Source Address

vinod vaze

QB on IT for TY BSc. (IT) 128 160 160 or 192+ Destination Address Options Data

vinod vaze