Monday, June 23, 2014

Internetworking with TCP/IP Notes (Chapter 8)

Chapter 8 Internet Protocol: Forwarding IP Datagrams

8.1 Forwarding in an Internet
Networking professionals started using the term forwarding to refer to the process of choosing the path for a packet. Forwarding occurs at several levels.

Goal of IP is to provide a virtual network that encompasses 
multiple physical networks, and offers a connectionless datagram delivery service that is an abstract version of the service provided by an Ethernet switch.

The information IP software uses to make forwarding decisions is known as a Forwarding Information Base(FIB). Each IP module has its own FIB, and each has to 
make forwarding decisions.

he Internet design distinguishes between hosts and routers. Although a host with multiple network connections can be configured to act as a router, the resulting system may not perform as expected.

8.2 Direct and Indirect Delivery

We may divide forwarding into two forms: direct delivery and indirect delivery.

Direct delivery, the transmission of a datagram from one machine 
across a single physical network directly to another if they both attach directly to the same underlying physical transmission system

Indirect delivery occurs when the destination of a datagram is not on a directly attached network. Because the ultimate destination cannot be reached directly, the sender must choose a router, transfer the datagram across a directly-connected network to the 
router, and allow the router to forward the datagram on toward the ultimate destination.

8.3 Transmission across a single network
Transmission of an IP datagram between two machines on a single physical network does not involve routers. The sender encapsulates the datagram in a physical frame, binds the next-hop address to a physical hardware address, and sends the resulting frame directly to
the destination.

Because the internet addresses of all machines on a single network include a common network prefix and extracting that prefix requires only a few machine instructions, testing whether a destination can be reached directly is efficient.

8.4 Indirect Delivery
Routers in a TCP/IP internet form a cooperative, interconnected structure. Datagrams pass from router to router until they reach a router that can deliver the datagram directly.

The internet design concentrates forwarding knowledge in routers and insures that a router can forward an arbitrary datagram. Hosts rely on routers for all indirect delivery. We can summarize:

A host only knows about directly-connected networks; a host relies on routers to transfer datagrams to remote destinations. Each router knows how to reach all possible destinations in the internet; given a datagram, a router can forward it correctly.


8.5 Table-Driven IP Forwarding
The IP forwarding algorithm employs a data structure that stores information about possible destinations and how to reach them. The data structure is known formally as an Internet Protocol forwarding table or IP forwarding table, and informally as simply a forwarding table.

Conceptually, it is desirable to use the principle of information hiding and allow machines to make forwarding decisions with minimal information. Because it allows forwarding to be based on network prefixes, the IP addressing scheme controls the size of forwarding tables.

8.6 Next-Hop Forwarding
A forwarding table contains a set of pairs (N, R), where N is the network prefix for a network in the internet and R is the IP address of the “next” router along the path to network N. Router R is called the next hop, and the idea of using a forwarding table to store a next hop for each destination is callednext-hop forwarding.

To hide information, keep forwarding tables small, and make forwarding decisions efficient, IP forwarding software only keeps information about destination network addresses, not about individual host addresses.

Choosing routes based on the destination network prefix alone has several consequences. First, in most implementations, it means that all traffic destined for a given network takes the same path. As a result, even when multiple paths exist, they may not be used concurrently.

Second, we need to arrange a way for the final router to send reports of delivery problems back to the original source. Third, because each router forwards traffic independently, datagrams traveling from host A to host B may follow an entirely different path than datagrams traveling from host B back to host A.

8.7 Default Routes
We say that the next hop specified in a default route is a default router. A default route is especially useful when many destinations lie beyond a single router.

8.8 Host Specific Routes
The ability to specify a route for individual machines turns out to have several possible uses:

* Control over network use. An administrator can send traffic for 
certain hosts along one path and traffic for remaining hosts along another path.

* Testing a new network.
* Security. An administrator can use host-specific routes to direct traffic through security systems.

8.9 The IP Forwarding Algorithm
IP software should take the following steps when deciding how to forward a datagram:

1. Extract the destination IP address, D, from the datagram
2. If the forwarding table contains a host-specific entry for destination D,
Forward the datagram to the next hop specified in the entry
3. If the network prefix of D matches the prefix of any directly connected network,
Send the datagram directly over the network to D
4. If the forwarding table contains an entry that matches the network prefix of D,
Forward the datagram to the next hop specified in the entry
5. If the forwarding table contains a default route,
Forward the datagram to the next hop specified in the default route
6. If none of the above cases has forwarded the datagram, Declare a forwarding error

8.10 Longest-Prefix Match Paradigm
To make the algorithm work correctly, entries in the table must be examined in an order that guarantees entries with a longer mask are checked before entries with a shorter mask.

8.11 Forwarding Tables and IP Addresses
IP forwarding does not alter the original datagram. In particular, the datagram source and destination addresses remain unaltered; they specify the IP address of the original source and the IP address of the ultimate destination. When it executes the forwarding algorithm, IP computes a new address, the IP address of the machine to which the datagram should be sent next. The new address is most likely the address of a router.

The IP address selected by the IP forwarding algorithm is called a next-hop address because it tells where the datagram must be sent next. IP does not store the next-hop address at all. After it executes the forwarding algorithm, the IP module passes the datagram and the next-hop address to the network interface responsible for the network over which the datagram must be sent.

When it receives a datagram and a next-hop address from IP, the network interface must map the next-hop address to a hardware address, create a frame, place the hardware address in the destination address field of the frame, encapsulate the datagram in the payload area of the frame, and transmit the result.

Internet forwarding only uses IP addresses; the binding between an IP address and a hardware address is not part of the IP forwarding function. Because each forwarding table entry includes an address mask, a single unified forwarding algorithm can handle network-specific routes, host-specific routes, and a default route.

8.12 Handling Incoming Datagrams
When an IP datagram arrives at a host, the network interface software delivers the datagram to the IP module for processing. If the datagram’s destination address matches the host’s IP address (or one of the host’s addresses), IP software on the host accepts the datagram and passes it to the appropriate higher-level protocol software for further processing. 

If the destination IP address does not match one of host’s addresses, the host is required to discard the datagram (i.e.,hosts are forbidden from attempting to forward datagrams that are accidentally forwarded to the wrong machine). There are four reasons why a host should refrain from performing any forwarding. 

First, when a host receives a datagram intended 
for some other machine, something has gone wrong with internet addressing, forwarding, or delivery.

Second, forwarding will cause unnecessary network traffic (and may steal CPU time from legitimate uses of the host). 

Third, simple errors can 
cause chaos. If a computer accidentally broadcasts a datagram that is destined for a host,H, a copy of the datagram will be delivered to every host on the network. Each host examines the datagram and forwards the copy to H, which will be bombarded with many copies.

Fourth, as later chapters show, routers do more than merely forward traffic. Routers also propagate information to ensure that their forwarding tables are consistent and correct.

No comments:

Post a Comment