5.6
The Network Layer in the Internet
Before getting into the specifics of
the network layer in the Internet, it is worth taking at look at the principles
that drove its design in the past and made it the success that it is today. All
too often, nowadays, people seem to have forgotten them. These principles are
enumerated and discussed in RFC 1958, which is well worth reading (and should
be mandatory for all protocol designers—with a final exam at the end). This RFC
draws heavily on ideas found in (Clark, 1988; and Saltzer et al., 1984). We
will now summarize what we consider to be the top 10 principles (from most
important to least important).
- Make sure it works. Do not finalize the design or standard until multiple prototypes have successfully communicated with each other. All too often designers first write a 1000-page standard, get it approved, then discover it is deeply flawed and does not work. Then they write version 1.1 of the standard. This is not the way to go.
- Keep it simple. When in doubt, use the simplest solution. William of Occam stated this principle (Occam's razor) in the 14th century. Put in modern terms: fight features. If a feature is not absolutely essential, leave it out, especially if the same effect can be achieved by combining other features.
- Make clear choices. If there are several ways of doing the same thing, choose one. Having two or more ways to do the same thing is looking for trouble. Standards often have multiple options or modes or parameters because several powerful parties insist that their way is best. Designers should strongly resist this tendency. Just say no.
- Exploit modularity. This principle leads directly to the idea of having protocol stacks, each of whose layers is independent of all the other ones. In this way, if circumstances that require one module or layer to be changed, the other ones will not be affected.
- Expect heterogeneity. Different types of hardware, transmission facilities, and applications will occur on any large network. To handle them, the network design must be simple, general, and flexible.
- Avoid static options and parameters. If parameters are unavoidable (e.g., maximum packet size), it is best to have the sender and receiver negotiate a value than defining fixed choices.
- Look for a good design; it need not be perfect. Often the designers have a good design but it cannot handle some weird special case. Rather than messing up the design, the designers should go with the good design and put the burden of working around it on the people with the strange requirements.
- Be strict when sending and tolerant when receiving. In other words, only send packets that rigorously comply with the standards, but expect incoming packets that may not be fully conformant and try to deal with them.
- Think about scalability. If the system is to handle millions of hosts and billions of users effectively, no centralized databases of any kind are tolerable and load must be spread as evenly as possible over the available resources.
- Consider performance and cost. If a network has poor performance or outrageous costs, nobody will use it.
Let us now leave the general
principles and start looking at the details of the Internet's network layer. At
the network layer, the Internet can be viewed as a collection of subnetworks or
Autonomous Systems (ASes) that are interconnected. There is no real structure, but
several major backbones exist. These are constructed from high-bandwidth lines
and fast routers. Attached to the backbones are regional (midlevel) networks,
and attached to these regional networks are the LANs at many universities,
companies, and Internet service providers. A sketch of this quasi-hierarchical
organization is given in Fig. 5-52.
The glue that holds the whole
Internet together is the network layer protocol, IP (Internet Protocol). Unlike
most older network layer protocols, it was designed from the beginning with
internetworking in mind. A good way to think of the network layer is this. Its
job is to provide a best-efforts (i.e., not guaranteed) way to transport
datagrams from source to destination, without regard to whether these machines
are on the same network or whether there are other networks in between them.
Communication in the Internet works
as follows. The transport layer takes data streams and breaks them up into
datagrams. In theory, datagrams can be up to 64 Kbytes each, but in practice
they are usually not more than 1500 bytes (so they fit in one Ethernet frame).
Each datagram is transmitted through the Internet, possibly being fragmented
into smaller units as it goes. When all the pieces finally get to the
destination machine, they are reassembled by the network layer into the
original datagram. This datagram is then handed to the transport layer, which
inserts it into the receiving process' input stream. As can be seen from Fig. 5-52, a packet originating at host 1 has to
traverse six networks to get to host 2. In practice, it is often much more than
six.
An appropriate place to start our
study of the network layer in the Internet is the format of the IP datagrams
themselves. An IP datagram consists of a header part and a text part. The
header has a 20-byte fixed part and a variable length optional part. The header
format is shown in Fig. 5-53. It is transmitted in big-endian order:
from left to right, with the high-order bit of the Version field going first.
(The SPARC is big endian; the Pentium is little-endian.) On little endian
machines, software conversion is required on both transmission and reception.
The Version field keeps track of
which version of the protocol the datagram belongs to. By including the version
in each datagram, it becomes possible to have the transition between versions
take years, with some machines running the old version and others running the
new one. Currently a transition between IPv4 and IPv6 is going on, has already
taken years, and is by no means close to being finished (Durand, 2001;
Wiljakka, 2002; and Waddington and Chang, 2002). Some people even think it will
never happen (Weiser, 2001). As an aside on numbering, IPv5 was an experimental
real-time stream protocol that was never widely used.
Since the header length is not
constant, a field in the header, IHL, is provided to tell how long the header
is, in 32-bit words. The minimum value is 5, which applies when no options are
present. The maximum value of this 4-bit field is 15, which limits the header
to 60 bytes, and thus the Options field to 40 bytes. For some options, such as
one that records the route a packet has taken, 40 bytes is far too small,
making that option useless.
The Type of service field is one of
the few fields that has changed its meaning (slightly) over the years. It was
and is still intended to distinguish between different classes of service.
Various combinations of reliability and speed are possible. For digitized
voice, fast delivery beats accurate delivery. For file transfer, error-free
transmission is more important than fast transmission.
Originally, the 6-bit field
contained (from left to right), a three-bit Precedence field and three flags, D,
T, and R. The Precedence field was a priority, from 0 (normal) to 7 (network
control packet). The three flag bits allowed the host to specify what it cared
most about from the set {Delay, Throughput, Reliability}. In theory, these
fields allow routers to make choices between, for example, a satellite link
with high throughput and high delay or a leased line with low throughput and
low delay. In practice, current routers often ignore the Type of service field
altogether.
Eventually, IETF threw in the towel
and changed the field slightly to accommodate differentiated services. Six of
the bits are used to indicate which of the service classes discussed earlier
each packet belongs to. These classes include the four queueing priorities,
three discard probabilities, and the historical classes.
The Total length includes everything
in the datagram—both header and data. The maximum length is 65,535 bytes. At
present, this upper limit is tolerable, but with future gigabit networks,
larger datagrams may be needed.
The Identification field is needed
to allow the destination host to determine which datagram a newly arrived
fragment belongs to. All the fragments of a datagram contain the same Identification
value.
Next comes an unused bit and then
two 1-bit fields. DF stands for Don't Fragment. It is an order to the routers
not to fragment the datagram because the destination is incapable of putting
the pieces back together again. For example, when a computer boots, its ROM
might ask for a memory image to be sent to it as a single datagram. By marking
the datagram with the DF bit, the sender knows it will arrive in one piece,
even if this means that the datagram must avoid a small-packet network on the
best path and take a suboptimal route. All machines are required to accept
fragments of 576 bytes or less.
MF stands for More Fragments. All
fragments except the last one have this bit set. It is needed to know when all
fragments of a datagram have arrived.
The Fragment offset tells where in
the current datagram this fragment belongs. All fragments except the last one
in a datagram must be a multiple of 8 bytes, the elementary fragment unit.
Since 13 bits are provided, there is a maximum of 8192 fragments per datagram,
giving a maximum datagram length of 65,536 bytes, one more than the Total
length field.
The Time to live field is a counter
used to limit packet lifetimes. It is supposed to count time in seconds,
allowing a maximum lifetime of 255 sec. It must be decremented on each hop and
is supposed to be decremented multiple times when queued for a long time in a
router. In practice, it just counts hops. When it hits zero, the packet is
discarded and a warning packet is sent back to the source host. This feature
prevents datagrams from wandering around forever, something that otherwise
might happen if the routing tables ever become corrupted.
When the network layer has assembled
a complete datagram, it needs to know what to do with it. The Protocol field
tells it which transport process to give it to. TCP is one possibility, but so
are UDP and some others. The numbering of protocols is global across the entire
Internet. Protocols and other assigned numbers were formerly listed in RFC 1700,
but nowadays they are contained in an on-line data base located at www.iana.org.
The Header checksum verifies the
header only. Such a checksum is useful for detecting errors generated by bad
memory words inside a router. The algorithm is to add up all the 16-bit
halfwords as they arrive, using one's complement arithmetic and then take the
one's complement of the result. For purposes of this algorithm, the Header
checksum is assumed to be zero upon arrival. This algorithm is more robust than
using a normal add. Note that the Header checksum must be recomputed at each
hop because at least one field always changes (the Time to live field), but
tricks can be used to speed up the computation.
The Source address and Destination
address indicate the network number and host number. We will discuss Internet
addresses in the next section. The Options field was designed to provide an
escape to allow subsequent versions of the protocol to include information not
present in the original design, to permit experimenters to try out new ideas,
and to avoid allocating header bits to information that is rarely needed. The
options are variable length. Each begins with a 1-byte code identifying the
option. Some options are followed by a 1-byte option length field, and then one
or more data bytes. The Options field is padded out to a multiple of four
bytes. Originally, five options were defined, as listed in Fig. 5-54, but since then some new ones have been
added. The current complete list is now maintained on-line at www.iana.org/assignments/ip-parameters.
The Security option tells how secret
the information is. In theory, a military router might use this field to
specify not to route through certain countries the military considers to be
''bad guys.'' In practice, all routers ignore it, so its only practical
function is to help spies find the good stuff more easily.
The Strict source routing option
gives the complete path from source to destination as a sequence of IP
addresses. The datagram is required to follow that exact route. It is most
useful for system managers to send emergency packets when the routing tables
are corrupted, or for making timing measurements.
The Loose source routing option
requires the packet to traverse the list of routers specified, and in the order
specified, but it is allowed to pass through other routers on the way. Normally,
this option would only provide a few routers, to force a particular path. For
example, to force a packet from London to Sydney to go west instead of east,
this option might specify routers in New York, Los Angeles, and Honolulu. This
option is most useful when political or economic considerations dictate passing
through or avoiding certain countries.
The Record route option tells the
routers along the path to append their IP address to the option field. This
allows system managers to track down bugs in the routing algorithms (''Why are
packets from Houston to Dallas visiting Tokyo first?''). When the ARPANET was
first set up, no packet ever passed through more than nine routers, so 40 bytes
of option was ample. As mentioned above, now it is too small.
Finally, the Timestamp option is
like the Record route option, except that in addition to recording its 32-bit
IP address, each router also records a 32-bit timestamp. This option, too, is
mostly for debugging routing algorithms.
No comments:
Post a Comment
silahkan membaca dan berkomentar