To begin with we need to set up the network using the diagram below.
Now we need to configure an IP address on interface Serial 0 on both routers
R1> enable R1# configure terminal R1(config)# interface serial 0/0 R1(config-if)# ip address 192.168.1.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# end R1#
R2> enable R2# configure terminal R2(config)# interface serial 0/0 R2(config-if)# ip address 192.168.1.2 255.255.255.0 R2(config-if)# no shutdown R2(config-if)# end R2#
Once we have done this we need to start OSPF and add a network to it.
R1# configure terminal R1(config)# router ospf 1 R1(config-router)# network 192.168.1.0 0.0.0.255 area 0 R1(config-router)# end R1#
R2# configure terminal R2(config)# router ospf 1 R2(config-router)# network 192.168.1.0 0.0.0.255 area 0 R2(config-router)# end R2#
The network starts OSPF for that network and on the interface that IP address is on. So if we was to have 2 routers connected to R1 we would need to put 2 network statements so OSPF starts on both interfaces. Now we need to make sure OSPF is working we do this by using the “Show ip ospf neighbor” command
We can see that we have 1 neighbour on each of our routers. OSPF forms neighbours by sending out “Hello Messages”. These messages are reseved by the neighbours and are checked. In order of OSPF to form neighbour relationships the following need to match in the hello “message”.
– Area ID (area 0 in our example)
– Password ( We have not set one)
– Subnet and mask (192.168.1.0 255.255.255.0 in our example)
– Area type (We have not changed it)
– Hello and Dead Timers ( we are using the default one hello 10 dead 40)
Now to test OSFP we will now create a loopback interface and put that as part of the OSPF process.
R2(config)# interface loopback 1 R2(config-if)# ip address 2.2.2.2 255.255.255.0 R2(config-if)#exit R2(config)# router ospf 1 R2(config-router)# network 2.2.2.0 0.0.0.255 area 0 R2(config-router)# end R2#
Now we need to check on R1 to see if we have the route.
We now have the route and to test it we will send a ping
and once we are done we must save our config
R1# copy running-config startup-config
R2#copy running-config startup-config
for more information please visit:
http://www.cisco.com/en/US/docs/ios/12_0/np1/configuration/guide/1cospf.html