• Introduction to Managing EOS Devices – EOS Tips for Power Users

 
 
Print Friendly, PDF & Email

Note: This article is part of the Introduction to Managing EOS Devices series:

https://eos.arista.com/introduction-to-managing-eos-devices/ 

 

 

Annex B)  EOS Tips for Power Users

B.1) CLI – Show Commands Redirections

 

EOS CLI supports the following “show” command redirections, by “|” (pipe):

LINE      Filter command by common Linux tools such as grep/awk/sed/wc
 append    Append redirected output to URL
 begin     Begin with the line that matches
 exclude   Exclude lines that match
 include   Include lines that match
 no-more   Disable pagination for this command
 nz        Include only non-zero counters ← Hides line with all 0 numbers
 redirect  Redirect output to URL
 section   Include sections that match ← Shows whole hierarchy rather than just the line (as with inc)
 tee       Copy output to URL

 

B.2) Extensibility – Bash and Kernel

 

EOS provide all the management possibilities of a standard Linux system. Besides all the default tools already on the kernel, you may install (with discernment!) additional packages/scripts/extensions of your choice. A primordial use case is integrating with your existing management and provisioning tools, like some other systems.

Features from APIs, SDK, AEM, or native integrations with controllers and orchestrators, extend the capabilities of the switch.

Refer to the Arista EOS Extensibility document for more details, it can be retrieved from the Arista download pages.

 

B.3)  Configuration ranges and lists

 

switch(config)#interface ethernet1-3      ← The “range” keyword is optional
switch(config-if-Et1-3)#ip address 10.{1,3}.1.1/24     ← The configured IP range [1 to 3] is contextual (in the interface range 1-3)

switch#show ip int bri
 Interface              IP Address         Status     Protocol         MTU
 Ethernet1              10.1.1.1/24        up         up              1500
 Ethernet2              10.2.1.1/24        up         up              1500
 Ethernet3              10.3.1.1/24        up         up              1500
 Management1            192.168.1.174/22   down       notpresent      1500

Note: The configuration range definition is: {start, end, step=1, padding=1}

The “show” command range can reference multiple interfaces, in either/several part(s) of the the A/B/C pattern:

 

switch#show interface ethernet 3/49/1-$ status
 Port       Name              Status       Vlan        Duplex  Speed Type
 Et3/49/1                     disabled     1             full    10G Not Present
 Et3/49/2                     disabled     1             full    10G Not Present
 Et3/49/3                     disabled     1             full    10G Not Present
 Et3/49/4                     disabled     1             full    10G Not Present

 switch#show interface ethernet 3/49/1-3/$/$ status
 Port       Name              Status       Vlan        Duplex  Speed Type
 Et3/49/1                     disabled     1             full    10G Not Present
 Et3/49/2                     disabled     1             full    10G Not Present
 Et3/49/3                     disabled     1             full    10G Not Present
 Et3/49/4                     disabled     1             full    10G Not Present
 Et3/50/1                     disabled     1             full    10G Not Present
 Et3/50/2                     disabled     1             full    10G Not Present
 Et3/50/3                     disabled     1             full    10G Not Present
 Et3/50/4                     disabled     1             full    10G Not Present
 Et3/51/1                     disabled     1             full    10G Not Present
 Et3/51/2                     disabled     1             full    10G Not Present
 Et3/51/3                     disabled     1             full    10G Not Present
 Et3/51/4                     disabled     1             full    10G Not Present
 Et3/52/1                     disabled     1             full    10G 40GBASE-AR4
 Et3/52/2                     disabled     1             full    10G 40GBASE-AR4
 Et3/52/3                     disabled     1             full    10G 40GBASE-AR4
 Et3/52/4                     disabled     1             full    10G 40GBASE-AR4

 

B.4) Prompt

 

Prompt can include timestamps, for troubleshooting or verification:

switch(config)#prompt %H.%D{%H:%M:%S}%P
switch.04:00:44#
switch.04:01:11#
switch.04:01:11#

 

The date format follows the standard Linux time format: http://php.net/manual/en/function.strftime.php

Besides %H for hostname and %D for date, there are a few more options:

%s = whitespace
%t = tab
%% = %

 

B.5) Aliases

 

Following are examples of some useful aliases:

alias senz show interface counter error | nz
alias shmc show int | awk '/^[A-Z]/ { intf = $1 } /, address is/ { print intf, $6 }'
alias snz show interface counter | nz
alias spd show port-channel %1 detail all
alias sqnz show interface counter queue | nz
alias srnz show interface counter rate | nz

 

B.6) Port-Profile

 

Aliases can be enhanced to dynamic configuration sub-routines such as port-profiles.

a) Port-profiles – Dynamic

Below is an example of dynamic alias, used for port-profiles:

 

alias profile_access
  !! Syntax : profile_access <VLAN ID> <ACL> <QoS DSCP value>
  !! Example: profile_access 10  ACL-ACCESS-1  8
  1 no switchport
  2 no ip address
  3 switchport access vlan %1← %1 is the 1st parameter passed to the alias (VLAN ID)
  4 ip access-group %2 in← %2 is the 2nd parameter passed to the alias (ACL)
  5 qos dscp %3                 
  6 end
  !! optional:
  !! 7 diff run start | no-more← To automatically review changes (diff) after applying

 

b) Port-profiles – Static

Without need for arguments, a port-profile can be static, including multiple lines of configuration. This type of profile is more suitable if the configuration does not change: values (VLAN, QoS, etc) are hard-coded in the profile for the operator’s convenience (depending on skill level):

alias profile_access_10
!! Syntax : profile_access
  1 no switchport
  2 no ip address
  3 switchport access vlan 10
  4 ip access-group ACL-ACCESS-10 in
  5 qos dscp 8
  6 end
  !! optional:
  !! 7 diff run start | no-more

 

c) Contextual help for custom alias

In the below output, note the contextual help (by question mark ‘?’) understands the syntax of the custom alias with multiple arguments.

switch(config-if-Et1-2)#show active       ← Verify the configuration in the current hierarchy
  interface Ethernet1
  interface Ethernet2
switch(config-if-Et1-2)#pro?
*profile_access="no switchport ..."  prompt

switch(config-if-Et1-2)#profile_access ?
 <1-4094>  VLAN id← Contextual help for custom alias - 1st arg

switch(config-if-Et1-2)#profile_access 10 ?
 WORD  Access-list name← Contextual help for custom alias - 2nd arg

switch(config-if-Et1-2)#profile_access 10 ACL-ACCESS-1 ?
 <cr>

switch(config-if-Et1-2)#profile_access 10 ACL-ACCESS-1
! Access VLAN does not exist. Creating vlan 10

--- flash:/startup-config
+++ system:/running-config
@@ -3,6 +3,17 @@
+vlan 10
+!
interface Ethernet1
+   switchport access vlan 10
+   no switchport
+   ip access-group ACL-ACCESS-1 in
+   qos dscp 8
!
interface Ethernet2
+   switchport access vlan 10
+   no switchport
+   ip access-group ACL-ACCESS-1 in
+   qos dscp 8
!

B.7) Bulk snmptranslate

If an SNMP walk was run without the proper MIBs loaded, then the OIDs might not be interpreted correctly, showing only numbered OID. For example:

SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.1528 = INTEGER: 1
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.1529 = INTEGER: 1
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.1530 = INTEGER: 1
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.1531 = INTEGER: 1
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.1532 = INTEGER: 1
[...]

The OIDs are not understandable as-is.

Bulk snmptranslate allow to load an existing SNMP walk file and translate the OIDs to the correct names.

arista-bash$ snmptranslate - < walk.txt
snmptranslate - < walk.txt
SNMPv2-MIB::sysDescr.0 = STRING: Arista Networks EOS version 4.12.7.1 running on an Arista Networks
DCS-7150S-24
SNMPv2-MIB::sysObjectID.0 = OID: ARISTA-PRODUCTS-MIB::aristaDCS7150S24
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (805577) 2:14:15.77
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: s7151.lab.local
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 14
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (5760) 0:00:57.60
SNMPv2-MIB::sysORID.1 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.2 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.3 = OID: SNMPv2-MIB::snmpMIB

Other usage of snmptranslate:

arista-bash$ snmptranslate -Tz -m ARISTA-PRODUCTS-MIB | grep -v anon
"org""1.3"
"dod""1.3.6"
"internet""1.3.6.1"
"directory""1.3.6.1.1"
"mgmt""1.3.6.1.2"
"mib-2""1.3.6.1.2.1"
"transmission""1.3.6.1.2.1.10"
"experimental""1.3.6.1.3"
"private""1.3.6.1.4"
"enterprises""1.3.6.1.4.1"
"arista""1.3.6.1.4.1.30065"
"aristaProducts""1.3.6.1.4.1.30065.1"
"aristaDCS7010T48""1.3.6.1.4.1.30065.1.3011.7010.427.48"
"aristaDCS7010T48DC""1.3.6.1.4.1.30065.1.3011.7010.427.48.2957"
"aristaDCS7048T4S""1.3.6.1.4.1.30065.1.3011.7048.427.4.3282"
"aristaDCS7048TA""1.3.6.1.4.1.30065.1.3011.7048.427.3648"
"aristaDCS7050T36""1.3.6.1.4.1.30065.1.3011.7050.427.36"
"aristaDCS7050T52""1.3.6.1.4.1.30065.1.3011.7050.427.52"
"aristaDCS7050T52SSD""1.3.6.1.4.1.30065.1.3011.7050.427.52.761"
[...]

arista-bash$ snmptranslate -On ARISTA-PRODUCTS-MIB::aristaDCS7010T48
.1.3.6.1.4.1.30065.1.3011.7010.427.48

 

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: