6.9. Using Quagga's Command Line

You like to run commands from a command shell, and not always have to edit configuration files. How do you do this with Quagga?

Quagga comes with its own command shell, the Virtual TeletYpe shell vtysh. With vtysh, you can interact with all Quagga daemons on the local machine. You may also communicate directly with each routing daemon with telnet.

First, you need to edit or create /etc/quagga/vtysh.conf:

	!/etc/quagga/vtysh.conf
	hostname router1
	username root nopassword

On Debian, add this line to /etc/environment:

	VTYSH_PAGER=more

Now, open up a new terminal, and fire it up as the root user:

	root@xena:~# vtysh

	Hello, this is Quagga (version 0.99.4).
	Copyright 1996-2005 Kunihiro Ishiguro, et al.

	router1#

vtysh has two modes: normal and enable. In normal mode, you can view system status; in enable mode, you can edit configurations and run commands. vtysh opens in normal mode. These two commands show both sets of available commands:

	router1# ?
	router1# list

You can view all current configurations with one command:

	router1# write terminal

To run any routing commands, or to change configurations, change to configure mode:

	router1# configure terminal
	router1(config)#

The same commands display all the available commands:

	router1(config)# ?
	router1(config)# list

exit closes each session in turn. vtysh will run even when no Quagga daemons are running.

A second option is to use telnet. telnet can talkto only one daemon at a time, like this example for ripd:

	carla@xena:~$ telnet localhost 2602
	Trying 127.0.0.1...
	Connected to localhost.
	Escape character is '^]'.

	Hello, this is Quagga (version 0.99.4).
	Copyright 1996-2005 Kunihiro Ishiguro, et al.

	User Access Verification

	Password:
	router1>

Any user who knows the daemon's password can log in from telnet.

Just like vtysh, this opens a session in normal mode. Use the enable command to switch to enable mode, then configure terminal to run configuration commands:

	router1> enable
	router1# configure terminal
	router1(config)#

exit, end, or quit get you out of there; ? and list show commands.

The username root nopassword line is necessary for vtysh to even start. The user named here does not need a password to open a vtysh session. You may substitute any user you like. Make sure this file is readable and writable only by the user named in the file, and keep in mind there is no way to set a password.

If you get a blank screen with (END) in the bottom-left corner, add VTYSH_PAGER=more to your environment variables, either in your own .profile, or globally in /etc/ environment.

The hostname can be anything you want, so you could give each routing daemon a different hostname to help you keep track.