Useful Arista commands

In this post I would like to show you some useful commands available on the Arista switches that you can use in your daily work.

The first command that is very useful is the watch command, which repeats the given command at a specified interval and can additionally display the differences between individual performances.

For example, if we want to monitor CRC errors on a given interface, instead of repeating the show int x / x several times, we can use the watch command, which will run the above mentioned command automatically every 2s and display information as shown below.

Due to the fact that EOS is built on Linux, where CLI is really an interface between the user and Linux, as a user we have easy access to the bash shell, which is why we can easily use the native available functionalities of the Linux operating system, such as egrep, awk to filter and search data streams based on defined patterns.

For example, if we want to display CRC errors information for all interfaces, we can use the following command

 sh int | awk '/^Ethe/ {inf = $1} /CRC,/ {print inf, $4}'

to print out information we are looking for in nicely formatted output.

Access to bash from the Arista switch will be gained by running the bash command. From the bash shell, we also have access to CLI, in which we can execute any command, as shown below. We can take advantage of the flexibility that EOS provides us by creating our own scripts and allowing these scripts direct access from the bash to the CLI.

Direct access from bash to Arista CLI.

Another useful command available to users is schedule, it allows you to run the command and save the result to a file. This command can be used to troubleshoot a specific problem and execute the command according to defined parameters, as shown below.

To view a file run following command:

more flash:/schedule/<schedule_name/<file_name>

Arista also allows us to run tcpdump directly from CLI. Using this command is very easy as shown in the example below. Running the above mentioned command is also possible directly from the bash. One thing to keep in mind is that tcpdump only allows us to capture traffic that is send directly to the switch.

Some high end platforms have the option of redirecting data plane traffic to the CPU when using monitor session so we can use it to troubleshoot data plane flow.

monitor session 1 source Ethernet1/1 tx
monitor session 1 destination Cpu

When above command is executed new interface is created called mirror0 which can be used with tcpdump to see data plane traffic.

What surprised me at the beginning when I started my adventure with Arista switches is the limited functionality of debugs. This functionality is limited to a few commands, as presented below.

What if we want to perform troubleshooting, e.g. AAA? Arista EOS has a completely different approach than most vendors on the market and the concept of debug is based on tracing, where each agent (process) can be monitored using trace. Arista’s documentation in this area is not extensive, so I thought it would be useful to show how to use this functionality.

To display the list of available agents, use the following command, in my example I limited the display of information only to AAA processes. If you skip egrep, you will see a list of all available agents.

You can turn on the logs for all agents, which is not a good idea and it is better to limit the logs to what we are really interested in. In this example, I will limit logs only to Radius. The following command displays information about the Aaa agent, but I limited the output to radius functionality only. If you skip the grep filter, you’ll see all the options available. As you can see below, no logs are currently enabled, which is represented by dots. To enable logs, use the following commands

If you skip the grep filter, you’ll see all the available traces. As you can see below, no logs are currently enabled, which is represented by dots. To enable logs, use the following commands

trace Aaa enable Radius all

Now lets look at the logs using following command trace monitor Aaa

As shown below now we can see what is going on behind the scene. DO not forget to turn off the logs and to do so you have to negate the command which was use to enable the logs. The easiest way to find out what was the command is to run show run command with filter to match everything which contains trace as shown below.

Alternative option to view the logs is to go to bash and list al;l logs under /var/log/agents folder

To learn more about debugging on EOS, you need to practice and play with various options, but as soon as you get used to using this tool, you’ll really love it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s