Wednesday, April 18, 2012

The host-to-host layer in the TCP/IP protocol is aptly named



The host to host layer from the TCP/IP protocol is aptly named. Whereas the internet layer is accountable for the logical paths between networks, the host-to-host layer is accountable for the full logical path between two hosts on disparate networks.18 From an additional viewpoint, the host-to-host layer is an interface towards the lower layers from the protocol suite, freeing applications from any concern about how their data is actually getting delivered.

18 Similarly, it could be said that the equivalent functions from the OSI session layer, residing above the transport layer, offer a logical, end-to-end path between two applications across a network.

An analogy to this service is actually a corporate mailroom. A package may possibly be given towards the mailroom with requirements stated for its delivery (general delivery, overnight). The individual generating the delivery request does not have to know, and is possibly not considering, the actual mechanics of delivering the package. The mailroom folks will arrange for the right service (postal, FedEx, cross-town bicycle courier) to fulfill the delivery requirements.

The two major services offered by the host-to-host layer are TCP Connection and UDP.

TCP

The Transmission Control Protocol, or TCP, described in RFC 793, gives applications having a trustworthy, connection-oriented service. In other words, TCP port gives the appearance of a point-to-point connection.

Point-to-point connections have two characteristics:

They've only 1 path towards the destination. A packet entering 1 finish from the connection can not turn out to be lost, for the reason that the only place to go is the other finish.
Packets arrive within the very same order in which they may be sent.

TCP gives the appearance of a point-to-point connection, although in reality there is certainly no such connection. The web layer TCP utilizes a connectionless, best-effort packet delivery service. The analogy of this really is the Postal Service. If a stack of letters is given towards the mail carrier for delivery, there is certainly no guarantee that the letters will arrive stacked within the very same order, that they're going to all arrive on the same day, or indeed that they're going to arrive at all. The Postal Service merely commits to generating its ideal work to deliver the letters.

Likewise, the internet layer does not guarantee that all packets will take the same route, and as a result there is certainly no guarantee that they're going to arrive within the very same sequence and time intervals as they were sent, or that they're going to arrive at all.

However, a telephone contact is connection-oriented service. Data should arrive sequentially and reliably, or it is useless. Like a telephone contact, TCP should initially establish a connection, then transfer data, and then carry out a disconnect when the data transfer is total.

TCP utilizes 3 fundamental mechanisms to accomplish a connection-oriented service on best of a connectionless service:

Packets are labeled with sequence numbers to ensure that the receiving TCP service can place out-of-sequence packets in to the appropriate sequence before delivering them towards the destination application.
TCP utilizes a technique of acknowledgments, checksums, and timers to offer reliability. A receiver may possibly notify a sender when it recognizes that a packet within a sequence has failed to arrive or has errors, or even a sender may possibly assume that a packet has not arrived if the receiver does not send an acknowledgment inside a particular quantity of time after transmission. In each circumstances, the sender will resend the packet in question.
TCP utilizes a mechanism called windowing to regulate the flow of packets; windowing decreases the probabilities of packets getting dropped because of full buffers within the receiver.

TCP attaches a header towards the application layer data; the header contains fields for the sequence numbers as well as other facts vital for these mechanisms, and fields for addresses called port numbers, which identify the source and destination applications from the data. The application data with its attached TCP header is then encapsulated inside an IP packet for delivery. Figure 1-17 shows the fields from the TCP header, and Example 1-14 shows an analyzer capture of a TCP header.

Figure 1-17. TCP header format.

image

Example 1-14. Analyzer display of a TCP header.

Ethernet II, Src: 00:0c:41:3c:2b:18, Dst: 00:30:65:2c:09:a6
Online Protocol, Src Addr: 66.218.71.112 (66.218.71.112),
Dst Addr: 172.16.1.21 (172.16.1.21)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
Total Length: 52
Identification: 0xc0b7 (49335)
Flags: 0x04
Fragment offset: 0
Time to reside: 50
Protocol: TCP (0x06)
Header checksum: 0x509d (appropriate)
Source: 66.218.71.112 (66.218.71.112)
Destination: 172.16.1.21 (172.16.1.21)
Transmission Control Protocol, Src Port: http (80),
Dst Port: 60190 (60190), Seq: 288, Ack: 811, Len: 0
Source port: http (80)
Destination port: 60190 (60190)
Sequence number: 288
Acknowledgement number: 811
Header length: 32 bytes
Flags: 0x0010 (ACK)
Window size: 66608
Checksum: 0xb32a (appropriate)
Possibilities: (12 bytes)
NOP
NOP
Time stamp: tsval 587733966, tsecr 1425164062
SEQ/ACK analysis
This can be an ACK towards the segment in frame: 17
The RTT to ACK the segment was: 0.047504000 seconds

Source and Destination Port are 16-bit fields that specify the source and destination applications for the encapsulated data. Like other numbers applied by TCP/IP, RFC 1700 describes all port numbers in popular and not-so-common use. A port number for an application, when coupled using the IP address from the host the application resides on, is called a socket. A socket uniquely identifies every application within a network.

Sequence Number is actually a 32-bit number that identifies exactly where the encapsulated data fits inside a data stream from the sender. As an example, if the sequence quantity of a segment is 1343 and the segment contains 512 octets of data, the next segment ought to possess a sequence quantity of 1343 + 512 + 1 = 1856.

Acknowledgment Number is actually a 32-bit field that identifies the sequence number the source subsequent expects to receive from the destination. If a host receives an acknowledgment number that does not match the next sequence number it intends to send (or has sent), it knows that packets have been lost.

Header Length, from time to time called Data Offset, is actually a four-bit field indicating the length from the header in 32-bit words. This field is necessary to identify the starting from the data for the reason that the length from the Possibilities field is variable.

The Reserved field is four bits, which are always set to zero.

Flags are eight 1-bit flags that happen to be applied for data flow and connection control. The flags, from left to suitable, are Congestion Window Lowered (CWR), ECN-Echo (ECE), Urgent (URG), Acknowledgment (ACK), Push (PSH), Reset (RST), Synchronize (SYN), and Final (FIN).

Window Size is actually a 16-bit field applied for flow control. It specifies the quantity of octets, beginning using the octet indicated by the Acknowledgment Number, that the sender from the segment will accept from its peer in the other finish from the connection before the peer should cease transmitting and wait for an acknowledgment.

Checksum is 16 bits, covering each the header and the encapsulated data, allowing error detection.

Urgent Pointer is applied only when the URG flag is set. The 16-bit number is added towards the Sequence Number to indicate the finish from the urgent data.

Possibilities, as the name implies, specifies solutions necessary by the sender's TCP approach. Essentially the most normally applied alternative is Maximum Segment Size, which informs the receiver from the largest segment the sender is willing to accept. The remainder from the field is padded with zeros to make sure that the header length is actually a a number of of 32 octets.

UDP

User Datagram Protocol, or UDP, described in RFC 768, gives a connectionless, best-effort packet delivery service. At first take, it may possibly seem questionable that any application would prefer an unreliable delivery more than the connection-oriented TCP. The advantage of UDP, nonetheless, is that no time is spent setting up a connectionthe data is just sent. Applications that send brief bursts of data will realize a performance advantage by working with UDP as opposed to TCP.

Figure 1-18 shows an additional advantage of UDP: a much smaller sized header than TCP. The Source and Destination Port fields are the same as they may be within the TCP header; the UDP length indicates the length from the entire segment in octets. The checksum covers the entire segment, but as opposed to TCP, the checksum here is optional; when no checksum is applied, the field is set to all zeros. Example 1-15 shows an analyzer capture of a UDP header.

Figure 1-18. UDP header format.

image

Example 1-15. Analyzer display of a UDP header.

Ethernet II, Src: 00:30:65:2c:09:a6, Dst: 00:0c:41:3c:2b:18
Online Protocol, Src Addr: 172.16.1.21 (172.16.1.21),
Dst Addr: 198.133.219.25 (198.133.219.25)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
Total Length: 40
Identification: 0x8a4d (35405)
Flags: 0x00
Fragment offset: 0
Time to reside: 1
Protocol: UDP (0x11)
Header checksum: 0xe0b3 (appropriate)
Source: 172.16.1.21 (172.16.1.21)
Destination: 198.133.219.25 (198.133.219.25)
User Datagram Protocol, Src Port: 35404 (35404), Dst Port: 33435 (33435)
Source port: 35404 (35404)
Destination port: 33435 (33435)
Length: 20
Checksum: 0x0000 (none)
Data (12 bytes)

0000 01 01 00 00 40 fd ac 74 00 00 d2 45 ....@..t...E



No comments:

Post a Comment