Running ospfd

In this section, a router is configured to send RIPv2 packets on one subnet—the one that it shares with the sample host configured in Listing 7.9—and OSPF link-state advertisements on another subnet that it shares with other routers. For this configuration, we create a zebra.conf file to configure the routing manager, a ripd.conf file to configure the RIPv2 protocol daemon, and an ospfd.conf file to configure the OSPF protocol daemon. The zebra.conf file is almost identical to the one shown in Listing 7.5.

Listing 7.11: A zebra.conf File for a RIP/OSPF Router hostname subnet60gw password Wats?Watt? enable password CHLLlns log file /var/log/zebra.log !

interface eth0

ip address multicast

interface eth1

ip address

The zebra.conf file in Listing 7.11 contains everything that was found in Listing 7.5, except for the static route. All of this was explained earlier, so there is no need to explain it again here.

The ripd.conf file used for this configuration is shown in Listing 7.12.

Listing 7.12: A ripd.conf File for a RIP/OSPF Router

! Enable RIPV2

! Advertise routes learned from OSPF with a cost of 5

! Use simple authentication for updates password RIPItup enable password RaceitUP

interface eth0

ip rip authentication string EZdozIt

router rip redistribute ospf metric 5 network eth0

This configuration is very similar to the ripd.conf file shown in Listing 7.9, but there are differences. First, we have placed the passwords in this file so that the RIP router configuration can be maintained through the vtysh interface.

Second, because this is a router, it sends routing updates. Therefore, we use a network clause under the router rip statement to specify the network on which routing updates will be distributed. As described earlier, the network can be defined by an interface name or by an IP address. In Listing 7.12, it is defined by an interface name.

The third difference is that this configuration contains a redistribute clause, which defines whether routes learned from OSPF will be advertised to RIP neighbors and what RIP cost will be assigned to those routes. Routes learned from OSPF do not have a valid RIP cost. The metric defined on the redistribute clause is used as a default metric when OSPF routes are advertised to RIP neighbors. The redistribute clause in Listing 7.12 tells RIP to advertise routes learned from OSPF with a cost of 5. Of course, for RIP to learn routes from OSPF, ospfd must be properly configured.

Listing 7.13 shows a possible ospfd.conf configuration for this router.

Listing 7.13: A Sample ospfd.conf File

! Enable OSPF; connect to the backbone area ! Use simple authentication password Mutt-N-Jeff enable password SURtest !

interface ethl ip ospf authentication-key UTrustME ip ospf priority 5

router ospf ospf router-id network area 0

The interface statement sets two OSPF parameters. The ip ospf authentication-key clause defines the clear text string used to identify valid OSPF advertisements. Like the clear text string used for RIPv2 authentication, this string is intended to prevent accidental updates from misconfigured systems; it is not intended to provide real security. OSPF supports MD5 for stronger authentication.

The ip ospf priority clause defines the priority number this system uses when the area elects a designated router. In Listing 7.13, the priority number is set to 5—possible values are 0 to 255. The larger the priority number, the less likely the router will be elected the designated router. Give your most powerful router the lowest priority number.

A designated router is used to reduce the size of the link-state database and thus the complexity of calculating the Dijkstra graph of the area. The designated router treats all other routers in the area as neighbors, but all other routers treat only the designated router as a neighbor.

To understand how this reduces the size of the link-state database, think of a network of five routers. Without a designated router, all five routers advertise four neighbors, for a total of 20 neighbors in the database. With a designated router, only that router advertises four neighbors. The other four routers advertise one neighbor for a total of eight neighbors in the database. The larger the network, the more important it is to use a designated router.

The router ospf statement enables the OSPF protocol. In Listing 7.13, the router ospf statement contains two clauses. The ospf router-id clause defines the router identifier used for OSPF advertisements. Normally, this is set to the primary address of one of the interfaces used for OSPF. On this sample router, only one network interface is being used for OSPF, so the address of that interface is used as the router identifier.

The network clause identifies the network over which OSPF routes will be exchanged. In the ospfd.conf file, the network on the network clause is always defined by an IP-address/network-mask pair. The network clause also identifies the area of which the network is part. Remember that OSPF divides the autonomous system into areas, and every OSPF router must connect to some area. As mentioned earlier, the area that interconnects all other areas within the routing domain is called the backbone area. The number assigned to the backbone area is 0. Therefore, the network clause in Listing 7.13 specifies that this router is connected to the backbone area.

A simple OSPF configuration, such as the one shown in Listing 7.13, should be adequate for any Linux system that needs to run OSPF. Much of the configuration information will come from the network designer who defines your routing hierarchy. The area you connect to, the type of authentication used, the authentication password, and the priority number of your system are all design decisions that will be made before your network even begins to run OSPF.

As a final example of configuring the Zebra suite, we configure the router that attaches the OSPF network to the outside world via BGP.

Was this article helpful?

0 0

Post a comment