The Network Access Layer it is the lowest layer of the TCP/IP protocol hierarchy. The protocols in this layer provide the means for the system to deliver data to the other device on a directly attached network. It defines how to use the network to transmit an IP diagram. Unlike higher-level protocols, it must know the details of the underlying network to correctly format the data being transmitted to comply with the network constraints. The TCP/IP Network Access Layer can encompass the function of all three lower layers of the OSI reference model Network Layer, Data Link Layer, and Physical Layer.
Functions performed at this level include encapsulation of IP datagrams into the frames transmitted by the network, and mapping of IP addresses to the physical addresses used by the network.
The network access layer is responsible for exchanging data between a host and the network and for delivering data between two devices on the same network. Node physical addresses are used to accomplish delivery on the local network.
TCP/IP has been adapted to a wide variety of network types, including switching, such as X.21, packet switching, such as X.25, Ethernet, the IEEE 802.x protocols, frame relay, etc.. Data in the network access layer encode EtherType information that is used to demultiplex data associated with specific upper-layer protocol stacks.
Figure 69 shows processes/applications and protocols that rely on the Network Access Layer for the delivery of data to their counterparts across the network.
The Internetwork Layer it is the heart of TCP/IP and the most important protocol. IP provides the basic packet delivery service on which TCP/IP networks are built. All protocols, in the layers above and below IP, use the Internet Protocol to deliver data. All TCP/IP data flows through IP, incoming and outgoing, regardless of its final destination.
The Internetwork Layer is responsible for routing messages through internetworks. Devices responsible for routing messages between networks are called gateways in TCP/IP terminology, although the term router is also used with increasing frequency. The TCP/IP protocol at this layer is the Internet Protocol (IP). In addition to the physical node addresses utilised at the network access layer, the IP protocol implements a system of logical host addresses called IP addresses. The IP addresses are used by the internet and higher layers to identify devices and to perform internetwork routing. The Address Resolution Protocol (ARP) enable IP to identify the physical address that matches a given IP address.
Internet Protocol (IP):
Defining the datagram, which is the basic unit of transmission in the Internet.
Defining the Internet addressing scheme, moving data between the Network Access Layer and the Host-to-Host Transport Layer.
Routing datagrams to remote hosts.
Performing fragmentation and reassembly of datagrams.
Is the packet format defined by Internet Protocol. The internet protocol delivers the datagram by checking the Destination Address (DA). This is an IP address that identifies the destination network and the specific host on that network. If the destination address is the address of a host on the local network, the packet is delivered directly to the destination, otherwise the packet is passed to a gateway for delivery. Gateways are devices that switch packets between the different physical networks. Deciding which gateway to use is called routing. IP makes the routing decision for each individual packet. IP deals with data in chunks called datagrams. The terms packet and datagram are often used interchangeably, although a packet is a data link-layer object and a datagram is a network layer object. In many cases, particularly when using IP on Ethernet, a datagram and packet refer to the same chunk of data. There's no guarantee that the physical link layer can handle a packet of the network layer's size. If the media's MTU is smaller than the network's packet size, then the network layer has to break large datagrams down into packed-sized chunks that the data link layer and physical layer can digest. This process is called fragmentation. The host receiving a fragmented datagram reassembles the pieces in the correct order.
IP Datagram Format:
Figure 70 shows the IP Datagram Format.
The field in figure 70 are as follows:
Type of Service: Data in this fields indicate the quality of service desired. The effects of values in the precedence fields depend on the network technology employed, and values must be configured accordingly.
Format of the Type of Service field:
Bit 3 : Delay 0 = normal delay 1 = low delay
Bit 4 : Throughput 0 = normal throughput 1 = high throughput
Bit 5 : Reliability 0 = normal reliability 1 = high reliability
Bits 6-7: Reserved
Total Length: The length of the datagram in octets, including the IP header and data. This field enables datagrams to consist of up to 65.535 octets. The standard recommends that all hosts be prepared to receive datagrams of at least 576 octets in length.
Identification: An identification field used to aid reassemble of the fragments of a datagram.
Flag: If a datagram is fragmented, the MB bit is 1 in all fragments except the last.
This field contains three control bits.
Bit 0: Reserved, must be 0.
Bit 1 (DF): 1 = Do not fragment and 0 = May fragment
Bit 2 (MF): 1 = More fragments and 0 = Last fragment
Fragment Offset: For fragmented datagrams, indicates the position in the datagram of this fragment.
Time-to-live: Indicates the maximum time the datagram may remain on the network.
Protocol: The upper layer protocol associated with the data portion of the datagram.
Header Checksum: A checksum for the header only. This value must be recalculated each time the header is modified.
Source Address: The IP address of the that originated the datagram.
Destination Address: The IP address of the host that is the final destination of the datagram.
Options: May contain 0 or more options.
Padding: Filled with bits to ensure that the size of the header is a 32-bit multiple.
Internet gateways are commonly referred to as IP routers because they use Internet Protocol to route packets between networks. Gateways forward packets between networks and hosts don't. However, if a host is connected to more than one network (a multihomed host), it can forward packets between the networks. When a multihomed host forwards packets, it acts just like any other gateway and is considered to be a gateway.
Systems can only deliver packets to other devices attached to the same physical network.
Figure 71 shows Routing Through Gateways.
The hosts (end-systems) process packets through all four protocol layers, while the gateways (intermediate-systems) process the packets only up to the internet layer where the routing decisions are made.
As a datagram is routed through different networks, it may be necessary for the IP module in the gateway to divide the datagram into smaller pieces. A datagram received from one network may be to large to be transmitted in a single packet on a different network. This condition only occurs when a gateway interconnects dissimilar physical networks. Each type of network has a Maximum Transmission Unit (MTU), which is the largest packet that it can transfer If the datagram received from one network is longer than the other network's MTU, it is necessary to divide the datagram into smaller fragments for transmission. This process is called fragmentation.
Passing Datagrams to the Transport Layer:
When IP receives a datagram that is addressed to the local host, it must pass the data portion of the datagram to the correct transport layer protocol. This is done by using the protocol number of the datagram header. Each transport layer protocol has a unique protocol number that identifies it to IP.
Internet Control Message Protocol (ICMP):
Is part of the internet layer and uses the IP datagram delivery facility to sends its messages. ICMP sends messages that perform control, error reporting, and informational functions for TCP/IP.
Figure 72 shows the ICMP Header Format.
Flow control: When datagrams arrive to fast for processing, the destination host or intermediate gateway sends an ICMP Source Quench Message back to the sender. This tells the source to temporarily stop sending datagrams.
Detecting unreachable destinations: When a destination is unreachable, the system detecting the problem sends an ICMP Destination Unreachable Message to the datagrams source. If the unreachable destination is a network or host, the message is sent by an intermediate gateway. But if the destination is an unreachable port, the destination host sends the message.
Redirecting routes: A gateway sends the ICMP Redirect Message to tell a host to use another gateway, presumably because the other gateway is a better choice. This message can only be used when the source host is on the same network as both gateways.
Checking remote hosts: A host can send the ICMP Echo Message to see if a remote system's internet protocol is up and operational. When a system receives an echo message, it sends the same packet back to the source host (e.g. PING).
Figure 73 shows processes/applications and protocols rely on the Internet Layer for the delivery of data to their counterparts across the network.
The Host-to-Host Transport Layer has two major jobs: It must subdivide user-sized data buffers into network layer sized datagrams, and it must enforce any desired transmission control such as reliable delivery. The two most imported protocols in this layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). TCP provides reliable data delivery service with end-to-end error detection and correction. UDP provides low-overhead, connectionless datagram delivery service. Both protocols deliver data between the Application Layer and the Internet Layer. Applications programmers can choose whichever service is more appropriate for their specific applications.
The Host-to-Host Transport Layer is responsible for end-to-end data integrity. Two protocols are employed at this layer: Transmission control protocol and user datagram protocol. TCP precedes reliable, full-duplex connections and reliable service by ensuring that data is present when transmission result in an error. Also, TCP enables hosts to maintain multiple, simultaneous connections. UDP provides unreliable service that enhances network throughput when error correction is not required at the host-to-host-layer.
Protocols defined at this layer accept data from application protocols running at the Application layer, encapsulate it in the protocol header, and deliver the data segment thus formed to the lower IP layer for routing. Unlike the IP protocol, the transport layer is aware of the identity of the ultimate user representative process. As such, the Transport layer, in the TCP/IP suite, embodies what data communications are all about: The delivering of information from an application on one computer to an application on another computer.
User Datagram Protocol (UDP):
Gives application programs direct access to a datagram delivery service, like the delivery service that IP provides. This allows applications to exchange messages over the network with a minimum of protocol overhead. UDP is an unreliable (it doesn't care about the quality if deliveries it make), connectionless (doesn't establish a connection on behalf of user applications) datagram protocol. Within your computer, UDP will deliver data correctly. UDP is used as a data transport service when the amount of data being transmitted is small, the overhead of creating connections and ensuring reliable delivery may be greater than the work of retransmitting the entire data set. Broadcast-oriented services use UDP, as do those in which repeated, out of sequence, or missed requests have no harmful side effects. Since no state is maintained for UDP transmission, it is ideal for repeated, short operations such as the Remote Procedure Call protocol. UDP packets can arrive in any order. If there is a network bottleneck that drops packets, UDP packets may not arrive at all. It's up to the application built on UDP to determine that a packet was lost, and to resend it if necessary.
NFS and NIS are build on top of UDP because of its speed and statelessness. While the performance advantages of a fast protocol are obvious, the stateless nature of UDP is equally important. Without state information in either the client or server, crash recovery is greatly simplified.
Figure 74 shows the UDP Datagram Format.
The fields in figure 74 are as follows:
Source Port (16 bits): This field is optional and specifies the port number of the application that is originating the user data.
Destination Port (16 bits): This is the port number pertaining to the destination application.
Length (16 bits): This field describes the total length of the UDP datagram, including both data and header information.
UDP checksum (16 bits): Integrity checking is optional under UDP. If turned on, this field is used by both ends of the communication channel for data integrity checks.
Figure 75 shows the relationship between UDP and IP headers.
There are two points to make:
What IP considers to be data field is in fact another piece of formatted information including both UDP header and user protocol data. To IP it should not matter what the data field is hiding.
The details of the header information for each protocol should clearly convey to the reader purpose of the protocol.
Transmission Control Protocol (TCP):
Is a fully reliable, connection-oriented, acknowledged, byte stream protocol that provide reliable data delivery across the network and in the proper sequence. TCP supports data fragmentation and reassemble. It also support multiplexing/demultiplexing using source and destination port numbers in much the same way they are used by UDP.
TCP provides reliability with a mechanism called Positive Acknowledgement with Retransmission (PAR). Simply stated, a system using PAR sends the data again, unless it hears from the remote system that the data arrived okay. The unit of data exchanged between co-operating TCP modules is called a segment.
Figure 76 shows the data segment format of the TCP Protocol.
The fields in figure 76 are as follows:
Source port (16 bits): Specifies the port on the sending TCP module.
Destination port (16 bits): Specifies the port on the receiving TCP module.
Sequence number (32 bits): Specifies the sequence position of the first data octet in the segment. When the segment opens a connection, the sequence number is the Initial Sequence Number (ISN) and the first octet in the data field is at sequence ISN+1
Acknowledgement number (32 bits): Specifies the next sequence number that is expected by the sender of the segment. TCP indicates that this field is active by setting the ACK bit, which is always set after a connection is established.
Data offset (4 bits): Specifies the number of 32-bit word in the TCP header.
Reserved (6 bits): Must be zero. Reserved for future use.
Control bits (6 bits):
The six control bits are as follow:
URG: When set, the Urgent Pointer field is significant
ACK : When set, the acknowledgement Number field is significant
PSH : Initiates a push function
RST : Forces a reset of the connection
SYN : Synchronises sequencing counters for the connection. This bit is set when a segment request opening of a connection.
FIN : No more data. Closes the connection
Window (16 bits): Specifies the number of octets, starting with the octet specified in the acknowledgement number field, which the sender of the segment can currently accept.
Checksum (16 bits): An error control checksum that covers the header and data fields. It does not cover any padding required to have the segment consists of an even number of octets. The checksum also covers a 96-pseudoheader, it includes source and destination addresses, the protocol, and the segment length. The information is forwarded with the segment to IP to protect TCP from miss-routed segments. The value of the segment length fields include the TCP header and data, but doesn't include the length of the pseudoheader.
Urgent Pointer (16 bits): Identifies the sequence number of the octet following urgent data. The urgent pointer is a positive offset from the sequence number of the segment.
Options (variable): Options are available for a variety of functions.
Padding (variable): 0-value octets are appended to the header to ensure that the header ends on a 32-bit word boundary.
Figure 77 shows the format of the TCP pseudoheader.
Each segment contains a checksum that the recipient uses to verify that the data is undamaged. If the data segment is received undamaged, the receiver sends a positive acknowledgement back to the sender. If the data segment is damaged, the receiver discards it. After an appropriate time-out period, the sending TCP module retransmits any segment for which no positive acknowledgement has been received.
TCP is connection-oriented. It establishes a logical end-to-end connection between the two communication hosts. Control information, called a handshake, is exchanged between the two endpoints to establish a dialogue before data is transmitted. TCP indicates the control function of a segment by setting the appropriate bit in the flags field of the segment header.
Figure 78 shows TCP establishes virtual circuits over which applications exchange data.
The type of handshake used by TCP is called a three-way handshake because three segments are exchanged.
Figure 79 shows a Three-Way Handshake.
Reliability and Acknowledgement:
TCP employs the positive acknowledgement with retransmission technique for the purpose of archiving reliability in service.
Figure 80 shows the positive acknowledgement with retransmission technique.
In figure 80, with a laddergram depicting the events taking place between two hosts. The arrows represent transmitted data and/or acknowledgements, and time is represented by the vertical distance down the ladder. When TCP send a data segment, it requires an acknowledgement from the receiving end. The acknowledgement is used to update the connection state table. An acknowledgement can be positive or negative. An positive acknowledgement implies that the receiving host recovered the data and that it passed the integrity check. A negative acknowledgement implies that the failed data segment needs to be retransmitted. It can be caused by failures such as data corruption or loss.
Figure 81 shows how TCP implements a time-out mechanism to keep track of loss segments.
In figure 81, what illustrates what happens when a packet is lost on the network and fails to reach its ultimate destination. When a host sends data, it starts a countdown timer. If the timer expires without receiving an acknowledgement, this host assumes that the data segment was lost. Consequently, this host retransmits a duplicate of the failing segment. TCP keep a copy of all transmitted data with outstanding positive acknowledgement. Only after receiving the positive acknowledgement is this copy discarded to make room for other data in its buffer.
Data Stream Maintenance:
The interface between TCP and a local process is a port, which is a mechanism that enables the process to call TCP and in turn enables TCP to deliver data streams to the appropriate process.
Ports are identified by port numbers. To fully specify a connection, the host IP address is appended to the port number. This combination of IP address and port number is called a socket. A given socket number is unique on the internetwork. A connection between two hosts is fully described by the sockets assigned to each end of the connection.
Figure 82 shows a TCP Data Stream that starts with an Initial Sequence Number of 0.
In figure 82, the receiving system has received and acknowledged 2000 bytes. so the current Acknowledgement Number is 2000. The receiver also has enough buffer space for another 6400 bytes, so it has advertised a Window of 6000. The sender is currently sending a segment of 1000 bytes starting with Sequence Number 4001. The sender has received no acknowledgement for the bytes from 2001 on, but continues sending data as long as it is within the window. If the sender fills the window and receives no acknowledgement of the data previously sent, it will, after an appropriate time-out, send the data again starting from the first unacknowledged byte. Retransmission would start from byte 2001 if no further acknowledgements are received. This procedure ensures that data is reliably received at the far end of the network.
From the perspective of the process, communication with the network involves sending and receiving continuous streams of data. The process is not responsible for fragmenting the data to fit lower-layer protocols.
Figure 83 shows how data are processed as the travel down the protocol stack, through the network, and up the protocol stack of the receiver.
A short explanation of figure 83:
TCP receives a stream of data from the upper-layer process
TCP may fragment the data stream into segments that meet the maximum datagram size of IP
IP may fragment segments as it prepares datagrams that are sized to conform to restrictions of the network.
Network protocols transmit the datagram in the form of bits.
Network protocols at the receiving host reconstruct datagrams from the bits they receive.
IP receives datagrams from the network. Where necessary datagram fragments are reassembled to reconstruct the original segment.
TCP presents data in segments to upper-layer protocols in the form of data streams.
Figure 84 shows processes/applications and protocols rely on the Transport Layer for the delivery of data to their counterparts across the network.
The Process/Application Layer includes all processes that use the transport layer protocols to deliver data. There are many applications protocols. A good example of concerns handled by these process is the reconciliation of differences in the data syntax between the platforms on which the applications are running. It should be clear that unless this difference in data representation is handled properly, any exchange of data involving these processes id likely to yield erroneous interpretations of numerical data. To resolve this issue, and other similar issues, TCP/IP defines the eXternal Data Representation (XDR) protocol. Reflecting on the nature of this problem, you can easily see that the problem has nothing to do with the underlying network topology, wiring, or electrical interference.
Some applications that uses TCP:
TELNET: The Network Terminal Protocol, provides remote login over the network.
FTP: The File Transfer Protocol, is used for interactive file transfer between hosts.
SMTP: The Simple Mail Transfer Protocol delivers electronic mail.
Some applications that uses UDP:
SNMP: The Simple Network Management Protocol, is used to collect management information from network devices.
DNS : Domain Name Service, maps IP addresses to the names assigned to network devices.
RIP: Routing Information Protocol, routing is the central to the way TCP/IP networks. RIP is used by the network devices to exchange routing information.
NFS : Network File System, this protocol allows files to be shared by various hosts on the network as if they were local drives.
TCP/IP Protocols Inside a Sample Gateway:
Figure 85 shows the TCP/IP Protocols Inside a Sample Gateway.
Figure 86 shows processes/applications and protocols rely on the Application Layer for the delivery of data to their counterparts across the network.