OSPF – Why Can’t I Ping the Other Router Using OSPF Protocol

network-discoveryospf

I built a simple Network with 2 routers, the problem is that i cant reach to other router, somehow there's problem i couldn't figure out.

here is the configurations:

Router0:

enter image description here


Router1:

enter image description here

doesn't work…

Best Answer

working ospf drawing

(I imagine your setup to be something like this)

Your OSPF adjacency is not coming up because the IP addresses on the facing interfaces between R1 and R2 are not in the same subnet.

As soon as you use two IP addresses that are in the same subnet (as in the drawing above), you will have IP connectivity between R1 and R2, and your OSPF adjacency can be established :

Router R1

!
interface GigabitEthernet0/0
 ip address 72.40.42.1 255.255.254.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
!
interface GigabitEthernet1/0
 ip address 72.40.40.1 255.255.254.0
 negotiation auto
!
<...>
!
router ospf 1
 router-id 1.1.1.1
 network 72.40.40.0 0.0.1.255 area 0
 network 72.40.42.0 0.0.1.255 area 0
!

Router R2

!
interface GigabitEthernet0/0
 ip address 72.40.43.1 255.255.254.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
!
interface GigabitEthernet1/0
 ip address 72.40.46.1 255.255.254.0
 negotiation auto
!
<...>
!
router ospf 1
 router-id 2.2.2.2
 network 72.40.42.0 0.0.1.255 area 0
 network 72.40.46.0 0.0.1.255 area 0
!

(Please note that 72.40.42.1/23 and 72.40.43.1/23 are in the same subnet) << as pointed out above, this is the crucial point

Your OSPF comes up now :

R1#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:38    72.40.43.1      GigabitEthernet0/0
R1#

and

R2#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:37    72.40.42.1      GigabitEthernet0/0
R2#

And you are able to check the reachability of the OSPF-learned network by pinging :

R2#ping 72.40.40.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 72.40.40.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/32/48 ms

The crucial point is that the IP addresses on the link between R1 and R2 have to be in the same subnet (or you need to configure static routes or other less elegant tricks). Otherwise, R1 will have no way to know how to reach R2, and vice-versa.