IP defines a 20-byte long header, which includes a 4-byte source IP address and a 4-byte destination IP address. An IP packet includes the IP header, along with any data that follows the IP header. Although other parts of the IP header are interesting, the address fields are crucial.
|
 |
You might recall that Ethernet includes a source and
destination Ethernet address field in the Ethernet header, and that those
addresses are 6 bytes long each. The IP addresses mentioned here are indeed
different addresses, and they are used to allow networking devices to send data
over a large network that includes other types of physical networks besides
Ethernet. | |
When sending a packet, the destination IP address field in the
IP header defines where the packet should be sent. The computers, and the
routers between them, understand that the packet should be forwarded based on
the destination IP address. The source IP address in the header is also
important because after the packet is delivered to the destination computer, it
will want to reply. That computer knows the IP address of the computer that sent
the original packet by looking at the source IP address. For instance, in Figure 10-2, when the web server gets the
packet and needs to respond, it knows to send the response packet to 1.1.1.1.
The term "packet" has a specific meaning in networking. It
implies some data that includes the Layer 3 header, plus any encapsulated data.
In the TCP/IP networking model, IP is the Layer 3 protocol, so an IP header and
the data that follows it are IP packets. The term "segment," which you read
about in Chapter 9, "Choosing Shipping Options When Transporting Goods over the
(Network) Roadway," refers to data that includes the Layer 4 header (TCP)
and any encapsulated data. The difference between a packet and a segment is that
a segment does not include the Layer 3 header, but a packet does.
As a reminder, you might also recall from Chapter 5, "Rules of the Road: How to Use the Local
(Network) Roadway," that the term "frame" refers to a data link header and its
encapsulated data. In that chapter, an Ethernet header and trailer encapsulated
some data to send the data over an Ethernet LAN. It's common to use the term
"frame" to refer to the data link header, trailer, and data; "packet" to refer
to the network layer (IP) header and data; and "segment" to refer to the
transport layer (TCP) header and data.
When sending data, the IP software on a computer (Hannah in
this example) encapsulates the higher-layer data inside an IP packet. For a more
detailed appreciation of that concept, think back to the HTTP coverage in Chapter 8, "Shipping Goods over a
(Network) Roadway," and Chapter 9's
coverage of TCP. For Hannah to get the web page, she must send an HTTP GET
request. To send HTTP messages, she must use TCP. As it turns out, to deliver
the TCP segment to the other computer, TCP must use IP. Figure 10-3 shows the process of getting a home page with
more detail, including the IP headers and IP packets.