Routers connect networks. Routers range from someone's desktop PC running Internet sharing software to multimillion-dollar systems of specialized hardware and software. In the original work on TCP/TP, the designers wanted to be able to move data across a network even if parts of the network became disrupted. For example, if a network link were taken out by enemy attack, the traffic on that link would automatically reroute to a different link. This reliable scheme is called dynamic rerouting. Your system doesn't have to be a victim of an enemy attack for dynamic rerouting to be valuable. If a forklift cuts a cable in a warehouse, for example, dynamic rerouting means that inventory data can still be sent across a network via a different route.
(In network parlance, you can pronounce router either rowter or rooter. Just pick a side and join the battle. People pronounce it both ways and some are willing to fight for their choice.)
A router extends a LAN by linking two or more network segments that may or may not use the same media type. The router permits each connected network to maintain its independent identity and address. Figure 1 shows a small intranet consisting of two subnets. The router connects the subnets and connects the entire intranet to the Internet.
When someone at address 130.103.2.1 sends e-mail to 130.103.2.4, the router is smart enough to see that the message is staying on the same subnet. There is no need to investigate any routes to the other subnet or to the Internet. When 130.103.2.1 sends e-mail to 130.103.1.4, however, the router forwards the message to the other subnet. When someone from anywhere within the intranet sends a message outside the 130.103 intranet, the router forwards the message out to the Internet.
What makes routers special is that they're intelligent enough to understand IP addresses. In fact, the decisions the router makes about directing the packets of your data are based on the network portion of the IP address. A router contains a network interface card for each segment of the network that it connects. Each network interface card has a different IP address because the router itself is a member of each network. The router gets most of its intelligence from routing tables. Routing tables are stored on the router and contain information about the following:
- Paths (routes) to particular networks
- How to handle special kinds of traffic
- Priorities for certain connections
On big fancy routers, routing tables also store statistics on which routes are fastest and shortest.
Understanding how routers work
Routers work at the Internet, data link, and physical layers of the TCP/IP structure. A router resembles an octopus whose tentacles represent all of your cabling types. Routers are aware of the multiple paths that your data packets can take across the network to their final destination. The router knows about other routers on the network and can choose the most efficient path for the data to follow. This efficient path may change as network devices change and as traffic comes and goes.
For example, on Monday, the most efficient path may be from network A to network C to network B. On Tuesday, however, the most efficient path may be from network A to network D to network B because network C is broken. Because the router knows about any problems on the network path, it can detour your data when necessary. Not only are routers intelligent, they talk to each other and share knowledge, especially traffic reports: "Route A is jammed right now. Take route B instead. Route C has disappeared."
Routers use a routing protocol to find out information about the entire network and to determine the optimal path for sending a packet on to its destination. What's optimal? Is it the shortest path (fewest hops from one host to another)? Or the fastest path (more hops on speedier links)? Or the least congested path?
Suppose you want to go from Boston to New York City (NYC) to visit the Empire State Building. Your top three choices are probably these:
- Drive to NYC on Interstate 95 and use a city map to find the Empire State Building.
- Drive to Boston's Logan Airport. Fly to JFK Airport in NYC. Take a taxi to the Empire State Building.
- Drive to Boston's South Station. Take a train to Penn Station in NYC. Take the subway to the Empire State Building.
Which way do you think will get you there fastest? If you've never driven to Logan Airport during rush hour and through construction, you would guess that flying from Logan to JFK is the fastest route. However, depending on city traffic, flying may actually be the slowest way.
The shortest way isn't always the fastest way. Nor is the most direct route always the fastest way. And if you never go to New York City even once in your life, these facts are rules to live by on the network, as well.
Routers use packet switching to move messages from one place to another on a network. Messages are divided into packets before they move out onto a network. During transmission, each packet is independent of the others. In fact, each packet in a message could take a different route to the destination. That's packet switching; the point is that all the packets in a message get to the destination, not how they get there.
Choosing a router
Depending on the number of machines and networks you need to connect, you may not need special purpose hardware to be your router.
- A router for a Small Office/Home Office: If several networked computers share a connection to the Internet via cable or DSL, you can use the computer attached to the network device as your router. You need to add some kind of Internet sharing software to this computer. Microsoft's ICS (Internet Connection Sharing) is one example of Internet-sharing software. Software packages are available for other operating systems as well. The routing software checks to see whether packets should stay on the local net or go out to the Internet. Because the routing software doesn't work too hard, it doesn't disturb other programs that are running on the computer.
- Be sure to protect your Internet connection with a firewall.
- For larger companies: Routers that do more than route: Companies that connect their subnets to the Internet need a more powerful, more intelligent router than a small office with a dozen computers. A special purpose router is the solution. A combination router/firewall is a good solution.
- Really big routers for really big networks: These are the routers that connect the networks of large worldwide corporations. Routers this large and complex handle millions of packets per second and cost millions of U.S. dollars. They form the backbone of the Internet itself.