(Latest Revision:
Mon Apr 2 14:28:04 PDT 2007
)
Notes On Chapter Nineteen
-- Binding Protocol Addresses (ARP)
- 19.1 Introduction
- To transmit a packet across a LAN, a host
or router needs to have the hardware address of the intended
recipient.
- When an Internet router receives an IP packet the routing tables
tell it what IP address to forward it to.
- Routing tables do not tell what hardware address to use.
- Routers and other hosts need to have some method to translate IP
address <--> hardware address.
- This chapter is about various ways to do that translation.
- 19.2 Protocol Addresses And Packet Delivery
- The Internet uses certain standard kinds of addresses and packet
formats.
- The actual physical networks over which
the Internet traffic flows use different addressing schemes and
frame formats -- incompatible with TCP/IP standards and generally
with the other physical networks too.
- When Internet packets are sent over
network links, they travel inside frames appropriate to
the physical network, addressed using the addressing scheme of
that network.
- 19.3 Address Resolution
- When hosts X and Y are on the same LAN, X wants to send a packet
to Y, and X has only the IP address of Y, then X uses some method
of address resolution to translate the IP address to the
physical address.
- X can then send the message directly to Y.
- If X and Y are not on the same LAN, then X does not seek the
physical address of Y.
- X will send the packet to a router R on the local LAN.
- R will forward the packet to get it close to Y.
- If X does not know the physical address for R, X may use address
resolution to obtain it.
- IP packets just get passed from router to router to router until
they arrive at a router G connected to the destination network.
Then G uses address resolution to find the physical address of
the recipient, and delivers the packet.
- 19.4 Address Resolution Techniques
- "There's more than one way to skin a cat." Address resolution
can be done in a variety of ways. It may be done differently on
different types of physical networks. Basic categories:
- Table Lookup
- Closed-form computation
- Message exchange
- 19.5 Address Resolution With Table Lookup
- The basic idea of table lookup is just to look up the IP address
in a table and read off the corresponding physical address
located "next to" the IP address.
- If the IP addresses are all sequential and the table is laid out
in order of increasing IP address, then software can be written
so it "jumps" to the correct entry in the table immediately.
- If not, there are programming tricks (e.g. hashing) that can
simulate the situation where the numbers are sequential.
- This is important because it may take too long to search a long
table for an IP address.
- 19.6 Address Resolution With Closed-Form
Computation
- It may be possible to assign the physical addresses and IP
addresses in such a way that there will be a simple arithmetic
formula that can be used to translate from one address to the
other.
- As a simple example, ethernet addresses are 6 byte numbers and IP
addresses are 4 byte numbers. The ethernet address corresponding
to A.B.C.D could be 0.0.A.B.C.D.
- The closed-form method is very "nice" because it is efficient in
its use of both time and memory.
- 19.7 Addresss Resolution With Message Exchange
- Hosts can send messages to an address resolution server.
- The servers can be a problem because their tables have to be kept
current and they can be swamped with requests.
- Hosts can broadcast a request for address resolution. The
intended recipient recognizes its own IP address sent out in the
broadcast and replies by sending its hardware address to the host
that made the broadcast.
- This distributed method can be a problem because broadcasts force
all hosts to use their CPU's.
- On an Ethernet the method is usually message exchange, except
that results are cached in a table.
- 19.8 Address Resolution Protocol
- The TCP/IP standard does not dictate what method of address
resolution to use.
- Address Resolution Protocol (ARP) is a
TCP/IP protocol/standard for message-based address resolution.
- 19.9 ARP Message Delivery
- The protocol requires that the ARP request
be broadcast on the local LAN in a single packet containing the
IP address of the sender, hardware address of the sender, and IP
address the sender wants to resolve.
- The host whose IP address it is that needs resolution makes a
response to the sender.
- All other hosts process the request, but make no reply.
- The responding host does not broadcast. It simply places its
hardware address in a packet and transmits it to the sender of
the request.
- 19.10 ARP Message Protocol
- A field in the ARP packet tells how big the protocol (usually IP)
and physical addresses are.
- The fields of the ARP packet are shown on page 313 of the fourth
edition.
- 19.11 Sending an ARP Message
- A host sending an ARP packet places it
inside a physical frame (just as any other "data" would be).
- In other words the ARP packet is "wrapped" in a hardware frame and
treated as "freight" for its trip across the physical network.
-
- 19.12 Identifying ARP Frames
- The hardware frame has a type field
- The sender of an ARP packet places a special code in the type
field (0x806 for Ethernet) so the receiver will know that the
data portion of the packet contains an ARP message.
- This is useful to the receiver, to help it determine to what
protocol stack or software module the packet should be given.
-
- 19.13 Caching ARP Responses
- A host X that sends an ARP request will get
a reply containing a binding . X will cache the
binding in a table.
- That way, X may not have to broadcast another ARP request the next
time it needs to resolve that same IP address -- a waste of
network bandwidth and CPU time on all the local hosts.
- A host must "age" and eventually "expire"
information in its ARP cache, else it would keep obsolete
information indefinitely.
- ARP information has to change: IP address assignments can change
and host NIC's can be replaced.
-
- 19.14 Processing An Incoming ARP Message
- Interestingly, if any host Z
receives a broadcast ARP request from a sender X, Z will update
its cache with X's binding if Z currently has a version
of X's binding in its cache.
- This is useful because if Z has a binding for X in it's cache then
Z has probably been communicating with X in the recent past and so
it will probably be communicating with X in the near future. If
the hardware address of X has changed then Z can adjust to the
fact by updating it's cache. Z may not have to send any messages
of its own later to find out the binding of X.
- If Z is actually the target of the ARP
request from X, Z will place X's binding in its cache whether or
not there is a binding for X in the cache beforehand.
- This is worthwhile because when Z is the target it means that X is
seeking the address of Z so that X can communicate with Z.
Naturally, Z will be likely to want to communicate with X right
after X communicates with Z. If things happen that way, Z will
not have to bother to send any messages to get the binding of X.
-
- 19.15 Layering, Address Resolution, Protocol Addresses
- ARP operates at the "Network Interface Layer" of the TCP/IP
protocol stack.
-
- 19.16 Summary