Skip to Content
Arista Warrior,第二版
book

Arista Warrior,第二版

by Gary A. Donahue
May 2025
Intermediate to advanced
572 pages
8h 39m
Chinese
O'Reilly Media, Inc.
Book available
Content preview from Arista Warrior,第二版

第 22 章 电子邮件 电子邮件

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

通过开关发送电子邮件?当然可以!Arista 交换机允许从 EOS 命令行、bash、脚本和各种有趣的地方发送电子邮件。当你看到它的实际应用后,你一定会想,如果没有它,你是怎么活下来的。你是否曾经需要将show tech 的输出从flash: 复制到 TFTP 服务器,然后再复制到笔记本电脑?有了配置在 Arista 交换机上的电子邮件,您再也不需要做这些无用功了。从屏幕上复制和粘贴,却发现回滚缓冲区不够大?有了 Arista 交换机上的电子邮件,只需通过电子邮件将输出直接发送到您(或任何人)的收件箱即可。废话少说,让我们深入了解它是如何实现的。

Arista 交换机包含电子邮件配置模式,可通过email 命令访问:

Arista#conf
Arista(config)#email

在那里输入一个问号(?)

Arista(config-email)#?
  auth       Email account authentication
  from-user  Send email from this user
  server     Email relay
  tls        Require TLS
  ----------------------------------------
  comment    Up to 240 characters, comment for this mode
  default    Set a command to its defaults
  exit       Exit from Email configuration mode
  help       Description of the interactive help system
  no         Negate a command or set its defaults
  show       Show running system information
  !!         Append to comment

最简单的形式是,Arista 交换机上的邮件需要配置发件人地址和电子邮件服务器来发送。这是通过from-userserver 命令完成的。在这里,我将from-user 配置为gad-lab-arista@gad.net ,服务器配置为 192.168.1.200。如果配置了 DNS,我也可以使用完全合格的域名,如mail.gad.net

Arista(config-email)#from-user gad-lab-arista@gad.net
Arista(config-email)#server 192.168.1.200

在电子邮件配置模式下,命令show active 会显示当前为电子邮件配置的内容。由于增加了虚拟路由和转发 (VRF) 支持,服务器命令现在会显示默认 VRF,除非另有配置:

Arista(config-email)#show active
email
   from-user gad-lab-arista@gad.net
   server vrf default 192.168.1.200

对于更高级的情况,EOS 中的电子邮件支持使用巧妙命名的usernamepassword 命令进行用户名和密码验证:

Arista(config-email)#auth username gad
Arista(config-email)#auth password ILikePie

如果输入的是纯文本密码,交换机会将其转换为加密字符串。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

A Practical Guide to Fedora™ and Red Hat® Enterprise Linux®, Seventh Edition

A Practical Guide to Fedora™ and Red Hat® Enterprise Linux®, Seventh Edition

Mark G. Sobell

Publisher Resources

ISBN: 9798341658967