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:
Router1:
doesn't work…
Best Answer
(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.
If you have access to config repositories, the best way to do this is to search through them all to find duplicate entries. Assuming you're on a *NIX host, you could do something like:
You want to look for anything that has a '2' in the first column. You can then find the offender and grep for the IP to find the routers that it's configured on. This would likely be the simplest way. You're already on the right track with a Perl script to poll the devices via SNMP to get at the router-id IP addresses, but I will say that SNMP code can be a little "hairier" than just simply using Net::SSH::Expect or Net::Appliance::Session to just log into the devices and dump the running configs to filehandles (at which point you can use the technique above).
Best Answer
(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
Router R2
(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 :
and
And you are able to check the reachability of the OSPF-learned network by pinging :
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.