Getting Started with Mellanox Switches: First Configuration - 夜莺博客

Getting Started with Mellanox Switches: First Configuration

Mellanox (now NVIDIA) switches run a different management model than classic enterprise gear, and the first hours with an SX1710 or SN2000 can trip up even experienced engineers — starting with the three MAC addresses printed on the label and the wizard-driven initial setup. This beginner guide, based on NVIDIA's official "HowTo Get Started" article, takes you from console connection through the configuration wizard, DHCP on the management port, SSH access, and the first show commands. The examples use the SX1710 (a 12-port 100GbE switch with 2 management ports and an RST button), but the flow transfers to any Mellanox Ethernet or InfiniBand switch running MLNX-OS.

Background: why Mellanox switches feel unfamiliar

Two things surprise people coming from Cisco, Aruba or Extreme gear. First, MLNX-OS boots into a wizard rather than a plain prompt, and the wizard asks a small number of questions that decide how you will reach the device for the rest of its life. Second, the chassis label carries three MAC addresses instead of one, and only one of them — MGT1 — is the address the switch actually uses to source traffic from its management interface. Plug the wrong one into your DHCP server's static-lease table and the switch will boot, appear healthy, and still be unreachable.

Get those two details right and everything else follows quickly. The rest of this guide is the sequence NVIDIA documents, expanded with the reasoning and the verification steps that make it repeatable across a rack of switches.

Prerequisites

  • A console cable that matches your switch's console connector (USB-C, RJ-45 to DB-9, or DB-9 straight-through depending on platform).
  • A terminal emulator — screen, Minicom, PuTTY, SecureCRT or similar.
  • An out-of-band management network you are allowed to plug into, ideally with a DHCP server you can add reservations to.
  • Physical access to read the label on the chassis. Photograph the label before you rack the switch; it saves a trip later.

The default console baud rate is 115200 for the SX1710. Other platforms use 9600 or 115200 — check the hardware user manual, because a mismatched baud rate shows up as a blank screen with no error at all.

Step 1: Connect to the Console

Connect the console port to a COM port (SX1710 baud rate: 115200). Default credentials are admin / admin. Power the switch on and watch the boot messages; if you see nothing, the baud rate or the flow control setting is wrong.

Once MLNX-OS has finished booting you are dropped into the first-configuration wizard automatically on a factory-fresh device.

Step 2: Run the First Configuration Wizard

The wizard asks four questions. Answer them deliberately — the values you type here become the switch's management behaviour:

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)?
  • Hostname — pick something that encodes role and location (for example leaf1-rack4), not the default switch-xxxxxx. You will type it far more often than you expect.
  • DHCP on mgmt0 — accept yes for the first bring-up. It is the fastest way to prove the management path works. You can switch to a static address later.
  • IPv6 — answer no unless you actually run IPv6 management. Fewer enabled features means fewer surprises on the console.
  • Admin password — press Enter to keep the default, or set a strong one now. Pressing Enter leaves it as admin, which is fine only for an isolated lab.

If the wizard has already been answered on this switch, you will land at a normal prompt instead. In that case jump to Step 4 and verify reachability, then use the CLI to change anything you need.

Step 3: Map the MGT1 MAC Address to the DHCP Server

The label on the switch shows three MAC addresses — use the one labeled MGT1. Reserve a static DHCP lease for that MAC so the management IP is predictable and survives reboots and DHCP-server migrations.

Why the confusion? The three addresses belong to different purposes: the management interface, the service/IPMI-style path on some platforms, and the base MAC used for front-panel ports. If you reserve a lease against the wrong one, the switch will still request an address for MGT1 — which by then has no reservation — and will take whatever the pool hands out. The symptom is a management IP that changes on every reboot.

Reserve the lease, note the resulting IP, and record the mapping (hostname ↔ MGT1 MAC ↔ IP) wherever you keep your management inventory.

Step 4: Connect MGT1 and Verify

Plug MGT1 into the management network; the switch obtains its IP via DHCP. Then SSH in:

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

Check that the admin port and link are up, and confirm the assigned IP and MAC before proceeding:

my-switch-hostname # show interfaces mgmt0 brief
my-switch-hostname # show interfaces mgmt0
my-switch-hostname # show version
my-switch-hostname # show system

Confirm three things: the interface reports up, the IP matches the reservation you created, and the MAC matches the MGT1 value on the label. If any of the three disagrees, fix it now — a switch with an inconsistent management identity is painful to find later.

Step 5: Move from DHCP to a Static Address

DHCP on mgmt0 is a bring-up convenience, not a production design. In most data centres the management port carries a static address so that monitoring, backups and out-of-band recovery all have a stable target:

my-switch-hostname # configure terminal
my-switch-hostname (config) # interface mgmt0 ip address 10.20.2.54 /24
my-switch-hostname (config) # interface mgmt0 ip default-gateway 10.20.2.1
my-switch-hostname (config) # interface mgmt0 no shutdown
my-switch-hostname (config) # exit
my-switch-hostname # write memory

Change the address from the console, not over SSH — otherwise you will cut the session you are typing into. After writing the configuration, reconnect using the new static address and confirm it survives a reboot.

What the three label MAC addresses are for

Engineers lose the most time on this single detail, so it is worth spelling out. The chassis label prints a small block of three MAC addresses, and they are not interchangeable:

  • MGT1 — the address the switch uses to source traffic from its management interface, and therefore the one your DHCP reservation and your inventory records must reference.
  • A second management-related address used on platforms that expose a separate service or out-of-band path. It looks equally plausible on the label, which is exactly why people reserve the wrong one.
  • The base MAC — the starting value from which the front-panel and interface MACs are derived. It is the "biggest" number on the label and the most tempting to use, but reserving a lease against it does nothing for the management interface.

The test is simple and takes seconds: after bring-up, compare the value in show interfaces mgmt0 with the label. If it does not match MGT1, your reservation is against the wrong address and the switch will take an arbitrary pool address on every reboot.

Common first-configuration mistakes

  • Leaving the hostname at the default. switch-5fa5a0 tells you nothing, appears in every prompt and every log line, and is impossible to correlate with a rack position during an incident.
  • Accepting DHCP and never converting to static. The switch works, right up until the DHCP scope is migrated and fifteen switches change address overnight.
  • Changing the management address over SSH instead of the console. You will disconnect yourself mid-command and then have to find a console lead anyway.
  • Not running write memory. Everything looks correct until the first reload, after which the switch returns to the wizard's answers and nothing else.
  • Skipping NTP. Timestamps that disagree between switches make cross-device log analysis unreliable, which is the exact moment you need it most.
  • Ignoring the LED conventions. LED meanings differ between SX and SN platforms; assuming a green link LED proves end-to-end connectivity leads to hours spent on the wrong layer.

Step 6: Next Steps

  • Set a static IP instead of DHCP: configure the mgmt0 interface manually and issue no shutdown, as shown above.
  • Configure SNMP, NTP and syslog for monitoring. Correct time matters — without NTP, log correlation across switches is guesswork.
  • Change the admin password if you left the default, and create named user accounts rather than sharing admin.
  • Save the configuration with write memory and verify it can be written and reloaded cleanly before you rely on it.
  • Review the hardware user manual for your platform's LED and port conventions — the LED meanings differ between SX and SN series.
  • If the switch will carry RoCEv2 traffic, plan the lossless Ethernet settings (PFC and ECN) before you attach hosts, not after.

Troubleshooting the first bring-up

  • Blank console: baud rate mismatch, wrong cable, or hardware flow control enabled. SX1710 wants 115200 with no flow control.
  • Wizard never appears: the switch already has a configuration. Look for a prompt instead, or reset the configuration if the device is genuinely new to you.
  • No DHCP address: the reservation was made against the wrong MAC. Verify the label's MGT1 value against show interfaces mgmt0.
  • SSH refused: the port is on the wrong VLAN or the management network does not route to your jump host. Ping the address from a host on the same segment first.
  • IP changes after reboot: classic symptom of a missing or mismatched DHCP reservation, or of a static address that was never written to memory.

FAQ

Can I do all of this over the network? No — the first bring-up needs the console, because the switch has no management address until the wizard runs.

Do I have to use DHCP at all? No. Answer no to Step 2 and assign a static address straight away, as long as you have a free address and the gateway details to hand.

Which MAC should go in my documentation? The MGT1 MAC. That is the one the management interface uses to source traffic.

Does this apply to InfiniBand switches too? Yes. The console, wizard, management port and CLI modes are the same family; only the fabric-specific commands differ.

How do I know the switch is ready to configure further? When show interfaces mgmt0 reports up with the expected IP and MAC, and write memory completes without error.

For configuration management and installation topics, see NVIDIA MLNX-OS configuration management and the ONIE/Onyx install guide. For link problems on split ports, read our breakout cable troubleshooting guide. To go deeper on the first-boot wizard, see MLNX-OS first-time setup: console wizard walkthrough and Mellanox switch getting started: first-time setup and CLI basics. For day-to-day commands, use the Mellanox switch CLI getting-started commands, the NVIDIA MLNX-OS CLI guide: modes and commands, and the MLNX-OS configuration management guide.

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