Читать книгу Networking All-in-One For Dummies - Lowe Doug, Doug Lowe - Страница 43

Pondering Packets

Оглавление

When two or more devices are connected to a network via cables plugged into their network interfaces, those devices can exchange information with one another. This bit of magic is accomplished through the use of packets, which are relatively small units of data that are sent and received through the network interface and cables. A network packet always originates at a single network interface, called the sender, and it’s usually (but not always) sent to a single network interface, called the destination.

A packet is very similar to an envelope that you would send through standard mail delivery. It includes the MAC address of both the sender and the destination, as well as some other interesting header information, along with a payload that contains the actual data being sent by the packet. You can think of the payload as what you would put in an envelope you want to send through the mail. You wouldn’t dream of dropping an envelope in the mail without writing the recipient’s address, as well as your own address, on the envelope. So it is with packets.

The payload of an Ethernet packet may be a packet created by some higher-level protocol, such as IP. This is analogous to putting a letter in an envelope, putting that envelope in a larger envelope, and sending it through the mail. When the recipient receives your mail, she opens the envelope only to find another envelope that must be opened. That envelope may itself contain another envelope and so on, like Russian nesting dolls.

The term frame is often used instead of packet, but technically they’re not quite the same. Every packet begins with a preamble, which consists of 56 bits of alternating zeros and ones. This preamble is used by the electronic circuitry of the interfaces to get their clocks synchronized properly so they can accurately read the rest of the packet. It’s the rest of the packet that is technically called the frame. In other words, a packet consists of a preamble followed by a frame. Because the preamble is of concern only to the electronic engineers that design network interfaces, most non-engineers use the terms packet and frame interchangeably.

Ethernet has a standard packet format that all packets sent on an Ethernet network must follow. An Ethernet packet contains the following information:

 Preamble: The preamble consists of 56 bits of alternating ones and zeros and is used to synchronize the precise timing required to read packet data.

 Start-of-frame marker: A start-of-frame marker is a single byte that indicates that the frame is about to begin.

 Destination MAC address (six bytes).

 Sender MAC address (six bytes).

 Tag: The tag, which is used to support virtual local area networks (VLANs), is optional. A VLAN lets you divide two or more distinct LANs on a shared physical infrastructure (for example, cables and switches). (For more information about VLANs, see Chapter 3 of this minibook, as well as Book 3, Chapter 1.)

 Ethertype (two bytes): This field indicates the specific protocol that is contained in the payload.

 Payload: The payload contains the actual data being sent by the packet. The payload can be anywhere from 46 to 1,500 bytes. If the information that needs to be sent is longer than 1,500 bytes, the information must be broken into two or more packets, sent separately, and then reassembled when the packets reach their destination. (The tasks of breaking up and reassembling the data are handled by protocols at higher layers in the OSI framework; Ethernet itself has no understanding of what is in the packets it sends.)

 Frame check sequence (four bytes): The frame check sequence (FCS) is used to ensure that the frame data was sent correctly. Basically, the interface that sends the packet uses an algorithm to calculate a four-byte number based on the contents of the frame and saves this number in the FCS field. When the packet is received, the receiving interface repeats the calculation, and then makes sure that the number recorded in the FCS portion of the packet matches the number it calculated. If the numbers disagree, the packet got garbled in transmission and is discarded.

Note that the details of an Ethernet packet are not really of much concern when you design and implement a network. Here are the main points to remember:

 Ethernet packets contain the MAC addresses of the sender and the receiver.

 The payload of an Ethernet packet is almost always a packet created by another higher-level protocol such as IP.

 Ethernet packets can contain a tag field used to implement VLANs, which provide an important means of organizing a large network into smaller parts that can be more easily managed.

Networking All-in-One For Dummies

Подняться наверх