OSPF Hello and Immediate Hello

Hey, I have some questions over OSPF hello and Immediate hello,

My lab is as such
R1 GI1- R2 GI1
R1- GI1 , netwrk type point to point, Hello: 5 sec, Dead 20 sec

r1#sh ip ospf int
GigabitEthernet1 is up, line protocol is up 
  Internet Address 12.12.12.1/24, Interface ID 7, Area 0
  Attached via Interface Enable
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State POINT_TO_POINT, BFD enabled
  Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5
r1#
*Jul 22 08:00:11.285: OSPF-1 HELLO Gi1: Rcv hello from 2.2.2.2 area 0 12.12.12.2
*Jul 22 08:00:13.380: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1

Question 1: is this a reply to the Rcv hello sent 08:00:11.285? or it’s a hello initiated by this R1? Is it required for the receival of Hello to acknowledge? I supposed hello can be sent by both peers, is that why I’m seeing Rcd and Send?

Question 2: what is immediate Hello?

I configured an acl on R1 G1 to deny OSPF traffic,

r1#sh access-list 110
Extended IP access list 110
    10 deny ospf any any
    20 permit ip any any
r1#conf t

OSPF peer down the moment I applied it and when I removed it, I could see there’s a Immediate Hello. The interval between the 1st Hello Sent and 2nd Hello sent by R1 is not with 5 seconds interval however, see 08:05:04.116 and 08:05.04.930. Can you advise what is this Immediate Hello, is this a hello initiated from R1 or reply to R2 since I can see R1 received hello at 08:05:04.930 also. Thanks a lot

*Jul 22 08:05:04.116: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Rcv hello from 2.2.2.2 area 0 12.12.12.2
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Send immediate hello to nbr 2.2.2.2, src address 12.12.12.2

Full debug logs:

r1(config-if)#
*Jul 22 08:04:40.688: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1
*Jul 22 08:04:45.505: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1
*Jul 22 08:04:46.339: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet1 from FULL to DOWN, Neighbor Down: Dead timer expired
*Jul 22 08:04:46.339: %BFD-6-BFD_SESS_DESTROYED: BFD-SYSLOG: bfd_session_destroyed,  ld:4097 neigh proc:OSPF, handle:1 act
r1(config-if)#
*Jul 22 08:04:50.111: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1
r1(config-if)#
r1(config-if)#do sh ip ospf ne
*Jul 22 08:04:54.729: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 ip access-group 110 in
*Jul 22 08:04:59.269: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1no ip access-group 110 in
r1(config-if)#
*Jul 22 08:05:04.116: OSPF-1 HELLO Gi1: Send hello to 224.0.0.5 area 0 from 12.12.12.1
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Rcv hello from 2.2.2.2 area 0 12.12.12.2
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Send immediate hello to nbr 2.2.2.2, src address 12.12.12.2
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Send hello to 12.12.12.2 area 0 from 12.12.12.1
*Jul 22 08:05:04.934: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet1 from LOADING to FULL, Loading Done
*Jul 22 08:05:04.946: %BFD-6-BFD_SESS_CREATED: BFD-SYSLOG: bfd_session_created, neigh 12.12.12.2 proc:OSPF, idb:GigabitEthernet1 handle:1 act
*Jul 22 08:05:05.346: %BFDFSM-6-BFD_SESS_UP: BFD-SYSLOG: BFD session ld:4097 handle:1 is going UP

Hello Wei Ping

OSPF hello packets are sent out by OSPF routers every 10 seconds by default, so it is normal to see syslogs with both sent and receive hello packets. In your output I see that the hello interval has been configured for 5 seconds, so you’ll see them more often. Hello packets are not sent as responses or replies to updates.

When two Cisco OSPF routers initially form an adjacency, they automatically send out a hello packet. As soon as an OSPF router receives such a hello, it responds immediately with a hello, regardless of the hello timer and of the last hello sent. In this case, you can see the following:

*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Rcv hello from 2.2.2.2 area 0 12.12.12.2
*Jul 22 08:05:04.930: OSPF-1 HELLO Gi1: Send immediate hello to nbr 2.2.2.2, src address 12.12.12.2

As soon as R1 received a hello, it sends one right back. See the time? It’s exactly the same. This behaviour ensures that an adjacency will be formed as soon as possible without waiting for the hello timer to expire. Imagine having a hello timer set to 60 seconds, you’d have to wait close to a minute to get the OSPF adjacency up.

Now keep in mind that this is not strictly RFC 2328 compliant behaviour, but is specific to Cisco devices. It’s just an enhancement that improves operation and convergence.

I hope this has been helpful!

Laz