Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the Easiest way to configure OSPF?

user-image
Question added by Shaif Bin Kalim , Desktop Support Engineer , Emirates Global Aluminum
Date Posted: 2015/07/13
Mahmoud Saad
by Mahmoud Saad , Network & Information Security Administrator , DP World Sokhna

the easiest way is to configure ospf between two routers :

1. router ospf x ( x is process-id this number can be the same on both routers )

2. network0.0.0.... area0 ( this will activate ospf on all interfaces on router )

but this is not the best practice in real implementations.

 

Regards,

Mahmoud

 

Jason Torres
by Jason Torres , Radio Technician , Philippine Long Distance Telephone Co.

1.    enable 

2.    configure terminal 

3.    router ospf process-id 

4.    network ip-address wildcard-mask area area-id 

5.    end 

Muhammad talal
by Muhammad talal , UI/Web designer and Web developer , Fiverr.com

consider the fallowing example to configure Open shortest path first

 

Hostname and IP address configuration in Router01

Connect to Router01 console and use the following IOS commands to configure host name as Router01.

Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router01 Router01(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router01 and configure IP address as172.16.0.1/16.

Router01>enable Router01#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router01(config)#interface fa0/0 Router01(config-if)#ip address172.16.0.1255.255.0.0 Router01(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/0 configuration mode on Router01 and configure IP address as172.17.0.1/16. You have to set a clock rate also using the "clock rate" command on S0/0 interface, since this is the DCE side.

Router01>enable Router01#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router01(config)#interface s0/0 Router01(config-if)#clock rate64000 Router01(config-if)#ip address172.17.0.1255.255.0.0 Router01(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Hostname and IP address configuration in Router02

Connect to Router02 console and use the following IOS commands to configure host name as Router02.

Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router02 Router02(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router02 and configure IP address as172.18.0.1/16.

Router02>enable Router02#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router02(config)#interface fa0/0 Router02(config-if)#ip address172.18.0.1255.255.0.0 Router02(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/0 configuration mode on Router02 and configure IP address as172.17.0.2/16.

Router02>enable Router02#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router02(config)#interface s0/0 Router02(config-if)#ip address172.17.0.2255.255.0.0 Router02(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/1 configuration mode on Router02 and configure IP address as172.19.0.1/16. You have to set a clock rate also using the "clock rate" command on S0/1 interface, since this is the DCE side.

Router02>enable Router02#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router02(config)#interface s0/1 Router02(config-if)#clock rate64000 Router02(config-if)#ip address172.19.0.1255.255.0.0 Router02(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Hostname and IP address configuration in Router03

Connect to Router03 console and use the following IOS commands to configure host name as Router03.

Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router03 Router03(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router03 and configure IP address as172.20.0.1/16.

Router03>enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#interface fa0/0 Router03(config-if)#ip address172.20.0.1255.255.0.0 Router03(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/1 configuration mode on Router03 and configure IP address as172.19.0.2/16.

Router03>enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#interface s0/1 Router03(config-if)#ip address172.19.0.2255.255.0.0 Router03(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router01

Connect to Router01 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router01. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.

Router01>enable Router01#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router01(config)#router ospf1 Router01(config-router)#network172.16.0.00.0.255.255 area0 Router01(config-router)#network172.17.0.00.0.255.255 area0 Router01(config-router)#exit Router01(config)#exit Router01#

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router02

Connect to Router02 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router02. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.

Router02> Router02>enable Router02#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router02(config)#router ospf1 Router02(config-router)#network172.17.0.00.0.255.255 area0 Router02(config-router)#network172.18.0.00.0.255.255 area0 Router02(config-router)#network172.19.0.00.0.255.255 area0 Router02(config-router)#exit Router02(config)#exit

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router03

Connect to Router03 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router03. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.

Router03>enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#router ospf1 Router03(config-router)#network172.19.0.00.0.255.255 area0 Router03(config-router)#network172.20.0.00.0.255.255 area0 Router03(config-router)#exit Router03(config)#exit Router03#

Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

How to view the routing table in Router01

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in all routers, we can use the "show ip route" to view the routing table in Router01, as shown below.

Router01>enable Router01#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type1, N2 - OSPF NSSA external type2 E1 - OSPF external type1, E2 - OSPF external type2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set C172.16.0.0/16 is directly connected, FastEthernet0/0 C172.17.0.0/16 is directly connected, Serial0/0 O172.18.0.0/16 [110/65] via172.17.0.2,00:26:31, Serial0/0 O172.19.0.0/16 [110/128] via172.17.0.2,00:26:21, Serial0/0 O172.20.0.0/16 [110/129] via172.17.0.2,00:24:54, Serial0/0

The "O" character at the beginning of a line in routing table shows that it is a route discovered by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly connected network.

How to view the routing table in Router02

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in all routers, we can use the "show ip route" to view the routing table in Router02, as shown below.

Router02>enable Router02#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type1, N2 - OSPF NSSA external type2 E1 - OSPF external type1, E2 - OSPF external type2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set O172.16.0.0/16 [110/65] via172.17.0.1,00:30:20, Serial0/0 C172.17.0.0/16 is directly connected, Serial0/0 C172.18.0.0/16 is directly connected, FastEthernet0/0 C172.19.0.0/16 is directly connected, Serial0/1 O172.20.0.0/16 [110/65] via172.19.0.2,00:28:08, Serial0/1

The "O" character at the beginning of a line in routing table shows that it is a route discovered by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly connected network.

How to view the routing table in Router03

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in all routers, we can use the "show ip route" to view the routing table in Router03, as shown below.

Router03>enable Router03#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type1, N2 - OSPF NSSA external type2 E1 - OSPF external type1, E2 - OSPF external type2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set O172.16.0.0/16 [110/129] via172.19.0.1,00:29:43, Serial0/1 O172.17.0.0/16 [110/128] via172.19.0.1,00:29:43, Serial0/1 O172.18.0.0/16 [110/65] via172.19.0.1,00:29:43, Serial0/1 C172.19.0.0/16 is directly connected, Serial0/1 C172.20.0.0/16 is directly connected, FastEthernet0/0

The "O" character at the beginning of a line in routing table shows that it is a route discovered by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly connected network.

Verify the connectivity between networks using the ping command

To verify the Open Shortest Path First (OSPF) Protocol routes and the connectivity between networks, run the ping command from Host01 (IP address:172.16.0.10/16) to Host03 (IP address:172.20.0.10/16).

C:\\\\>ping172.20.0.10

Pinging172.20.0.10 with32 bytes of data:

Reply from172.20.0.10: bytes=32 time=172ms TTL=125Reply from172.20.0.10: bytes=32 time=188ms TTL=125Reply from172.20.0.10: bytes=32 time=157ms TTL=125Reply from172.20.0.10: bytes=32 time=188ms TTL=125

Ping statistics for172.20.0.10:Packets: Sent =4, Received =4, Lost =0 (0% loss),Approximate round trip times in milli-seconds:Minimum =157ms, Maximum =188ms, Average =176ms

The ping reply from Host03 (IP address:172.20.0.10/16) shows that the Open Shortest Path First (OSPF) Protocol is configured well in three routers and there is network connectivity between different networks.

More Questions Like This