The etcgateways File

routed broadcasts a RIP request immediately on startup, and uses the information in the RIP updates it receives to build a table. The entire reason for running a routing protocol is to use the information from that protocol to build the routing table. On the surface, adding static routes to a dynamic table doesn't seem to make much sense, and generally there is no reason to do so. But it is possible that there are routers on your network that can't or won't provide RIP updates and that must be added to the table manually. The /etc/gateways file provides that capability, in case you need it.

routed reads the /etc/gateways file during startup, and adds the routes defined there to the routing table. The sample entries from a gateways file are enough to illustrate its purpose because all entries in the file have the same basic format. Listing 7.4 shows two sample entries.

Listing 7.4: A sample /etc/gateways file

$ cat /etc/gateways net 0.0.0.0 gateway 172.16.55.254 metric 1 active net 172.16.50.0 gateway 172.16.55.36 metric 1 passive

All entries start with the keywords net or host to indicate whether it is a host-specific route or a network route. The keyword is followed by the destination address. (The destination 0.0.0.0 is a special address that stands for the default route.) The destination address is followed by the keyword gateway and the IP address of the external gateway used to reach the destination.

Next come the keyword metric and the cost assigned to this route. Normally, external gateways are given a cost of 1, but this is arbitrary, so you can assign a higher value if you want. Assigning a higher metric, however, makes sense only if you have two routes to the same destination, and if you want to prefer one of those routes over the other.

All entries end with the keywords active or passive. An active router is expected to participate in the exchange of routing updates. If it fails to respond to routing requests and does not periodically broadcast RIP updates, it is removed from the routing table. This is the normal behavior expected of any RIP router.

A passive router does not participate in the exchange of RIP updates. Perhaps the system runs a different routing protocol. Regardless of the reason, it is not required to participate, and is installed in the routing table as a permanent static route.

The first line in our example creates an active default route. This default route is used during the RIP startup period, but after RIP is up and running, this default router is expected to be an active participant in the routing protocol. If you use a default route when running a routing protocol, use an active default route. A static default route can defeat the purpose of a dynamic routing protocol by not allowing the protocol to update the route when network conditions change.

The second line creates a static route to subnet 172.16.50.0 through router 172.16.55.36. Because this is a passive route, 172.16.55.36 does not need to run RIP. The only reason to create such a route would be that 17216.55.36 does not run RIP.

routed is adequate for some small networks. It requires no installation and very little configuration. However, it is antiquated software that is not suitable for many networks. In particular, it does not support classless IP addresses. If you use classless IP addresses, run a modern routing protocol that supports address masks.

Some Linux distributions no longer provide routed, preferring to rely on more modern routing software. Linux offers two different software packages that provide modern routing protocols. The gateway daemon (gated) is a routing software package found on many Unix systems. Zebra is a routing software package from GNU. These packages provide Linux systems with access to interior and exterior routing protocols that normally run only on dedicated routing hardware, such as Cisco routers.

Was this article helpful?

0 0

Post a comment