Categories R&S

OSPF – L3 vlan interface and OSPF neighbors

This is a quick post to see the process of forming OSPF adjacency when using interface vlan on L3 switches.

I figure out at work that we saw one neighbor per interface vlan configured and I’d like to know why.

 

Diagram:

OSPF – L3 vlan interface and OSPF neighbors

 

Basic config for this test, we create two interfaces vlan and a trunk between the two L3 switches, then we enable OSPF.

SW1#sh run int vlan 2
interface Vlan2
 ip address 10.1.1.1 255.255.255.240

SW1#sh run int vlan 3
interface Vlan3
 ip address 10.1.1.17 255.255.255.240

SW1#sh run int Ethernet0/0
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 2,3
 switchport mode trunk

SW1#sh run | s router
router ospf 1
 router-id 192.168.1.1
 network 10.1.1.0 0.0.0.255 area 0
SW2#sh run int vlan 2
interface Vlan2
 ip address 10.1.1.2 255.255.255.240

SW2#sh run int vlan 3
interface Vlan3
 ip address 10.1.1.18 255.255.255.240

SW2#sh run int Ethernet0/0
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 2,3
 switchport mode trunk

SW2#sh run | s router
router ospf 1
 router-id 192.168.1.2
 network 10.1.1.0 0.0.0.255 area 0

 

As you can see, we have two OSPF neighbors with same router-ID.

SW1#sh ip ospf neigh
Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.1.2       1   FULL/DR         00:00:33    10.1.1.18       Vlan3
192.168.1.2       1   FULL/DR         00:00:36    10.1.1.2        Vlan2

 

So why do we get one neighbor per interface vlan ?

Let’s try to deep dive into this

 

From the OSPF neighbor detail, we can see that the interfaces addresses are different for the two neighbor, one is for vlan2 and the other one for vlan 3.

The DR and BDR ip addresses are also different.

SW1#sh ip ospf neigh det
 Neighbor 192.168.1.2, interface address 10.1.1.18
    In the area 0 via interface Vlan3
    Neighbor priority is 1, State is FULL, 6 state changes
    DR is 10.1.1.18 BDR is 10.1.1.17
    Options is 0x12 in Hello (E-bit, L-bit)
    Options is 0x52 in DBD (E-bit, L-bit, O-bit)
    LLS Options is 0x1 (LR)
    Dead timer due in 00:00:38
    Neighbor is up for 00:18:26
    Index 1/1, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
 Neighbor 192.168.1.2, interface address 10.1.1.2
    In the area 0 via interface Vlan2
    Neighbor priority is 1, State is FULL, 6 state changes
    DR is 10.1.1.2 BDR is 10.1.1.1
    Options is 0x12 in Hello (E-bit, L-bit)
    Options is 0x52 in DBD (E-bit, L-bit, O-bit)
    LLS Options is 0x1 (LR)
    Dead timer due in 00:00:31
    Neighbor is up for 00:18:25
    Index 2/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

 

Let’s run some debug to see how the adjacency is formed (debug ip ospf 1 adj) and clear the OSPF process:

SW1#clear ip ospf proc
Reset ALL OSPF processes? [no]: yes
*Feb 12 11:37:44.499: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on Vlan3 from FULL to DOWN, Neighbor Down: Interface down or detached
*Feb 12 11:37:44.499: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on Vlan2 from FULL to DOWN, Neighbor Down: Interface down or detached

 

After the OSPF process is cleared, we can see the adjacency event for both vlan 2 and vlan 3.

*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Neighbor change event
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: DR/BDR election
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect BDR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect DR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect DR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: DR: 192.168.1.1 (Id)   BDR: none
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Remember old DR 192.168.1.2 (id)
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: 192.168.1.1 address 10.1.1.17 is dead, state DOWN
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Neighbor change event
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: DR/BDR election
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect DR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Elect DR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: DR: none    BDR: none
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Flush network LSA immediately
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl3: Remember old DR 192.168.1.1 (id)

*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Neighbor change event
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: DR/BDR election
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect BDR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect DR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect DR 192.168.1.1
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: DR: 192.168.1.1 (Id)   BDR: none
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Remember old DR 192.168.1.2 (id)
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: 192.168.1.1 address 10.1.1.1 is dead, state DOWN
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Neighbor change event
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: DR/BDR election
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect DR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect BDR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Elect DR 0.0.0.0
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: DR: none    BDR: none
*Feb 12 11:39:59.199: OSPF-1 ADJ   Vl2: Flush network LSA immediately

So it works the same as if it was two different equipment.

 

When debugging OSPF packet, we can see we receive packet from vlan2 and from vlan3:

*Feb 12 11:41:18.127: OSPF-1 PAK  : rcv. v:2 t:1 l:48 rid:192.168.1.2 aid:0.0.0.0 chk:5251 aut:0 auk: from Vlan2
*Feb 12 11:41:22.115: OSPF-1 PAK  : rcv. v:2 t:1 l:48 rid:192.168.1.2 aid:0.0.0.0 chk:5231 aut:0 auk: from Vlan3

 

Let’s debug the hello packet too.

Hello packets are also sent from vlan2 and from vlan3:

*Feb 12 11:49:59.523: OSPF-1 HELLO Vl2: Send immediate hello to nbr 192.168.1.2, src address 10.1.1.2
*Feb 12 11:49:59.523: OSPF-1 HELLO Vl3: Send immediate hello to nbr 192.168.1.2, src address 10.1.1.18
*Feb 12 11:52:10.647: OSPF-1 HELLO Vl3: Send hello to 224.0.0.5 area 0 from 10.1.1.17
*Feb 12 11:52:11.271: OSPF-1 HELLO Vl2: Send hello to 224.0.0.5 area 0 from 10.1.1.1

 

This explain why we see one neighbor per interface vlan.

The fact that hello packets are sent for all OSPF enable interfaces explain why there is one neighbor per interface vlan.

 

I couldn’t find any info on the web describing this process when using interface vlan so I hope this post could help.

 

Thank you for reading.

 

 

OSPF – L3 vlan interface and OSPF neighbors