TCP/IP First-Step [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

TCP/IP First-Step [Electronic resources] - نسخه متنی

Mark A. Sportack

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






The Life of a Packet


Don't get your hopes upa packet doesn't live a glorious, long, or even interesting life. However, it does serve a vital function for the brief time it exists.

Simplified, an IP packet's life has three stages:

Wrap it up.
A packet's life begins when a host wraps user data (already encapsulated by either TCP or UDP) inside an IP packet.

Pass it on.
The second stage in an IP packet's life begins when it leaves the nest. Only one machine can create an IP packet, but lots of other machines might handle it, open it, and examine its contents. These machines are the network devices, such as switches and routers, that lie between the source and destination machines.

Their job is to make two decisions. The first is to check the packet's Time-To-Live (TTL) and see if it has expired. If it has, the device drops that packet, notifies the sender that it has expired, and grabs the next one. If the packet is alive and well, the device must figure out how best to pass the packet through a network so it reaches its intended destination.

Take it away.
The last stage in an IP packet's life occurs when it finally reaches its destination. The machine that receives the IP packet must make sure the packet wasn't damaged in transit. It accomplishes this by running the same mathematical algorithm as the sending machine and comparing the results stored in the IP packet's Checksum field.

The following sections take you through each of these stages in an IP packet's life. Before you dig into these functions, it's important to reflect on the car-driving example in Chapter 3, "The Quest for Freedom of Choice." The reference model in that example shows how a necessary sequence of events works in two directions. In that example, starting and stopping a car were the directions.

In the case of TCP/IP, those two directions are sending and receiving. Those terms are relative and their meanings can vary with your perspective. As you go through the three stages of an IP packet's life, you see just how relative those terms can be!

The potential for ambiguity between the sender and receiver is real. The terms source and destination are used to help avoid confusion. The source machine is the one that starts the conversation; the destination is the recipient of that conversation. During a conversation, both machines actively create and send IP packets, thereby functioning as both a sender and a receiver.

Stage 1: Wrap It Up


The IP envelope isn't an envelope in the traditional sense of the word. It isn't made of paper, nor can you lick a gummed surface to seal its contents inside. Remember: An envelope in this context is a mechanism for moving data through a network. That data exists only in the most tenuous and fleeting of forms; it is literally flashes of light in a fiber-optic network or pulses of energy in an electrical network. For your envelope to carry data through either type of network, it must be physically compatible with that network. Thus, the envelope takes the same form as the data it is intended to carry. Just like regular mail, an envelope won't get far unless it has a destination address. That address enables everyone who touches the mail during its journey to see where it must go.Chapter 5, "Peeking Under the Covers," shows you the structure of TCP, UDP, and IP headers. A packet is nothing more than an IP header with data attached. The data, as explained in Chapter 5, is a TCP header and a segment of application data. IP does not differentiate between the TCP header and application data. Both are data from IP's perspective.

Figure 6-1 shows an IP packet being created by wrapping a new envelope around the TCP segment. In reality, no envelope is used in the physical sense. Instead, wrapping an IP header around a TCP segment creates a packet.

Figure 6-1. A Packet Gets Created

After a source machine creates an IP packet, the next logical step is to pass it on!

Stage 2: Pass It On


Generally speaking, two types of networks exist: local-area networks (LANs) and wide-area networks (WANs). LANs are the mechanisms to which you connect your PCs, servers, printers, and other devices. LANs are typically made up of either hubs or switches, and they are capable of great speeds. However, their ability to span distances is distinctly limited. Consequently, LANs are typically kept to a single building or a small area within a building. Examples of LANs include Ethernet, Fast Ethernet, Gigabit Ethernet, Token Ring, and Fiber Distributed Data Interface (FDDI).router is the network device that enables WANs. WANs are made up of long-distance telecommunications lines interconnected by routers. Routers can be used in two ways: as the backbone of a WAN or as the boundary between LANs and the WAN. The router's role is to figure out what to do with IP packets that it receives. One thing routers can't generally do is function as a LAN. They can interconnect LANs, but they are not LANs in and of themselves.frame. Figure 6-2 shows an IP packet being wrapped inside an Ethernet frame for the start of its journey.

Figure 6-2. A Packet Is Wrapped and Sent

A frame is just like a packet except that it is specific to a physical network. Frames can't go too far, either. Typically, a frame is good only within one network, whereas an IP packet can travel through many networks en route to its destination. Consequently, the IP packet shown in Figure 6-2 will likely be subjected to more iterations of wrap-and-unwrap along the way.

Thus, frames come and go with each network but the IP packet remains untouched (aside, of course, from constantly being wrapped and unwrapped in physical network frames en route to its destination). Each time an IP packet is unwrapped, the network device that's unwrapping it peeks at the IP destination address and quickly decides whether it is past its TTL and, if not, where to send it.

Figures 6-3 and 6-4 show just what an IP packet endures during its brief journey through a network.

Figure 6-3. A Packet Is Unwrapped and Examined

Figure 6-4. A Packet Is Rewrapped

Stage 3: Take It Away


When a packet reaches its destination, it gets unwrapped for the last time. Remember that the packet arrives embedded within an Ethernet or other physical network frame. Before any of the fields in the IP header can be examined, the packet must first be stripped of that frame. Figure 6-5 illustrates this.

Figure 6-5. The Packet Is Unwrapped for the Last Time

After the recipient machine unwraps the packet, it has some serious work to do! This work represents the last stage in the short, uncelebrated life of an IP packet. That destination machine must first assess whether the data inside the IP packet has been damaged during its trip through the network. As mentioned previously, it does so by running the Checksum algorithm against the packet's payload. That algorithm's results must be compared with the sender's results, which were stored in the IP header's Checksum field. If it's a match, the contents are still good and can be processed further.Chapter 8, "Guaranteed Delivery: Your Package Will Get Delivered…Eventually!" and UDP/IP in Chapter 9, "Best-Effort Delivery: It's Now or Never." For now, concentrate on the mechanism that allows packets to be pushed through a network: the IP address.


/ 133