The task of finding how to get a packet to its destination is referred to as routing. IP presumes that a system is attached to some local network, and it is further presumed that the network system can send packets to any other system on the same network. IP faces a challenge when a system is asked to send a packet to a system on a different network. This problem of forwarding packets to different networks is handled by gateways (systems that connect a network with one or more other networks).
Gateways often are routers with more than one network interface, as illustrated Figure 3-3.
For example, a router has two different Ethernet interfaces; one connected to the 128.6.4.x network, the other connected to the 128.6.3.x network. The router can act as a gateway between these two networks. Routing in IP is based entirely upon the network number of the destination address. The router/gateway determines where to forward the packet based on its routing tables, listing the networks to which the router/gateway is connected. If there is no entry, the packet is then forwarded to the default gateway network, often the Internet.
You can find more detail regarding IP routing in Chapter 11, "Understanding Routers and Routing."