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,第二版

第 12 章 bash

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

Arista 交换机实际上是 Linux 服务器,经过优化和编程后成为网络交换机。书读到这里,这应该不足为奇了,但令人惊讶的是,管理员可以访问系统的深度。

备注

如果你实在不喜欢初级工程师访问 bash,可以通过 AAA 限制他们访问。

要访问 bash,请在启用提示符下键入命令bash

Arista-7280#bash

Arista Networks EOS shell

[admin@Arista-7280 ~]$

此时,我正在交换机上的 bash shell 中。提示符默认为 [username@hostname directory]$.在上例中,我使用默认用户名(admin)登录交换机。我没有在 Unix 中创建用户名;交换机帮我创建了用户名。

此时,我几乎拥有作为 Linux 用户的所有控制权。我不是超级用户,我的主目录也是空的:

[admin@Arista-7280 ~]$ ls
[admin@Arista-7280 ~]$

我可以像在 Linux 服务器上一样浏览文件系统:

[admin@Arista-7280 ~]$ cd /
[admin@Arista-7280 /]$ cd /usr/
[admin@Arista-7280 usr]$ ls
bin  etc  games  include  lib  libexec  local  sbin  share  src  tmp
[admin@Arista-7280 usr]$

如果你熟悉 Linux,你就会在这个 bash shell 中找到家的感觉:

[admin@Arista-7280 usr]$ ls -alh
total 0
drwxr-xr-x 16 root root  120 Oct 29 21:28 .
drwxr-xr-x 29 root root  320 Nov 14 19:33 ..
dr-xr-xr-x  2 root root  880 Nov 14 19:34 bin
drwxr-xr-x  2 root root    3 Jul 19  2012 etc
drwxr-xr-x  2 root root    3 Jul 19  2012 games
drwxr-xr-x  5 root root  101 Oct 29 21:28 include
dr-xr-xr-x 77 root root 5.1K Nov 14 19:33 lib
drwxr-xr-x 10 root root  551 Oct 29 21:30 libexec
drwxr-xr-x 11 root root  127 Oct 29 21:28 local
dr-xr-xr-x  2 root root   60 Nov 14 19:33 sbin
drwxr-xr-x 85 root root  220 Oct 29 21:30 share
drwxr-xr-x  4 root root   43 Oct 29 21:28 src
lrwxrwxrwx  1 root root   10 Nov  2 07:10 tmp -> ../var/tmp
[admin@Arista-7280 usr]$

为了证明 Arista 交换机是一个带有专用接口硬件的 Linux 服务器,我将展示来自 Bash 的网络接口:

[admin@Arista-7280 ~]$ ifconfig -a | more cpu: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> ...
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