HowTo Configure Switch Port Types with MLNX-OS

Version 10

    This post describes basic switch port configuration (access, trunk) with MLNX-OS.

     

    >>Learn how to configure MLAG for free on the Mellanox Academy

     

     

    References

     

     

    Switch Port Types

    There are five types of switch ports (per port):

     

    • Access - untagged packets are sent from this port and the packets received are expected to be untagged. Tagged packets are dropped. Port PVID is assigned to the packet upon ingress. Access ports are normally used in switch-to-server connectivity.
    • Access-DCB - similar to access, but the egress packets are sent with priority tag (VLAN ID =0).

    • Trunk - packets sent from this port are tagged and the packets received are expected to be tagged. Untagged packets are dropped. There is an option to configure multiple VLANs on the trunk port. PVID cannot be configured on the port. Trunk port is suitable for switch-to-switch connectivity, or switch-to-server connectivity when multiple VLANs are used on the server port.
    • Hybrid - packets are sent tagged or untagged, the port expects both tagged and untagged packets. This mode is a combination of Access and Trunk modes. There is an option to configure multiple VLANs on the hybrid port. PVID is configured on the port for untagged ingress packets.
    • Dot1q-tunnel  - Q-in-Q mode. Please refer to QinQ Considerations and Configuration on Mellanox Switches for more information.

     

    switch (config) # switchport mode ?

    <switchport modes>

    access                         Only untagged ingress Ethernet packets are allowed

    trunk                          Only tagged ingress Ethernet packets are allowed

    hybrid                         Both tagged and untagged ingress Ethernet packets are allowed

    access-dcb                     Only untagged ingress Ethernet packets are allowed. Egress packets will be priority tagged

    dot1q-tunnel                   Both tagged and untagged ingress Ethernet packets are allowed. Egress packets are tagged with a second VLAN (802.1Q) header

     

    Configuration Examples

     

    VLAN

    By default only VLAN 1 is enabled on the switch and assigned to all ports as PVID.

    To add more VLANs to the VLAN table, run the following command:

    switch (config) # vlan 10

    ...

    switch (config) # no vlan 10

     

    To add a range of VLANs to the VLAN table, run the "vlan" command in the following way:

    switch (config) # vlan 100-200

     

    Access Configuration

    1. Setting the switch port mode to access:

    switch (config) # interface ethernet 1/1

    switch (config interface ethernet 1/1 ) # switchport mode access

     

    2. Setting the PVID:

    switch (config interface ethernet 1/1 ) # switchport access vlan 1

    Note: Access-DCB configuration is similar to Access.

     

    Trunk Configuration

    1. Setting the switch port mode to to trunk:

    switch (config) # interface ethernet 1/1

    switch (config interface ethernet 1/1 ) # switchport mode trunk

     

    2. Adding additional VLANs:

     

    2.a. Allow all VLANs in the VLAN table.

    switch (config interface ethernet 1/1 ) # switchport trunk allowed-vlan all

     

    Note: When allowing all allowed VLANs, new VLANs that are added to the VLAN table will be added automatically to this port.

     

    2.b. Allow range of VLANs in the VLAN table.

    switch (config interface ethernet 1/1 ) # switchport trunk allowed-vlan 100-200

     

    Hybrid Configuration

    1. Setting the switch port mode to to hybrid:

    switch (config) # interface ethernet 1/1

    switch (config interface ethernet 1/1 ) # switchport mode hybrid

     

    2. Adding additional VLANs:

     

    2.a. Allow all VLANs in the VLAN table.

    switch (config interface ethernet 1/1 ) # switchport hybrid allowed-vlan all

     

    Note: When allowing all allowed VLANs, new VLANs that are added to the VLAN table will be added automatically to this port.

     

    2.b. Allow range of VLANs in the VLAN table.

    switch (config interface ethernet 1/1 ) # switchport hybrid allowed-vlan 100-200

     

     

    3. Setting the PVID:

    switch (config interface ethernet 1/1 ) # switchport access vlan 1

     

    This PVID is referred sometimes as the native VLAN or the VLAN for untagged frames.

     

    Dot1q-tunnel Configuration

     

    Refer to QinQ Considerations and Configuration on Mellanox Switches

     

     

    Verification

     

    Use the commands show interface switchport and show vlan to see the switch port configuration status.

     

    switch (config) # show interfaces switchport

    Interface       Mode         Access vlan        Allowed vlans

    ---------------------------------------------------------------------------------

    Eth1/1          hybrid       1                  100

    Eth1/2          hybrid       1                  100

    Eth1/3          access       1

    Eth1/4          access       1

    Eth1/5          trunk        N/A                1, 100

    ...

    Eth1/36         access       1

     

    # show vlan

     

     

    VLAN    Name                    Ports

    ----    -----------             --------------------------------------

    1       default                 Eth1/1, Eth1/2, Eth1/3, Eth1/4,

                                    Eth1/6, Eth1/7, Eth1/8, Eth1/9, Eth1/10,

                                    Eth1/11, Eth1/12, Eth1/13, Eth1/14, Eth1/15,

                                    Eth1/16, Eth1/17, Eth1/18, Eth1/19, Eth1/20,

                                    Eth1/21, Eth1/22, Eth1/23, Eth1/24, Eth1/25,

                                    Eth1/26, Eth1/27, Eth1/28, Eth1/29, Eth1/30,

                                    Eth1/31, Eth1/32, Eth1/33, Eth1/34, Eth1/35,

                                    Eth1/36

    100                             Eth1/1, Eth1/2, Eth1/5