Going Down the Protocol Stack
This section covers the basic mechanics as to how information is processed as it is sent down the protocol stack on a computer. I’ll use the diagram shown in Figure 2-10 to illustrate this process as PC-A sends information to PC-B. In this example, assume that the data link layer is Ethernet and the physical layer is copper.
The first thing that occurs on PC-A is that the user, sitting in front of the computer, creates some type of information, called data, and then
sends it to another location (PC-B). This includes the actual user input (application layer), as well as any formatting information (presentation layer). The application (or operating system), at the session layer, then determines whether or not the data’s intended destination is local to this computer (possibly a disk drive) or a remote location. In this instance, the user is sending the information to PC-B. We’ll assume that the user is executing a telnet connection.
The session layer determines that this location is remote and has the transport layer deliver the information. A telnet connection uses TCP/IP and reliable connections (TCP) at the transport layer, which encapsulates the data from the higher layers into a segment. The segment contains such information as the source and destination port numbers. As you may recall from the section “Connection Multiplexing”, the source port is a number above 1,023 that is currently not being used by PC-A. The destination port number is the well-known port number (23) that the destination will understand and forward to the correct application.
The transport layer passes the segment down to the network layer, which encapsulates the segment into a packet. The packet header contains layer-3 logical addressing information (source and destination address), as well as other information, such as the upper-layer protocol that created this information. In this example, TCP
created this information, so this fact is noted in the packet, and PC-A places its IP address as the source address in the packet and PC-B’s as the destination. This helps the destination, at the network layer, to determine if the packet is for itself and which upper-layer process should handle the encapsulated segment. In the TCP/IP protocol stack, the terms packet and datagram are used interchangeably to describe this PDU.
The network layer then passes the packet down to the data link layer. The data link layer encapsulates the packet into a frame. If you are using IEEE for the data link layer, remember that two encapsulations take place here: one for LLC and one for MAC. This example uses Ethernet as the data link layer medium, and there are two versions of Ethernet: Ethernet II and IEEE 802.3. To make this more complex, assume the data link layer is based on IEEE’s Ethernet implementation. At the LLC sublayer, either an 802.2 SAP or SNAP frame is used. (These frame types were shown previously in Figure 2-4.) TCP/IP uses a SAP frame type. The important information placed in the SAP frame header is which network layer protocol created the packet: IP. The 802.2 SAP frame is then passed down to the MAC sublayer, where the 802.2 frame is encapsulated in an 802.3 frame. The important components placed in the 802.3 frame header are the source and destination MAC addresses. In this example, PC-A places its MAC address in the frame in the source field and PC-B’s MAC address as the destination.
The data link layer frame is then passed down to the physical layer. At this point, remember that the concept of “PDUs” is a human concept that we have placed on the data to make it more readable to us, as well as to help deliver the information to the destination. However, from a computer’s perspective, the data is just a bunch of 1’s and 0’s, called bits. The physical layer takes these bits and coverts them into a physical property based on the cable or connection type. In this example, the cable is a copper cable, so the physical layer will convert the bits into voltages: one voltage level for a bit value of 1 and a different voltage level for a 0.
Going Up the Protocol Stack
For sake of simplicity, assume PC-A and PC-B are on the same piece of copper. Once the destination receives the physical layer signals, the physical layer translates the voltage levels back to their binary representation and passes these bit values up to the data link layer. The data link layer takes the bit values and reassembles the original 802.3 frame.
The NIC, at the MAC layer, examines the FCS to make sure the frame is valid and examines the destination MAC address to ensure that the Ethernet frame is meant for itself. If the destination MAC address doesn’t match its own MAC address, or is not a multicast or broadcast address, the NIC drops the frame. Otherwise, the NIC processes the frame: it strips off the 802.3 frame and passes the 802.2 frame up to the LLC sublayer. The LLC sublayer examines the SAP value to determine which upperlayer protocol at the network layer should process the encapsulated packet. In this case, the LLC sees that the encapsulated packet is a TCP/IP packet, so it strips off (de-encapsulates) the LLC frame information and passes the packet up to the TCP/IP protocol stack at the network layer. If this were an encapsulated IPX packet, the LLC would pass the encapsulated IPX packet up to the IPX protocol stack at the network layer.
The network layer then examines the logical destination address in the packet header. If the destination logical address doesn’t match its own address or is not a multicast or broadcast address, the network layer drops the packet. If the logical address matches, then the destination examines the protocol information in the packet header to determine which protocol should handle the packet. In this example, the logical address matches and the protocol is defined as TCP. Therefore, the network layer strips off the packet information and passes the encapsulated segment up to the TCP protocol at the transport layer.
Upon receiving the segment, the transport layer protocol can perform many functions, depending on whether this is a reliable or unreliable connection. I’ll just focus on the multiplexing function of the transport layer. In this instance, the transport layer examines the destination port number in the segment header. In our example, the user from PC-A was using telnet to transmit information to PC-B, so the destination port number is 23. The transport layer examines this port number and realizes that the encapsulated data needs to be forwarded to a telnet application.
If PC-B doesn’t support telnet, the transport layer drops the segment. If it does, the transport layer strips off the segment information and passes the encapsulated data to the telnet application. If this is a new connection, a new telnet process is started up by the operating system.
Note that a logical communication takes place between two layers of two devices. For instance, a logical communication occurs at the transport layer between PC-A and PC-B, and this is also true at the network and data link layers.
No comments:
Post a Comment