The Command Line Interface¶
This guide is purposed to give some general tips and tricks on how to interact with routers and switches used in TTM4240 lab exercise 1. This guide assumes some familiarity with general command line interfaces (CLI) and will not give a full in-depth guide on all commands.
Terminology¶
FRR - Free Range Routing. A Unix-based routing-package that transforms a computer into a router. In this guide, FRR will be used to express the software interaction exclusively, without thinking of the software as a whole.
IOS - Cisco’s Interswitching Operating System. Cisco iOS is an operating system with its own CLI syntax. As with FRR, IOS will be used primarily to describe the interaction with the router that runs Cisco IOS.
VyOS - Open Software router operating system. Also has its own syntax that varies quite a bit from FRR and IOS.
Router Spaces¶
All the routers we’re looking at in the lab 1 are based on different modes of interaction, or interaction spaces. These consist in general of the “default” or “enabled” space, and the “configuration” space.
The user space is mainly used to “use” the router or read out data from the router. Functions such as pinging, establishing ssh-sessions, copying files or reading back statistics all happen in the user space. One can also read out the configuration of the router from the user space or restart the system or services running in the system.
The configuration space is used to change the configuration of the router. This allows one to have a hard switch between doing “undangerous” interaction in the user/enabled space, to possibly breaking the configuration of the unit in the configuration space. Do not worry though, most configuration that is done is first only saved in a running-configuration, so a restart of the unit will be able to roll back the changes one has done. To make the changes permanent, one has to actively save them, done from the user space.
To tell which space one is in, one can typically look at the CLI notation, which on FRR and IOS either gives # for user-space or #(config) for configuration space. On VyOS user-space is denoted by $ and configuration-space is denoted by #:
FRR:

IOS:

VyOS:

As one can tell from the examples, the syntax to move into and out of the spaces differs between the different router operating systems.
Whilst in the configuration mode, one has a shortcut to run commands in the user/enabled mode. By writing "do" in front of the command whilst in configuration mode runs the command in enabled mode. This is helpful if one wants to double-check configurations to be reminded where one needs to navigate to change configurations, e.g. "do show interfaces".
Note: Using the "do" shortcut typically doesn't allow for the use of command-listing, covered in the next paragraph.
Listing Commands¶
To allow for increased productivity, all the OSes allow for readback of valid options or commands in the CLI. By inputting “?” the router reads back valid input options based on the current input. This means that if you are unsure as to how you can continues to write out your commands, you can write the start, input “?” and the router might be able to point you in the correct direction to continue your input. You can also use “?” with an empty command to list all available commands.
FRR:

Cisco:

VyOS:

Note that there is a difference in behaviour between the different operating systems when listing outputs. In FRR, the default behaviour is to list out the entire desired output, regardless of length. In IOS, it attempts to list out data to fill out the CLI-size and waits until the user continues using space (for a new window-sized output) or enter (for a single line). in VyOS, it runs similarly to on IOS, but uses a VIM controls for interaction with the output. This allows the use of VIM motions for those familiar with those techniques (For example /[search-term] to search the output for a desired string). To quit the output of IOS and return to interaction, type a. To quit the output on VyOS, type q.
If you approximately know what a command is called, but don’t remember the name perfectly, you can also enter the first few letters of the commands and input “?” to see if the router can give you a suggestion of what you might be looking for.
Note: The output of ? is context specific and will output different results dependent on when/where you type it.
Command Shortening¶
The router OSes allow the user/administrator to shorten all commands, so long as the shortform isn’t ambiguous (There aren’t two commands that start with the letters you’ve typed). This allows one to not have to write out the full commands for everything, and in general makes usage faster.
Some examples include shortening “configure” to “conf”, and on IOS “terminal” to “t”. This allows the admin to type “conf t” to enter configure mode, instead of the full “configure terminal”. Remember that this is based on the context of current CLI input. If you’re in doubt whether your command is complete enough, you can input “?” after your suggested command. If “?” only outputs one alternative, then it is not ambiguous and can be used.
Reading Configuration¶
To allow oneself to interact properly with the router, one must first understand what is configured on the router. This is typically done by invoking the router to “show” you different data regarding its status or configuration. The show commands vary between the different operating systems, but seeing as the function of the different systems is similar, a lot of the same content can be found at approximately the same places.
Show Running Configuration¶
To list out the entire running configuration, which effectively will include all the information that has been manually inputted into the router, the “show running configuration” can be used. This command has some different syntax on the different systems:
FRR/IOS - Show Running-config (shortened “sho run”)
VyOS - Show Configuration All (shortened “sho conf all”) or Show Configuration Commands which shows the configuration in a format of the commands used to set the configuration of the switch.
Depending on how intricate the configuration of the unit is, this might output a lot of configuration, but can generally be used to find configurations you don’t know the specific command to find.
Also note, the syntax of the configuration output varies a lot between VyOS and the other two OSes, as VyOS uses a JSON syntax or the declarative commands for the configuration, while the other two use a more general .conf syntax.
Show Interfaces¶
A crucial part of the general troubleshooting of the network is using the terminal to read out IP addresses of the unit’s interfaces. This can be done using the different command-sets:
FRR - “show interface”
IOS - “show ip interface brief”
VyOS - “show interface”
The IOS brief handle presents this in a very easy-to-read manner. For the other two, a bit more work has to be done to find the interface names together with the IP-addresses.
Show IP Route¶
For routers, seeing the ip routing table is a crucial part of understanding what is going on in the router. Therefor the “show ip route” (or "show ipv6 route") commands are crucial to understanding what’s going on:
FRR/IOS:

The show ip route command shows the RIB for the router, including specifications regarding where the router learned the different routes (B, O, L, or C in the case of the lab).
Saving Configuration¶
In general, when making configuration changes to a router, you have to save those changes to the router. This should only be done after you’ve observed that the changes you’ve made haven’t broken the router and that things are functioning correctly.
To save the router configuration, what you’re really doing is copying the “running-configuration” from memory to the “startup-configuration” in flash. This means that the same configuration that you’re currently running is loaded the next time the router is booted. The syntax for the different vendors is:
FRR - “write” in enabled mode
IOS - “write” (for newer routers) or “copy running-configuration startup-configuration” (cop r s) in enabled mode
VyOS - Save (Done after a commit) in configuration mode
VyOs is a bit special in this regard, as it has 2 layers of configuration protection. Changes made while in config space on VyOS first have to be committed into running-configuration (“commit”) and then further saved into startup-config (“save”). It is important to check that the changes that are committed are in working order before saving them.
Configuration Layers (FRR/IOS)¶
For FRR and IOS, the configuration space is indexed into various layers. This is noted in the configurations output from the OSes as tabulations. As an example, to configure specifics within an interface, you first have to move into the interface in question, before adding your configuration:

Notice also that the CLI config notation changes when moving through the space, from (config)# to (config-if)#, indicating where you’re applying the configuration. To jump one level out of the configuration space the command “exit” can be used. This is different from “end”, as it only hops one level out of the configuration space, instead of returning all the way to user space:

There are many different configuration layers on the different routers, each with their different command sets (the command sets outputted from “?” will change in order read back what is possible in the current context).
Configuration Objects (VyOS)¶
Configuration on VyOS is built on JSON-like objects. To change configurations in VyOS, one therefore has to list the entire object notation of the object one wishes to change, before adding/changing the specific attribute. For example, changing values to interfaces on VyOS, bases itself on:
set - Change a setting
interfaces - The interfaces configuration group
ethernet - The ethernet type
eth1 - The interface to configure
address - The attribute to configure
"10.10.0.1/29" - The value to set to address
which will align correctly when reading the configuration afterwards:

Commands in General¶
Commands outside of those mentioned here probably have to be googled to find. Some commands are version specific, so that might cause problems if encountering “command not found” responses. Try to find documentation according to the version in use and check if the commands are present using "?", before basing the configuration on those commands.