Search...

Loading

Tuesday, April 10, 2012

Configure OSPF on cisco routers. Part №1.

God day!!!

Just want to apologize for my English. I am from Belarus and if there are errors, then feel free to write about them, I will correct them :).
In last posts we have looked how to configure RIP (Routing Information Protocol) and EIGRP (Enhanced Interior Gateway Routing Protocol). Today, I want to introduce you the following routing protocol, namely OSPF (Open Shortest Path First). This is one of the most popular protocol for using in local networks. And for that reason I suggest to divide our post on two parts.
In part №1 we will see commands of basic configuration of OSPF.
So, who interested, welcome…

In the Internet you may find a lot of information about that protocol. So, we begin our configurations right now.
Our network diagram will look like that:


Some explanations to the diagram. Routers R1 and R3 – are area border routers, called ABR (they have interfaces in area 0 (called backbone area) and other areas). Router R2 call autonomous system boundary router (ASBR), which has interfaces in backbone area 0 and in other autonomous systems. Router 4 – is internal router (IR), which has all interfaces in one area.
As the router ID will be using Loopback - interfaces (or rather their IP - address). Network 10.1.0.0/24 will be used to «exit to the outside world», and our default route will be going through that network. Networks 11.0.0.0/8, 12.0.0.0/8 and 13.0.0.0/8 will uses for emulate remote networks. We will set static routs to them and then we configure redistribution these networks into OSPF.
Successful implementation of this scheme we will assume the presence of network availability between hosts (command ping), the presence of all the routes in the routing table of each router (default route, static routes to remote networks and etc), obtained via OSPF.
So, let’s begin. Start with router R2:

R2>en
R2#conf t
R2(config)#interface loopback 0 – create loopback interface;
R2(config-if)#ip address 192.168.1.1 255.255.255.255 – set up IP-address to this interface;
R2(config-if)#exit
R2(config)#interface fa 0/0
R2(config-if)#ip address 172.16.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#interface fa 0/1
R2(config-if)#ip address 10.1.0.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 10.1.0.2 – configure default route;
R2(config)#ip route 11.0.0.0 255.0.0.0 null 0 – add a static route ( we use null interface for destination for example);
R2(config)#ip route 12.0.0.0 255.0.0.0 null 0
R2(config)#ip route 13.0.0.0 255.0.0.0 null 0
R2(config)#router ospf 1 – start OSPF process (the process ID is any positive integer value between 1 and 65,535);
R2(config-router)#network 172.16.1.0 0.0.0.255 area 0 – OSPF determines interfaces to process, not networks. So, with this command we add all interfaces that have IP addresses from 172.16.1.0/24 network (use wildcard mask in this case);
R2(config-router)#default-information originate – set default route to be propagated to all OSPF routers;
R2(config-router)#redistribute static subnets – enable redistribute static routes into OSPF process. Now all routers in OSPF will know about these routes;
R2(config-router)#exit
R2(config)#exit
R2#wr
R2#


Ok, let’s check our configuration. Make «show run» command on router R2:


Now, go to configuration of router R1:

R1>en
R1#conf t
R1(config)#interface loopback 0
R1(config-if)#ip address 192.168.2.1 255.255.255.255
R1(config-if)#description Router ID
R1(config-if)#exit
R1(config)#interface fa 0/0
R1(config-if)#ip address 172.16.1.2 255.255.255.0
R1(config-if)#ip ospf priority 200 – change the OSPF interface priority. Now this router will be a designated router (DR);
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fa 0/1
R1(config-if)#ip address 172.16.51.1 255.255.255.0
R1(config-if)#description To_host
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0
*Mar 1 00:04:40.663: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done – this message tell us about that relationship in OSPF process between routers are installed;
R1(config-router)#network 172.16.51.1 0.0.0.0 area 51 – the interface with an exact IP-address is to be put into Area 51;
R1(config-router)#exit
R1(config)#exit
R1#wr


Now, router R3:

R3>en
R3#conf t
R3(config)#interface loopback 0
R3(config-if)#ip address 192.168.3.1 255.255.255.255
R3(config-if)#description Router ID
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 172.16.1.3 255.255.255.0
R3(config-if)#ip ospf priority 100 – make this router a backup designated router (BDR);
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface serial 0/0
R3(config-if)#ip address 172.16.10.5 255.255.255.252
R3(config-if)#clock rate 56000
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 172.16.1.0 0.0.0.255 area 0
*Mar 1 00:04:44.003: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:04:47.783: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done – relationship between routers are installed;
R3(config-router)#network 172.16.10.4 0.0.0.3 area 1
R3(config-router)#area 1 stub – defines Area 1 as a Stub area. A stub area is an area which does not receive route advertisements (LSA type 4 and 5). Router sends to this Area only internal routes and default route;
R3(config-router)#exit
R3(config)#exit
R3#wr


Last router R4:

R4>en
R4#conf t
R4(config)#interface loopback 0
R4(config-if)#ip address 192.168.4.1 255.255.255.255
R4(config-if)#description Router ID
R4(config-if)#exit
R4(config)#interface fa 0/0
R4(config-if)#ip address 172.16.20.1 255.255.255.0
R4(config-if)#description To_host
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface serial 0/0
R4(config-if)#ip address 172.16.10.6 255.255.255.252
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network 172.16.0.0 0.0.255.255 area 1 – add all interfaces that have IP addresses from 172.16.0.0/16 network in OSPF process;
R4(config-router)#area 1 stub – defines Area 1 as a Stub area;
*Mar 1 00:03:54.239: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.3.1 on Serial0/0 from LOADING to FULL, Loading Done – relationship between routers are installed;
R4(config-router)#exit
R4(config)#exit
R4#wr


Now we can check that we have configured. Let’s see routing table of our routers. We will use commands from «show» groups. After that we will make a ping commands between hosts.
Routing table of router R2:

    where:
  • 1 – routes learned from the neighbors that are in other areas (Area 51 and Area 1);
  • 2 –static routes to remote networks;
  • 3 – router ID;
  • 4 – default route.
Routing table of router R1:

    where:
  • 1 – routes learned from the neighbors that are in other area (Area 1);
  • 2 – this is external routes to remote networks. They have been redistributed into OSPF on router R2;
  • 3 – router ID;
  • 4 – this is the same external route, but he called is a default route and he was advertised on router R2 by the command «default-information originate».
Routing table of router R3:

    where:
  • 1 – route learned from the neighbors that are in other area (Area 51);
  • 2 – route learned from the neighbor (router R4) that is in the same area;
  • 3 – this is external routes to remote networks;
  • 4 – router ID;
  • 5 – default route that was advertised on router R2.
Routing table of router R4:

    where:
  • 1 – routes learned from the neighbors that are in other areas (Area 0 and Area 51);
  • 2 – router ID;
  • 3 – default route that was advertised on router R2. As you can see this route is "internal" route (IA) (not external E2) and in routing table we don't see any other external routes. This is specific of Stub Area. We have only «internal» routes (IA) and one default route.
Now look other commands on routers («show ip ospf » and « show ip ospf neighbor »).
Router R2:


Router R1:


Router R3:


Router R4:


On pictures you can see that OSPF process running successful. DR and BDR elections were held as we planned, by changing the priorities at appropriate routers.
In the end let’s check network availability between hosts and «remote» IP-address (10.1.0.2).
Host №1:

    where:
  • 1 – ping on default gateway;
  • 2 – ping on host №2;
  • 3 – ping on «remote» IP-address.
Host №2:

    where:
  • 1 – ping on default gateway;
  • 2 – ping on host №1;
  • 3 – ping on «remote» IP-address.
As you can see all works fine. Congratulate you!!!
In this post we have learned how to configure OSPF on cisco devices, how to make redistribute static routes into OSPF process and how define a default route.
In the next post (part №2) I will tell you about how configure OSPF with authentication in NBMA networks (Non-Broadcast Multiple Access), such as Frame Relay.
On this, I want to finish this post. I hope he was informative for you and I want to thank you for your attention.

If you have a questions or comments, then do not be afraid to write me!!!! This is my contact information. I will pleased to answer!

I’m waiting for you in next posts!!!

With best regards, Ant0ni0n

No comments:

Post a Comment