A router works in concert with other network hardware to direct network traffic to its intended destination. For example, when you open your Web browser at the office and connect to www .foxnews.com to check the current news, your network router directs the traffic out to the Internet. At that point, other routers take care of getting the traffic to the site and back again with the responses. Another example is when you dial into your ISP from home. The ISP's router(s) connects its network to the Internet and processes traffic going to and from your computer and to and from the computers of other connected customers.
A typical router essentially sits on the fence between two or more subnets. This fence is typically known as a hop, and each time a packet traverses a router, its hop count is incremented. The router exists on all subnets to which it is connected and therefore has connectivity to each subnet. When traffic comes into the router from a particular interface, the router directs the traffic to the appropriate interface. Figure 18-4 illustrates a typical routing scenario. If the number of hops a packet takes to reach a destination is determined to be excessive by a router, the packet will be terminated and a message will be sent back to the sender indicating that the packet expired in transit. This is a safeguard that prevents data that cannot be routed to an interface from eternally moving around the Internet. The typical hop limit is 30 for most routers.
A router examines each packet that comes in to determine the destination network for the packet. It does this by examining the destination address stored in the packet's header. The router then decides which of its interfaces to use to route the traffic (based on its knowledge of adjacent routes) and sends it on its way. For example, assume that a router has four interfaces as shown in Figure 18-4: one for each of the local networks and one that connects to the Internet. A packet comes into the router from subnet A with the destination address 192.168.4.99. The router routes the packet out through the interface connected to subnet B, and the adjacent router at 192.168.1.2 routes the packet on to network (B). Another packet comes from network (A) with the destination address 18.104.22.168. The router sends that packet out through the interface connected to the Internet because it doesn't belong in any of the local subnets.
Routers use routing tables containing routes to determine where to send packets. Routes help the router know where different networks are located relative to its interfaces so that it can send packets out on the appropriate interface and have them delivered to the proper destination. Each route in the routing table falls into one of the following types:
♦ Network route. These provide a route to a specific network ID and therefore to all host addresses within that network.
♦ Host route. These provide a route to a specific host, defining not only the network but also the address of the host.
♦ Default route. The default route is used to route all traffic for which there is no specific network route or host route. For example, a router connecting a local network to the Internet would have a default route pointing all traffic to the Internet interface.
Each route in the routing table has certain general properties:
♦ Network ID/host address/subnet mask. These properties identify the destination network ID or host address and the destination subnet. The router checks the destination addresses in the packets against these entries to determine a match. If the packet address matches the criteria, the router uses the forwarding address and interface data associated with the route to process the packet.
♦ Forwarding address. The router forwards matching packets to this address. The address could be that of another router or the address of a network interface on the local router (directing the traffic out a specific port on the router).
♦ Interface. This is a port number or other logical identifier of the port through which the traffic is routed for the given route.
♦ Metric. The metric specifies the relative price of the route based on cost, available bandwidth, and so on. Where multiple routes exist to a given network or host, the route with the lowest metric is used.
When a packet comes in to the router, the router checks the destination address in the packet's header against the routing table to determine which route applies to the packet. If the router matches the destination address with a route, it forwards the packet using the forwarding address associated with the route. If the router finds no matching route, it forwards the packet using the default route (if one is configured on the router). The default route is used to handle any traffic for which a specific route is not indicated.
How do routers learn their routes? One method is to learn routes dynamically from other routers and propagate them to other routers. Routers communicate with one another using routing protocols, with the two most common protocols for IP routing being Routing Information Protocol (RIP) and Open Shortest Path First (OSPF). Windows Server 2003 supports both (and can support additional protocols). RIP and OSPF are explained shortly.
A second method is for routers to use static routes. When you configure the router, you create the static route, which creates the static route entry in the routing table. A router can use static routes to handle all its traffic, a common situation for small to mid-size organizations. For example, if you only connect a few local subnets to the Internet, you can use static routes to handle all traffic, with a default route handling traffic to the Internet. You can read more about static routes later in the section "Configuring static routes."
Was this article helpful?