Arista EOS CLI: Command Modes and Key Features - 夜莺博客

Arista EOS CLI: Command Modes and Key Features

Arista EOS 的 CLI 以易用著称:命令不区分大小写、支持唯一前缀缩写、内置 alias 与历史缓冲。本文基于官方用户手册整理 EOS CLI 核心特性:访问方式、命令缩写与 alias 创建、正则表达式在 BGP 中的应用、schedule 定时任务、event handler 事件自动化以及 terminal 参数设置,快速提升日常操作效率。

访问与命令处理

EOS CLI 可通过管理口、console、Telnet、SSH 访问。命令关键字不区分大小写,且接受唯一对应命令的截断形式:

switch# con
% Ambiguous command            # configure 与 connect 冲突
switch# conf
switch(config)#                # 唯一匹配,直接进入配置模式

创建 Alias

switch(config)# alias srie show running-config interface ethernet 1-5
switch(config)# srie

历史与语法帮助

switch# show history
switch# ping ?
  WORD  Ping destination address or hostname
  ip    IPv4 echo
  ipv6  IPv6 echo
  mpls  Send echo messages for LSP
  vrf   Ping in a VRF

正则表达式

BGP AS-Path 过滤支持 asn 与 string 两种 regex 模式(ip as-path regex-mode 配置)。asn 模式下 . 匹配任意 AS 号、^ 锚定开头、$ 锚定结尾、_ 作为 AS 分隔符,例如 ^100_200$ 精确匹配路径 "100 200"。

定时任务与事件自动化

# 每 12 小时执行脚本,超时 40 分钟
switch# schedule ms_1 interval 720 timeout 40 max-log-files 0 command bash /mnt/flash/myscript.sh
switch(config)# show schedule summary
# 事件处理器:接口状态变化触发动作
switch(config-handler-Eth5)# trigger on-intf Ethernet 5 operstatus ip
switch(config-handler-Eth5)# action bash /mnt/flash/on-change.sh

终端设置

switch# terminal length 0      # 禁用分页(SSH 会话)
switch# terminal monitor       # 终端实时显示日志

相关阅读

EOS MLAG 配置见本站 Arista EOS MLAG Configuration: Complete Guide;EOS 自动化见 Ansible for Network Engineers: Complete Guide;数据中心拓扑见 Spine-Leaf Architecture: Modern Data Center Topology

原文链接:https://www.arista.com/en/um-eos/eos-command-line-interface-cli