How do hosts route packets




















Router 1 also serves as the default router for Router 1 maintains routing information for all systems on Router 2s interfaces connect to internal network For an example of configuring a default router, refer to Example 5—4. Packet-forwarding routers forward packets but do not run routing protocols. This type of router receives packets from one of its interfaces that is connected to a single network. These packets are then forwarded through another interface on the router to another local network.

In Figure 5—3 , Router 3 is a packet-forwarding router with connections to networks Multihomed hosts have two or more interfaces that are connected to the same network segment. A multihomed host can forward packets, which is the default for all systems that run the Solaris OS. Figure 5—3 shows a multihomed host with both interfaces connected to network For an example of configuring a multihomed host, refer to Example 5—6.

Single interface hosts rely on the local routers, not only for packet forwarding but also for receiving valuable configuration information. Figure 5—3 includes Host A on the This section contains a procedure and example for configuring an IPv4 router. Because a router provides the interface between two or more networks, you must assign a unique name and IP address to each of the router's physical network interfaces. Thus, each router has a host name and an IP address that are associated with its primary network interface, in addition to a minimum of one more unique name and IP address for each additional network interface.

You can also use the following procedure to configure a system with only one physical interface by default, a host to be a router. You can configure all interfaces of a router during Solaris system installation. The following instructions assume that you are configuring interfaces for the router after installation.

After the router is physically installed on the network, configure the router to operate in local files mode, as described in How to Configure a Host for Local Files Mode.

This configuration ensures that routers boot if the network configuration server is down. On the system to be configured as a router, assume the Primary Administrator role or become superuser. The Primary Administrator role includes the Primary Administrator profile. The following example output from dladm show-link indicates that a qfe NIC with four interfaces and two bge interfaces are physically available on the system.

The following example output from ifconfig -a shows that the interface qfe0 was configured during installation. This interface is on the The remaining interfaces on the qfe NIC, qfe1 - qfe3 , and the bge interfaces have not been configured. Interfaces that are explicitly configured with the ifconfig command do not persist across reboots. For example, to assign the IP address The interfaces timbuktu and timbuktu are on the same system.

Notice that the network address for timbuktu is different from the network interface for timbuktu. The difference exists because the physical network media for network Network prefixes and their dotted-decimal equivalents can be found in Figure 2—2. At this point, the router can forward packets beyond the local network. The router also supports static routing , a process where you can manually add routes to the routing table. If you plan to use static routing on this system, then router configuration is complete.

However, you need to maintain routes in the system routing table. For information on adding routes, see Configuring Routes and the route 1M man page. Turn on the default IPv4 routing protocols in either of the following ways:. For information about the routeadm command, see the routeadm 1M man page.

This example shows how to upgrade a system with more than one interface to become a default router. The goal is to make Router 2, which is shown in Figure 5—3 , the default router for network Router 2 contains two wired network connections, one connection to network The example assumes that the router operates in local files mode, as described in How to Configure a Host for Local Files Mode.

After becoming superuser or assuming an equivalent role, you would determine out the status of the system's interfaces. The output of dladm show-link indicates that three links are available on the system. Only the ce0 interface has been plumbed. You would begin default router configuration by physically connecting the bge0 interface to the Then, you would plumb the interface and make it persist across reboots.

Continue by configuring the following network databases with information about the newly plumbed interface and the network to which it is connected:. Finally, use SMF to enable packet forwarding and then enable the in. However, the default router configuration for network You would need to do the following:. Modify each host on Define a static route to the border router in the routing table of Router 2.

For more details, refer to Routing Tables and Routing Types. Both routers and hosts maintain a routing table. The routing daemon on each system updates the table with all known routes.

The system's kernel reads the routing table before forwarding packets to the local network. The routing table lists the IP addresses of networks that the system knows about, including the system's local, default network. The table also lists the IP address of a gateway system for each known network.

The gateway is a system that can receive outgoing packets and forward them one hop beyond the local network. Most routing protocols used to find pathways to destinations are router based, however.

Hosts are typically configured one of two ways: statically with an IP address, default gateway, and domain name server, or with values learned via the Dynamic Host Configuration Protocol DHCP.

Hosts send all traffic going off the local network to the default gateway, with the hope that the gateway can route the packets to the destination.

Chapter 2 of this book is devoted to host-based routing. Historically, there have been some network technologies in which the hosts were more active. However, this is primarily a Layer 2 function, and is not part of contemporary Ethernet- and IP-based networks.

Recent years have seen a return to utilizing the host of handling the routing function in the area of ad hoc networking. Ad hoc routing typically does not run on the traditional network infrastructure.

Applications include sensor networks, battlefield communications, and disaster scenarios in which the infrastructure is gone. In these situations, nodes will handle forwarding of traffic to other nodes.

Related ideas are the ad hoc applications and It is important to realize that with the If a wireless node is not within range of the source host, it will miss the transmission.

In addition, the application is important. Are the nodes actually sensors which have very little in the way of resources? Are they moving quickly? But these ideas are all a little beyond the scope of this book. The point being made here is that hosts and the host routing table are very active in the processing of packets.

Historically, nodes on some networks were even more involved, and if ad hoc routing protocols are any indication, those days are not gone for good. It is important to remember that Layer 2 link layer frames and MAC addresses do not live beyond the router. This means that an Ethernet frame is destroyed when it hits a router. When operating in a network, a router can act as the default gateway for hosts, as in most home networks.

A router may be installed as an intermediate hop between other routers without any direct connectivity to hosts. In addition to routing, routers can be asked to perform a number of other tasks, such as network address translation, managing access control lists, terminating virtual private network or quality of service.

The routing process is the actual movement of IP packets from one port to another and the routing table holds the information used by the routing process.

When a router is configured, the routing table is constructed by bringing interfaces up and providing the interfaces with IP addresses. A simple Cisco routing table is shown in Figure The routing table shown in Figure indicates that the router knows of two networks: Routing tables can be comprised of several different route types: directly connected, static, and dynamic.

Two directly connected routes are seen in Figure Directly connected routes have preference over and above any other route. Static entries are those that are manually installed on a router by the network administrator. For specific destinations, and in small or stable network environments, manually configured static routes can be used very successfully. By using static routes, the network administrator has determined the pathway to be used to a particular destination network.

The static route will supersede any pathway learned via a routing protocol because of the administrative distance, discussed later in this chapter. Another important idea that is central to routing is the next hop.

The next hop is a router that is one step closer to the destination from the perspective of a particular router. The next hop is the router to send packets to next.

In many networks, a series of next hops are used. A medium-sized routed topology is shown in Figure So, from the perspective of R1, R2 would be the next hop used to get to both the This topology has three routers, which are cabled to each other via the switches shown. There are several ways to emulate a topology such as this, but this configuration was chosen for clarity.

To bring up an interface, it has to have been given the no shutdown command and have a link pulse. The routing tables of the routers will only contain the directly connected routes. Each router is only aware of the two networks for which is has interfaces. Table depicts the routing tables at this point. What is clear from these tables is that the routers do not have a complete picture of the whole network. After processing its host routing table see Chapter 2 , it will forward the traffic to its default gateway R1 will now consult its routing table and discover that it only has entries for networks on the left side of the topology.

Without knowledge of the destination network, R1 will issue the ICMP destination unreachable message. Just for fun: The How is this problem solved? In small networks such as this, the network administrator can issue routing commands to the routers providing them with additional forwarding information. These would be the static routes. For Cisco routers, the command ip route is used.

It has three fields that have to be filled in by the network administrator:. For example, R1 could be told how to get to the The commands are almost identical except for the destination network. A couple important points: the last field specifying the forwarding router interface With these two commands, the behavior is that from R1 the traffic is destined for the two networks specified should be sent to R2.

The mask is also the mask of the destination network and not the mask used locally. It is possible that these masks are different. This correct form is called a recursive route. After issuing the commands on R1, the routing tables would be updated as listed in Table :. While this is an improvement, it only solves part of the problem. Now R1 understands that traffic bound for these networks has to go to R2, but what does R2 do next?

In the case of the R2 can ARP for hosts since they will be on the same network. But since traffic is going to The routing table is updated accordingly and we can breathe a sigh of relief as the packets finally made it to the Getting to the destination network is only half the battle—packets still have to get back.

Examining the routing table on R3, it can be seen that the router does not understand where the From the perspective of Node A, it will appear as though the transmission was never answered. To be complete, ip route commands for all of the unknown networks would have to be issued on each router and the routing tables updated. After all of the ip route commands have been issued, the routing table would look like the entries seen in Table The actual routing table for R2 and the ip route commands issued on R2 are both shown in Figure In the last few routing tables, all of the destination networks can be reached either because they are directly connected or have a static route which points to a neighbor router that might be able to help.

This is not always the case, as was described before the routing tables were fully populated. There are several options regarding the arguments for the ip route command and there are times when the usage seen in this chapter should be modified. Serial links provide an example in which the last field should be an interface rather than a next hop ip address.

Reviewing the changes outlined in Figure , there are two common mistakes made when trying to configure static routing. These will be reviewed from the perspective of R2. The following is a mistake:. This command asks the router to forward traffic to itself. The network administrator and the router stare at each other for a bit, and then the admin is likely to try the second common mistake. This also occurs when addresses are entered incorrectly.

The proper form is shown in Figure The second mistake does not actually specify a forwarding router IP address, but rather a physical interface. This results in higher processing load on the router, and is usually reserved for use with interior routing protocols. The command and the resulting routing table are shown in Figure Though they are static routes, the routing table indicates that the The topology shows that this is clearly not the case.

The reason for the higher processing is that the command is not specific enough and the router actually has no idea where to send the traffic. It is similar to a person who, wishing to mail a letter, addresses the letter but then simply opens the front door and throws the letter outside, hoping that it will get to the destination.

What is really interesting is the effect on network traffic. This means that ARP messages are not generally forwarded by routers and hosts do not ARP for nodes not on their own network. An exception can be found in Proxy ARP, but it is rarely used. Lastly, MAC addresses typically do not have any meaning beyond their own network. But look what happens when the commands shown in Figure are used. Figure shows that R3 This breaks all of the basic behaviors and is just plain wrong.

It makes me uncomfortable just looking at it. It is often the case that several destinations can be reached via the same pathway. In cases like this, the routing table can continue to grow even though many of the routes share common fields. This was true in the routing tables for both R1 and R3. Routing table entries sharing the same pathway can be replaced with a smaller set of routes. The best examples are default routes and aggregation. Aggregation or route summarization is a technique for reducing the number of entries in a routing table by shortening the prefix length.

The effect is to collect a series of destinations into a single entry. The default route is a special case of a static route. Normally we think of default gateways or routers for hosts. Routers can also have default gateways. Like a host, when the routing table is exhausted and no matches are found for the destination, the default route is used.

In Cisco-speak, this is called the gateway of last resort. Again, just like static routes, the network administrator is assuming that the next hop router knows something that the current router does not: how to get to either the destination or the next hop. Figure shows the topology with the candidate default routes based on the information from Table For R1, all destinations not directly connected must be reached by forwarding traffic to For R3, all destinations not directly connected must be reached by forwarding traffic to Since this is a request for a remote host, which means it is not destined to be sent to a host on the local network, the packet must be sent to the router the gateway for Network A so that it can be routed to the correct remote network which is Network B.

So it then sends an ARP broadcast. This is also one of the reasons why sometimes the first "ping" will timeout. Host A now has everything it needs in order to transmit a packet out on the local network to the router. Now, the Network Layer hands down to the Datalink Layer the packet it generated with the ping ICMP echo request , along with the hardware address of the router. This includes the source and destination hardware address MAC and the type field which specifies the Network Layer protocol e.

At the end of the frame, in the FCS portion of the frame, the Datalink Layer will stick a Cyclic Redundancy Check CRC to make sure the receiving machine the router can figure out if the frame it received has been corrupted.

To learn more on how the frame is created, visit the Data Encapsulation - Decapsulation. Since this will be a match, the type field in the frame will be checked to see what the router should do with the data packet. IP is in the type field, and the router hands the packet to the IP protocol running on the router. As you can see from the output above, this router has two directly connected routes to the subnets The character C in the routing table indicates that a route is a directly connected route.

So when host A sends the packet to host B, the router will look up into its routing table and find the route to the The router will then use that route to route packets received from host A to host B. Skip to content. Consider the following example of IP routing: Host A wants to communicate with host B, but host B is on another network.

Default gateway A default gateway is a router that hosts use to communicate with other hosts on remote networks. The following example explains the concept of a default gateway more thoroughly.



0コメント

  • 1000 / 1000