Mellanox Switch CLI: Getting Started with MLNX-OS Commands - 夜莺博客

Mellanox Switch CLI: Getting Started with MLNX-OS Commands

Mellanox (now NVIDIA) switches run the MLNX-OS / Onyx operating system, and getting one online is a short sequence: console wizard, management IP, SSH, then the standard enable/configure-terminal workflow. This guide walks the initial setup and the basic CLI commands every admin needs - show interfaces, configuration write, and the pipe filters that replace grep.

Mellanox SX1710 switch front view

Initial Console Setup

Connect the switch console port to a COM port (baud rate 115200 on the SX1710; check your hardware manual). Default username and password are both admin. The first login starts the configuration wizard:

Mellanox configuration wizard
Do you want to use the wizard for initial configuration? y
Step 1: Hostname? [switch-5fa5a0] my-switch-hostname
Step 2: Use DHCP on mgmt0 interface? [yes]
Step 3: Enable IPv6? [yes] no
Step 4: Admin password (Enter to leave unchanged)?
Configuration changes saved.

SSH Access and CLI Modes

# ssh admin@10.20.2.54
my-switch-hostname > enable
my-switch-hostname # configure terminal
my-switch-hostname (config) #

Basic Configuration Commands

my-switch-hostname (config) # username admin nopassword
my-switch-hostname (config) # no cli default auto-logout
my-switch-hostname (config) # configuration write
my-switch-hostname (config) # show running-config

configuration write saves the running configuration to the startup-config file - without it, all changes are lost on reboot.

Show Commands

my-switch-hostname (config) # show interfaces mgmt0
my-switch-hostname (config) # show interfaces ethernet status
Port      Operational state   Speed      Negotiation
------    -----------------   -----      -----------
Eth1/1    Up                  40 Gbps    No-Negotiation
Eth1/2    Down                40 Gbps    No-Negotiation

my-switch-hostname (config) # show interfaces ib status

show interfaces ethernet status applies to Ethernet switches; show interfaces ib status applies to InfiniBand switches or gateway systems.

CLI Pipe Filters and Options

! filter like grep
my-switch-hostname (config) # show running-config | include ethernet

! watch mode
switch (config) # show interfaces ethernet status | watch interval 5

! count lines
switch (config) # show running-config | count

! JSON output for automation
switch (config) # show interfaces | json-print

Troubleshooting Tips

  • Map the MGT1 MAC address (from the switch label) to the DHCP server - MGT1 maps to mgmt0 in the OS.
  • On systems with two power supplies, connect both; otherwise the power/system LEDs stay red. Unplugging the unused tray clears the red LED.
  • Re-run the wizard anytime with configuration jump-start.

Related articles: NVIDIA MLNX-OS LAG and LACP configuration, SONiC CLI cheat sheet, and Data center ToR switch selection.

原文链接:https://enterprise-support.nvidia.com/s/article/howto-get-started-with-mellanox-switches