31 March 2010

Using RIP Dynamic Routing on Debian


Your networks aren’t all that complex, but you don’t want to hassle
with manually configuring routes. Isn’t this the kind of work that
computers should be doing, the repetitive boring stuff? Your routers
are Debian-based.


Indeed, this is the sort of drudgery that computers excel at handling.
There are two categories of dynamic routing protocols: interior and
exterior. In this recipe, we shall look at Routing Information Protocol,
the simplest interior routing protocol. RIP is included in the Quagga
suite of routing protocols.

Installation is boringly easy:
# aptitude install quagga

Now, you must edit some configuration files. Start with
/etc/quagga/daemons, and enable zebra and ripd:

# /etc/quagga/daemons

Next, create /etc/quagga/zebra.conf:

hostname router1
password bigsecret
enable password bigsecret
service advanced-vty
log file /var/log/quagga/zebra.log
!administrative access controls- local machine only
access-list localhost permit
access-list localhost deny any
line vty
access-class localhost

Now, create /etc/quagga/ripd.conf:

hostname router1
password moresecret
enable password moresecret
router rip
network eth1
redistribute static
redistribute connected
service advanced-vty
log file /var/log/quagga/ripd.log
!administrative access controls- local machine only
access-list localhost permit
access-list localhost deny any
line vty
access-class localhost

And now, set correct ownership and file permissions:

~# chown quagga:quagga ripd.conf zebra.conf
~# chown :quaggavty vtysh.conf

Finally, add this line to /etc/environment:

Now, fire it up:

# /etc/init.d/quagga start

Do this on all of your routers, and you’re finished.

Give it a couple of minutes, then fire up your favorite
command to view your routing table:

~$ /sbin/route -n
~$ ip route show
~$ netstat -rn


Quagga’s configuration files use exclamation marks for comments.
All of the Quagga daemons are controlled from a single startup file:
~# /etc/init.d/quagga {start|stop|restart|force-reload| [daemon]}

You could do no more than this recipe and be content. Each Quagga
daemon broadcasts its routing table every 30 seconds via multicast
to your other RIP-enabled routers, and so you don’t have to hassle
with creating static routes all over the place.

Debian, by default, limits vty access to the local machine in
/etc/quagga/debian/conf, and Fedora uses /etc/sysconfig/quagga.

Some definitions for ripd.conf:

This is arbitrary, and has nothing to do with the router’s Linux
hostname. It controls the hostname you see displayed on the vtysh
or telnet command line.

router rip
Specify the rip routing protocol here. The default is to send v2 and
receive 1 and 2. Other protocol options are ripng, ospf, ospf6, and
bgp, which of course you would use in their respective configuration

network eth1
Which interface or interfaces ripd should listen on. Name additional
interfaces on separate lines.

redistribute static
Share any static routes; these are listed in zebra.conf.

redistribute connected
Share directly connected routes. For example, your router is
connected to the network, so it will tell your other
routers how to get to it.

service advanced-vty
Enables advanced vty functions such as command history and tab-completion.

The two access-list lines define a new class, localhost. The class
name can be anything you want; it doesn’t have to be localhost.
After defining the class, the line vty access-class localhost lines
mean “only allow vty logins on the local machine. No remote

The default logging level is debugging, which creates the most output.
You may specify any of the following loglevels: emergencies, alerts,
critical, errors, warnings, notifications, information, or debugging,
like this:

log file /var/log/quagga/ripd.log warnings

Quagga includes five routing daemons: ripd, ripngd, ospfd, ospf6d,
and bgpd, and one manager daemon, zebra. zebra must always be
started first. Each daemon has its own port that it listens on:

zebrasrv 2600/tcp
zebra    2601/tcp
ripd     2602/tcp
ripngd   2603/tcp
ospfd    2604/tcp
bgpd     2605/tcp
ospf6d   2606/tcp
ospfapi  2607/tcp
isisd    2608/tcp

See Also

• Quagga documentation: http://www.quagga.net/docs/docs-info.php
• /usr/share/doc/quagga/README.Debian
• man 8 ripd
• man 8 zebra

[*] My Book


No comments: