HowTo Configure VRRP on Mellanox Ethernet Switches

Version 7

    This post shows a basic procedure to configure VRRP on Mellanox Ethernet Switches.

     

    References

    • MLNX-OS User Manual

    Setup

    The setup is very basic, consist of a server S1 and three Mellanox switches (SX01, SX02 and SX03), connected as described below.

    In this setup, VLAN1 is being used and the 11.11.1.0/24 network.

     

    2.png

    Server Configuration

    The interface that is connected to the SX03 switch should be configured with an IP address within the 11.11.1.0/24 network

    # ifconfig eth2 11.11.1.1/24 up

     

    Switch Configuration (SX03)

    The SX03 switch is a L2 switch that all the 3 ports should be enabled with VLAN1 as access port

    switch (config) # show interfaces switchport

    Interface  |    Mode    | Access vlan |        Allowed vlans

    -----------|------------|-------------|---------------------------

    Eth1/1      access          1

    Eth1/2      access          1

    Eth1/3      access          1

     

    Switch Configuration (SX01, SX02)

    The SX01, SX02 switches should be configured as follows:

    1. Enable globally IP routing and vrrp.

    switch (config) # ip routing

    switch (config) # protocol vrrp

     

    2. Make sure VLAN1 is configured on the relevant interfaces connected to SX03

    switch (config) # show interfaces switchport

    Interface  |    Mode    | Access vlan |        Allowed vlans

    -----------|------------|-------------|---------------------------

    Eth1/1      access          1

    Eth1/2      access          1

    Eth1/3      access          1

    3. Configure VLAN interface with dedicated IP address per switch for VLAN1.

    switch (config) # interface vlan 1

     

    //Configure on SX01

    switch (config interface vlan 1) # ip address 11.11.1.101 /24

     

    //Configure on SX02

    switch (config interface vlan 1) # ip address 11.11.1.102 /24

    4. Create VRRP group on the interface VLAN 1 and set the virtual IP address (floating IP address)

    switch (config) # interface vlan 1 vrrp 100

    switch (config interface vlan 1 vrrp 100) # address 11.11.1.100

     

    Note: the VRRP master will be selected according to the highest IP address (by default) in this case SX02.


    Verification

    1. show VRRP configuration and status on SX02

    sx02 (config) #   show vrrp

    Interface  VR         Admin State      Priority   Adv-Intvl   Preempt    State      VR IP addr

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

    Vlan1      100        Enabled           100        1          Enabled    Master    11.11.1.100

    2. show VRRP configuration and status on SX01

    sx01 (config) # show vrrp

    Interface  VR         Admin State      Priority   Adv-Intvl   Preempt    State      VR IP addr

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

    Vlan1      100        Enabled           100        1          Enabled    Backup    11.11.1.100

    3. Ping from the server to the 3 IP addresses.

    In our case SX02 will answer both the physical address 11.11.1.102 and the virtual address 11.11.1.100.

    # ping 11.11.1.100

    PING 11.11.1.100 (11.11.1.100) 56(84) bytes of data.

    64 bytes from 11.11.1.100: icmp_seq=1 ttl=64 time=0.538 ms

    64 bytes from 11.11.1.100: icmp_seq=2 ttl=64 time=0.253 ms

    64 bytes from 11.11.1.100: icmp_seq=3 ttl=64 time=0.252 ms

    ^C

    --- 11.11.1.100 ping statistics ---

    3 packets transmitted, 3 received, 0% packet loss, time 1999ms

    rtt min/avg/max/mdev = 0.252/0.347/0.538/0.136 ms

    # ping 11.11.1.101

    PING 11.11.1.101 (11.11.1.101) 56(84) bytes of data.

    64 bytes from 11.11.1.101: icmp_seq=1 ttl=64 time=0.345 ms

    64 bytes from 11.11.1.101: icmp_seq=2 ttl=64 time=0.236 ms

    ^C

    --- 11.11.1.101 ping statistics ---

    2 packets transmitted, 2 received, 0% packet loss, time 1000ms

    rtt min/avg/max/mdev = 0.236/0.290/0.345/0.057 ms

    # ping 11.11.1.102

    PING 11.11.1.102 (11.11.1.102) 56(84) bytes of data.

    64 bytes from 11.11.1.102: icmp_seq=1 ttl=64 time=0.255 ms

    64 bytes from 11.11.1.102: icmp_seq=2 ttl=64 time=0.206 ms

     

    Load Balancing (Advance)

    For load balancing purposes, it is possible to split the load of the server traffic to the two switches.

    Let's say, S1 server is configured with default gateway of 11.11.1.100, while S2 server is configured with default gateway of 11.11.1.200.

     

    3.png

     

    Switch Configuration (SX01, SX02)

    In addition to the configuration above, we need to configure VRRP group 200 (11.11.1.200) on both switches on interface VLAN 1, and lower the priority of SX02 on VRRP group 100 in order that SX01 will be select as a master of VRRP group 100.

    // SX01switch configuration

    switch (config) # interface vlan 1 vrrp 100

    switch (config) # interface vlan 1 vrrp 100 address 11.11.1.100

    switch (config) # interface vlan 1 vrrp 200

    switch (config) # interface vlan 1 vrrp 200 address 11.11.1.200

     

    // SX02 switch configuration

    switch (config) # interface vlan 1 vrrp 100

    switch (config) # interface vlan 1 vrrp 100 address 11.11.1.100

    switch (config) # interface vlan 1 vrrp 100 priority 1

    switch (config) # interface vlan 1 vrrp 200

    switch (config) # interface vlan 1 vrrp 200 address 11.11.1.200

     

    Verification

    Check VRRP status, and verify that SX01 is the master for VRRP group 100, while SX02 is the master for VRRP group 200.

    sx01 (config) #  show vrrp
    Interface  VR         Admin State      Priority   Adv-Intvl   Preempt    State      VR IP addr
    ------------------------------------------------------------------------------------------------
    Vlan1      100       Enabled           100        1          Enabled    Master    11.11.1.100

    Vlan1      200        Enabled          100        1          Enabled    Backup     11.11.1.200

     

    sx02 (config) #  show vrrp
    Interface  VR         Admin State      Priority   Adv-Intvl   Preempt    State      VR IP addr
    ------------------------------------------------------------------------------------------------
    Vlan1      100        Enabled           1          1          Enabled    Backup     11.11.1.100

    Vlan1      200        Enabled           100        1          Enabled    Master     11.11.1.200

    r-qa-sit-sx02 [standalone: master] (config) #