Internet Architecture
As shown above, the Internet consists of various physical networks (Net1 … Netn) connected together as a single large network. Each network may have host machines connected or other networks connected within it. G1 .. Gn represents the Gateways or routers that connects two networks. Gateways or routers routes data packets from a host in a network, say Net1 to the desired host in any of the connected networks. The gateway G1 has a routing table that stores the network addresses and address of the next gateway (if any) for each network address. If the data packet to be sand to a host in Net2, G1 routes it to the appropriate network and if its meant for another network (other than N2), it routes the data packets to the router which is near to the destination point.
Gateways or routers are mini-computers that routes the packets not based on destination host but based on destination network. Since the number of networks is < the number of hosts, routers require to store only lesser information that is proportional to number of networks and not to number of machines.