HowTo Configure OSPF on Mellanox Switches (Running-Config)

Version 16

    This post describes the running-config of each Mellanox switch and the basic server configuration to configure OSPF on a basic four switch setup.

     

    References

    For more information on Mellanox VMS and various network configuration refer to the Mellanox VMS Reference Design located on  Mellanox Products: Mellanox Virtual Modular Switch™.

     

     

    Setup

    24.png

    Configuration

     

    Router Port Procedure

    sx01 switch running-config:

    ip routing

    protocol ospf

    router ospf

    router-id <loopback IP address>

    exit

    interface ethernet <x/y>

    no switchport

    ip address <w.x.y.z> /<netmask>

    encapsulation dot1q vlan <vlan-id>   --> Optional for VLAN tagging

    ip ospf area 0

     

    Repeat for additional interfaces.

    Note:  In general you want L2 network to be reachable you need to either redistribute using route-map or add it in the OSPF routing calculation.

     

    No router port procedure

    sx01 switch running-config:

    no spanning-tree

    lldp

    ip routing

    protocol ospf

    router ospf

    vlan 1-6

    interface ethernet 1/1 switchport access vlan 1

    interface ethernet 1/2 switchport access vlan 3

    interface ethernet 1/36 switchport access vlan 5

    interface vlan 1

    interface vlan 1 ip address 11.11.1.1 255.255.255.0

    interface vlan 1 ip ospf area 0.0.0.0

    interface vlan 1 ip ospf network point-to-point

    interface vlan 3

    interface vlan 3 ip address 11.11.3.1 255.255.255.0

    interface vlan 3 ip ospf area 0.0.0.0

    interface vlan 3 ip ospf network point-to-point

    interface vlan 5

    interface vlan 5 ip address 11.11.5.2 255.255.255.0

    interface vlan 5 ip ospf area 0.0.0.0

     

    sx02 switch running-config:

    no spanning-tree

    lldp

    ip routing

    protocol ospf

    router ospf

    vlan 1-6

    interface ethernet 1/1 switchport access vlan 2

    interface ethernet 1/2 switchport access vlan 4

    interface vlan 2

    interface vlan 2 ip address 11.11.2.1 255.255.255.0

    interface vlan 2 ip ospf area 0.0.0.0

    interface vlan 2 ip ospf network point-to-point

    interface vlan 4

    interface vlan 4 ip address 11.11.4.1 255.255.255.0

    interface vlan 4 ip ospf area 0.0.0.0

    interface vlan 4 ip ospf network point-to-point

    interface vlan 6

    interface vlan 6 ip address 11.11.6.2 255.255.255.0

    interface vlan 6 ip ospf area 0.0.0.0

     

    sx03 switch running-config:

    no spanning-tree

    lldp

    ip routing

    protocol ospf

    router ospf

    vlan 1-6

    interface ethernet 1/1 switchport access vlan 1

    interface ethernet 1/2 switchport access vlan 2

    interface vlan 1

    interface vlan 1 ip address 11.11.1.2 255.255.255.0

    interface vlan 1 ip ospf area 0.0.0.0

    interface vlan 1 ip ospf network point-to-point

    interface vlan 2

    interface vlan 2 ip address 11.11.2.2 255.255.255.0

    interface vlan 2 ip ospf area 0.0.0.0

    interface vlan 2 ip ospf network point-to-point

     

    sx04 switch running-config:

    no spanning-tree

    lldp

    ip routing

    protocol ospf

    router ospf

    vlan 1-6

    interface ethernet 1/1 switchport access vlan 3

    interface ethernet 1/2 switchport access vlan 4

    interface vlan 3

    interface vlan 3 ip address 11.11.3.2 255.255.255.0

    interface vlan 3 ip ospf area 0.0.0.0

    interface vlan 3 ip ospf network point-to-point

    interface vlan 4

    interface vlan 4 ip address 11.11.4.2 255.255.255.0

    interface vlan 4 ip ospf area 0.0.0.0

    interface vlan 4 ip ospf network point-to-point

     

     

    Server Configuration

    S1 Server Configuration

    ifconfig eth2 11.11.5.1/24 up

    route add -net 11.11.0.0 -gw 11.11.5.2

     

    S2 Server Configuration

    ifconfig eth2 11.11.6.1/24 up

    route add -net 11.11.0.0 -gw 11.11.6.2

     

    Troubleshooting

    Basic

    1. Make sure that all IP interfaces have an IP (either router interface of interface vlan), use  the command "ip address" under the interface configuration context.

    2. Make sure that all IP interfaces attached to the relevant OSPF area (e.g. 0.0.0.0), use the command "ip ospf  area" under the interface configuration context, to align.

    3. Make sure that both IP interfaces on the switch-routers (e.g. sx01, sx03) are configured as either point-to-point connection, or broadcast, use the command "ip ospf network" under the interface configuration context to align.

    4. Make sure that you have a route configured between the servers. Use the command "route add", see example above.

    5. Make sure that both IPs in the same link have addresses within the same address space, especially when using /31 space (only two addresses).

    Neighbor Network Type

    There are two options of OSPF network type configuration (point-to-point or broadcast). By default, Mellanox ethernet interface OPSF network type is point-to-point. Other switch vendors might have broadcast as a default. This leads to a possible mis-configuration. In the good condition, when Mellanox switch attempts to setup OSPF neighbor with other network vendors switch, the OSPF neighbor state will be FULL state.

     

    For example:

    switch (config) # show ip ospf neighbors

    Neighbor 10.0.0.1, interface address 10.12.12.1

    In the area 0.0.0.0  via Interface Ethernet 1/16

    Neighbor priority is 1, State is FULL

    No designated router on this network

    No backup designated router on this network

    Dead timer due in 30

    The root cause of this problem is that point-to-point network will not elect DR/BDR in OSPF process. When checking the OSPF neighbor in Mellanox, output "No designated router on this network" will be seen. When using broadcast network type, it will elect DR/BDR. Even when the OSPF sends database description (DBD) and link state (LS) update/acknowledge, the OSPF process will not proceed to the next step.

     

    To solve this problem, make sure both sides of switch network type is either point-to-point or broadcast. If two routers are connected to each other, point-to-point would be the preferable network type. Since point-to-point it will not elect DR/BRD, this will speed up OSPF neighbor setup.

     

    Use the below command in Mellanox to change the OSPF network type:

    switch (config) # interface ethernet 1/1 ip ospf network broadcast

    switch (config) # interface ethernet 1/16 ip ospf network point-to-point