Mellanox Switch Getting Started: First-Time Setup and CLI Basics - 夜莺博客

Mellanox Switch Getting Started: First-Time Setup and CLI Basics

A new Mellanox (now NVIDIA) Ethernet or InfiniBand switch arrives with no configuration, and the fastest way to bring it up is the serial console, the built-in setup wizard, and a handful of CLI commands that are consistent across the whole MLNX-OS family. This article walks through the first-time setup flow documented by NVIDIA support: initial wizard answers, entering configuration mode, saving the configuration, and the show commands used to verify interface status.

Step 1: Initial Wizard Setup

Connect the console port to a COM port on a management server, power on the switch, and the first-run wizard will ask for the hostname and DHCP preference:

Use DHCP on mt0 interface? [yes/no]: no
Enter hostname: sw-mlnx-01

If the management port uses DHCP, map the MAC address printed on the MGT1 label to a static reservation on your DHCP server so the switch always receives the same management IP.

Step 2: CLI Modes

MLNX-OS uses an industry-standard three-level CLI:

switch >               # Standard mode (read-only)
switch > enable
switch #               # Enable mode (state + actions)
switch # configure terminal
switch (config) #      # Config mode (full read/write)

You cannot jump directly from Standard to Config mode - always pass through enable. Tab completion and ? help are available everywhere, and most commands accept shortened forms (en for enable).

Step 3: Configure and Save

switch (config) # hostname sw-mlnx-01
switch (config) # interface ethernet 1/1
switch (config interface ethernet 1/1) # description uplink-to-spine
switch (config interface ethernet 1/1) # exit
switch (config) # configuration write
switch (config) # show running-config

configuration write is the MLNX-OS equivalent of Cisco's write memory - without it the running configuration is lost on reboot. Use show running-config to review what would be restored.

Step 4: Verify Interfaces

switch (config) # show interfaces ethernet status
switch (config) # show interfaces ethernet 1/1
switch # show interfaces ib status      # InfiniBand switches only

The Ethernet status output shows admin state, operational state and speed per port - the first place to look when a server link is down.

Output Filtering and Monitoring

Instead of grep, MLNX-OS filters show output with pipe operators, and the watch option refreshes automatically:

switch (config) # show interfaces ethernet status | include down
switch (config) # show interfaces counters | exclude 0 | watch interval 2
switch (config) # show running-config | count
switch (config) # show interfaces ethernet status | json-print

| json-print renders show output as JSON - useful when you are scripting the switch, though it cannot be combined with filters or watch.

Related Reading on This Site

See the Mellanox MLNX-OS CLI getting started commands and ToR switch selection guide for choosing and onboarding this class of hardware.

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