Mellanox MLNX-OS: VLAN Interfaces and IP Routing Setup - 夜莺博客

Mellanox MLNX-OS: VLAN Interfaces and IP Routing Setup

Mellanox data center switches running MLNX-OS (the CLI is also branded Onyx) ship as flexible L2/L3 devices, but the Layer 3 commands only appear after you enable routing - a step that trips up many first-time administrators. A common symptom is typing interface vlan 2 and discovering that the switch offers no way to assign an IP address to it. The fix is a three-step sequence: create the VLAN in the VLAN database, enable ip routing globally, and only then configure the routed VLAN interface. This guide walks through that exact sequence and the verification commands that confirm the switch is routing between VLANs.

Why SVI Commands Are Missing on MLNX-OS

On MLNX-OS (Onyx), the interface vlan command is not available for configuration until two preconditions are met: the VLAN must exist in the VLAN database, and IP routing must be enabled on the switch. Until then, tab completion simply does not offer the VLAN option - the software hides L3 configuration behind the L3 capability flag, exactly as one NVIDIA support engineer confirmed on a MSN2410 running MLNX-OS 3.6.1102.

Step 1: Create the VLAN and Assign Ports

switch(config)# vlan 2
switch(config)# interface ethernet 1/1
switch(config interface ethernet 1/1)# switchport mode trunk
switch(config interface ethernet 1/1)# switchport trunk allowed vlan add 2

Give the VLAN at least one access or trunk member port so the SVI has a Layer 2 path to real traffic.

Step 2: Enable IP Routing

Turn on the routing capability in global configuration mode. This is the step that unlocks the SVI addressing commands:

switch(config)# ip routing

Step 3: Configure the VLAN Interface (SVI)

switch(config)# interface vlan 2
switch(config interface vlan 2)# ip address 10.10.10.1/24
switch(config interface vlan 2)# exit

MLNX-OS uses CIDR-style prefix lengths on interface addresses. Repeat the process for every routed VLAN and add a static default route toward the upstream gateway when needed:

switch(config)# ip route 0.0.0.0/0 10.10.10.254

Verifying VLAN and IP Configuration

switch# show vlan
switch# show ip interface
switch# show ip route
switch# show interfaces ethernet 1/1

The interface and route tables should show the VLAN interfaces as up with the assigned addresses, and inter-VLAN pings should succeed once the routing table has the connected subnets.

Related Mellanox Reading

Continue with our MLNX-OS CLI getting-started commands, MLNX-OS configuration backup, and Mellanox switch initial setup basics.

原文链接:https://forums.developer.nvidia.com/t/unable-to-create-ip-interfaces-and-l2-vlan-configs/275734