在 macOS 上运行 Cisco Nexus 9000v (NX-OS 10)

在 VMware Fusion 中部署 Cisco Nexus 9000v (NX-OS 10)

Posted by sysin on 2021-09-28
Estimated Reading Time 7 Minutes
Words 1.7k In Total
更新日期:Tue Sep 28 2021 14:02:48 GMT+0800,阅读量:

请访问原文链接:在 macOS 上运行 Cisco Nexus 9000v (NX-OS 10),查看最新版。原创作品,转载请保留出处。

作者主页:sysin.org


无耻抄袭者 Yu Tao,请立遁!!!

本文的使用的软件及下载地址:

什么是 Nexus 9000v 和 NX-OS

Cisco Nexus 9000v 是虚拟化的 Nexus 9000 NX-OS 交换机,用于在虚拟化中构建和测试网络原型环境,是学习 Cisco NX-OS 和 SDN 的便捷途径。NX-OS 是 Cisco Nexus 9000 系列交换机(包含硬件的和虚拟的)的操作系统。

下载和部署 OVF

本站下载链接如上所述,或者去 Cisco 软件下载 页面,搜索 “Nexus 9000v”,登录 Cisco 账号进行下载。

注意:此 OVA 默认为 sha1 校验,新版 Fusion 需要使用 ovftool 转换为 sha256 才能导入,示例:ovftool --shaAlgorithm=SHA256 nexus9300v64.10.1.2.F.ova nexus9300v64.10.1.2.F-sha256.ova

双击 ova 打开 Fusion 部署向导,

sysin

部署选项,默认

sysin

保存名称和位置(这里默认)

“虚拟机” 实际路径为 当前用户主目录下的 “Virtual\ Machines.localized” 文件夹

sysin

开始导入虚机文件

sysin

完成页面,点击 “自定设置”,不要点击“完成” 按钮

sysin

配置串口

添加串口

此时出现 “设置” 页面,点击“添加设备…”

sysin

选择 “串行端口”,点击 “添加…”

sysin

提示创建一个文件,这里命名为 serial0,位置使用默认的 “虚拟机”

sysin

该串行端口默认已经勾选

sysin

回到属性页面,可以看到有 6 个网络适配器,第一个为 mgmt0 端口,第二至第六分别为 Ethernet 1-5 端口,根据需要配置网络类型,以便可以访问到正确的 IP,特别是 mgmt0 端口。

sysin

可以根据需要将第二至第六网卡禁用(取消勾选 “连接网络适配器”),否则虚机每次开机过程中需要连续输入 6 次用户密码确认权限(不要怀疑是密码输错了😄)。

sysin

编辑 vmx

打开 “虚拟机” 目录,一般会显示在 Finder 侧边栏,实际路径是 ~/Virtual Machines.localized,找到 nexus9300v.10.1.2,点击右键,选择 “显示包内容”

用文本编辑器打开 nexus9300v.10.1.2.vmx,将 serial0.fileType = "file" 修改为 serial0.fileType = "pipe"

连接串口

(1)安装 socat:

1
brew install socat

前提是已经安装了 brew (/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")。

socat - Multipurpose relay
socat 是 Unix 下的一个多功能的网络工具,名字来由是 “Socket CAT”。其功能与有瑞士军刀之称的 Netcat 类似,可以看做是 Netcat 的加强版。
Socat 的主要特点就是在两个数据流之间建立通道,且支持众多协议和连接方式。如 IP、TCP、UDP、IPv6、PIPE、EXEC、System、Open、Proxy、Openssl、Socket 等。

(2)开启虚机,出现了启动画面:

sysin

(3)连接串口 serial0:

1
2
cd ~/Virtual\ Machines.localized/
socat -d -d unix-connect:serial0 stdio

-d 参数最多可以用 4 个,表示输出的信息级别越多,参看 man socat
unix-connect: 后面跟串口文件的实际路径,比如:$HOME/Virtual\ Machines.localized/serial0
这里的路径支持 $HOME 变量,但是不支持 ~
stdio = stdin,客户端只进行标准输入

(4)画面出现大量字符:

sysin

(5)按回车键可以看到如下提示:

1
- Abort Power On Auto Provisioning [yes - continue with normal setup, skip - bypass password and basic configuration, no - continue with Power On Auto Provisioning] (yes/skip/no)[no]:

输入 yes 停止 POAP(Cisco NX-OS PowerOn Auto Provisioning)

(6)出现初始化配置界面:

1
2
3
4
5
6
         ---- System Admin Account Setup ----


Do you want to enforce secure password standard (yes/no) [y]: 直接按回车,启用安全密码
Enter the password for "admin": 为 admin 设置密码,这里是明文显示的
Confirm the password for "admin": 确认密码

确认后:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
         ---- Basic System Configuration Dialog VDC: 1 ----

This setup utility will guide you through the basic configuration of
the system. Setup configures only enough connectivity for management
of the system.

Please register Cisco Nexus9000 Family devices promptly with your
supplier. Failure to register may affect response times for initial
service calls. Nexus9000 devices must be registered to receive
entitled support services.

Press Enter at anytime to skip a dialog. Use ctrl-c at anytime
to skip the remaining dialogs.

Would you like to enter the basic configuration dialog (yes/no): 这里直接输入 no 终止

(7)此时出现登录界面:

1
2
3
4
User Access Verification
login: admin
admin
Password:

登录后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Cisco NX-OS Software
Copyright (c) 2002-2021, Cisco Systems, Inc. All rights reserved.
Nexus 9000v software ("Nexus 9000v Software") and related documentation,
files or other reference materials ("Documentation") are
the proprietary property and confidential information of Cisco
Systems, Inc. ("Cisco") and are protected, without limitation,
pursuant to United States and International copyright and trademark
laws in the applicable jurisdiction which provide civil and criminal
penalties for copying or distribution without Cisco's authorization.

Any use or disclosure, in whole or in part, of the Nexus 9000v Software
or Documentation to any third party for any purposes is expressly
prohibited except as otherwise authorized by Cisco in writing.
The copyrights to certain works contained herein are owned by other
third parties and are used and distributed under license. Some parts
of this software may be covered under the GNU Public License or the
GNU Lesser General Public License. A copy of each such license is
available at
http://www.gnu.org/licenses/gpl.html and
http://www.gnu.org/licenses/lgpl.html
***************************************************************************
* Nexus 9000v is strictly limited to use for evaluation, demonstration *
* and NX-OS education. Any use or disclosure, in whole or in part of *
* the Nexus 9000v Software or Documentation to any third party for any *
* purposes is expressly prohibited except as otherwise authorized by *
* Cisco in writing. *
***************************************************************************
switch#

必要配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## 配置管理 IP
switch# conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# interface mgmt0
switch(config-if)# ip address 10.0.2.15/24
# <--- NOTE: can use "ip address dhcp" here instead
switch(config-if)# no shut
switch(config-if)# exit
# 此时可以通过 ssh 访问管理口,默认 ssh 服务开启。

# 配置管理口路由
switch(config)#vrf context management
switch(config-vrf)# ip route 0.0.0.0/0 10.0.2.1

## 配置引导镜像 (sysin)
switch# conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# boot nxos bootflash:nxos.10.1.2.bin
# 或者直接 boot nxos nxos.10.1.2.bin
# <--- Note: use correct imagename from "dir" command output
switch(config)# copy r s
[########################################] 100%
Copy complete.
switch(config)#
# 运行 show boot 命令确认
switch(config)# show boot
show boot
Current Boot Variables:
sup-1
NXOS variable = bootflash:/nxos.10.1.2.bin
Boot POAP Disabled

Boot Variables on next reload:
sup-1
NXOS variable not set
Boot POAP Disabled
switch#

## 添加一个用户(可选)
switch(config)# username sysin password vagrant role network-admin
switch(config)# username sysin shell bash
switch(config)# copy r s

下一步

以后可以直接使用 SSH 访问,串口可用于 SSH 无法访问之时进行问题排查。

请访问官方文档,开启你的 Nexus 之旅:

Cisco Nexus 9000 Series Switches Configuration Guides

小贴士:开启 shell 访问,可以看到 NX-OS 10.1.2 是基于 Linux kernel 4.19(LTS)。

1
2
3
4
5
6
7
8
9
10
11
12
switch# show feature | grep bash
bash-shell 1 disabled
switch# conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# feature bash-shell
switch(config)# end
switch# run bash sudo su -
root@switch#whoami
root
root@switch#uname -a
Linux switch 4.19.179 #1 SMP Thu May 13 16:52:16 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux
root@switch#

捐助本站 ❤️ Donate

点击访问官方网站


文章用于推荐和分享优秀的软件产品及其相关技术,所有软件默认提供官方原版(免费版或试用版),免费分享。对于部分产品笔者加入了自己的理解和分析,方便学习和测试使用。任何内容若侵犯了您的版权,请联系作者删除。如果您喜欢这篇文章或者觉得它对您有所帮助,或者发现有不当之处,欢迎您发表评论,也欢迎您分享这个网站,或者赞赏一下作者,谢谢!

支付宝赞赏 微信赞赏

赞赏一下


☑️ 评论恢复,欢迎留言❗️
敬请注册!点击 “登录” - “用户注册”(已知不支持 21.cn/189.cn 邮箱)。请勿使用联合登录(已关闭)