...

Saturday, November 6, 2010

CCNP BSCI 07

Now I'll walk through basic OSPF configuration. To do this, we'll use the following topology (notice I have new Cisco icons. The only other article I used these was at VPN Introduction!):


Now we'll assume that all IP addresses on interfaces are set and the interfaces are all up. We'll now begin configuration on R1.

First, we'll go into the OSPF process using:
router ospf 1

Next, we'll enable OSPF on its LAN interface:
network 172.16.1.0 0.0.0.255 area 0

This is similar to flicking an ON switch on any interface starting with 172.16.1.x.

Since R1's interface is 172.16.1.1, we can actually be more specific by using:
network 172.16.1.1 0.0.0.0 area 0

If you recall, typing "area 0" actually makes R1 a Backbone router. We'll now set up the Serial Link to be in Area 0 as well:
network 10.0.0.1 0.0.0.0 area 0

In newer routers, we can use the interface command to add the interface to the OSPF process like this:
in s0/0
ip ospf 1 area 0


This is the only way we can use to add IPv6 interface to OSPF.

To check the router's Router ID, use:
show ip ospf

Alternately, you can use:
show ip prot

Notice that R1 is the DR for the 172.16.1.0/24 network, and is the DR for the Serial interface as well.

Now, hop over to R2 and before we'll start configuration we can turn on the debugging for OSPF to see how the neighbors are formed:
debug ip ospf adj
debug ip ospf events


Now lets enable the process on the 172.16.0.0/24 network:
router ospf 1
network 172.16.0.2 0.0.0.0 area 0


You'll immediately start seeing a Hello packet being sent, and you'll continue seeing it every 10 seconds.

Now, for the good part, we'll enable OSPF on the Serial link as well. This will start the neighbor forming between R1 and R2 over the Serial Link:
network 10.0.0.2 0.0.0.0 area 0

Below is a typical output:
*Mar  1 00:12:22.083: OSPF: Interface Serial0/0 going Up
*Mar  1 00:12:22.087: OSPF: Send hello to 224.0.0.5 area 0 on Serial0/0 from 10.0.0.2
*Mar  1 00:12:22.299: OSPF: Rcv hello from 172.16.1.1 area 0 from Serial0/0 10.0.0.1
*Mar  1 00:12:22.303: OSPF: Send immediate hello to nbr 172.16.1.1, src address 10.0.0.1, on Serial0/0
*Mar  1 00:12:22.307: OSPF: Send hello to 224.0.0.5 area 0 on Serial0/0 from 10.0.0.2
*Mar  1 00:12:22.311: OSPF: End of hello processing
*Mar  1 00:12:22.335: OSPF: Rcv DBD from 172.16.1.1 on Serial0/0 seq 0x14E9 opt 0x52 flag 0x7 len 32  mtu 1500 state INIT
*Mar  1 00:12:22.335: OSPF: 2 Way Communication to 172.16.1.1 on Serial0/0, state 2WAY
*Mar  1 00:12:22.339: OSPF: Send DBD to 172.16.1.1 on Serial0/0 seq 0xA33 opt 0x52 flag 0x7 len 32
*Mar  1 00:12:22.343: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar  1 00:12:22.347: OSPF: Send DBD to 172.16.1.1 on Serial0/0 seq 0x14E9 opt 0x52 flag 0x2 len 72
*Mar  1 00:12:22.363: OSPF: Rcv hello from 172.16.1.1 area 0 from Serial0/0 10.0.0.1
*Mar  1 00:12:22.367: OSPF: End of hello processing
*Mar  1 00:12:22.387: OSPF: Rcv DBD from 172.16.1.1 on Serial0/0 seq 0x14EA opt 0x52 flag 0x3 len 72  mtu 1500 state EXCHANGE
*Mar  1 00:12:22.395: OSPF: Send DBD to 172.16.1.1 on Serial0/0 seq 0x14EA opt 0x52 flag 0x0 len 32
*Mar  1 00:12:22.423: OSPF: Rcv DBD from 172.16.1.1 on Serial0/0 seq 0x14EB opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Mar  1 00:12:22.423: OSPF: Exchange Done with 172.16.1.1 on Serial0/0
*Mar  1 00:12:22.423: OSPF: Send LS REQ to 172.16.1.1 length 12 LSA count 1
*Mar  1 00:12:22.427: OSPF: Send DBD to 172.16.1.1 on Serial0/0 seq 0x14EB opt 0x52 flag 0x0 len 32
*Mar  1 00:12:22.427: OSPF: Rcv LS REQ from 172.16.1.1 on Serial0/0 length 36 LSA count 1
*Mar  1 00:12:22.427: OSPF: Send UPD to 10.0.0.1 on Serial0/0 length 40 LSA count 1
*Mar  1 00:12:22.431: OSPF: Rcv LS UPD from 172.16.1.1 on Serial0/0 length 64 LSA count 1
*Mar  1 00:12:22.431: OSPF: Synchronized with 172.16.1.1 on Serial0/0, state FULL
*Mar  1 00:12:22.435: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.1.1 on Serial0/0 from LOADING to FULL, Loading Done
*Mar  1 00:12:22.595: OSPF: Build router LSA for area 0, router ID 172.16.0.2, seq 0x80000006, process 1
*Mar  1 00:12:22.775: OSPF: Rcv LS UPD from 172.16.1.1 on Serial0/0 length 88 LSA count 1


Notice that the IP addresses shown are actually the Router ID. Now, to look inside the Neighbor Table, type:
show ip ospf nei

Notice that on the Serial Link, nobody's the DR or BDR, and it's denoted by a hyphen:
Neighbor ID     Pri   State           Dead Time   Address         Interface
172.16.1.1        0   FULL/  -        00:00:35    10.0.0.1        Serial0/0


Now, we'll begin setting up R3 and R4. Once we have all R3 and R4 running in the same fashion, without changing the priority or the Router ID, who do you think would be the DR and BDR for the 172.16.0.0/24 network?

If you guessed R4 and then R3, you are correct! Since Priority is the same, the highest Router ID would win. Since we have no Loopback interfaces, the Router ID would be the Fast Ethernet interface:
Neighbor ID     Pri   State           Dead Time   Address         Interface
172.16.1.1        0   FULL/  -        00:00:35    10.0.0.1        Serial0/0
172.16.0.4        0   FULL/  DR       00:00:35    172.16.0.4      FastEthernet0/0
172.16.0.3        0   FULL/  BDR      00:00:35    172.16.0.3      FastEthernet0/0


If you still have the debugging turned on, this is what you'll see in the flurry of messages:
*Mar  1 00:19:28.259: OSPF: DR/BDR election on FastEthernet0/0
*Mar  1 00:19:28.263: OSPF: Elect BDR 172.16.0.3
*Mar  1 00:19:28.263: OSPF: Elect DR 172.16.0.4
*Mar  1 00:19:28.267: OSPF: Elect BDR 0.0.0.3
*Mar  1 00:19:28.267: OSPF: Elect DR 172.16.0.4
*Mar  1 00:19:28.267:        DR: 172.16.0.4 (Id)   BDR: 172.16.0.3 (Id)


On the other routers, you would see R2 labeled as a DROTHER.

Now we'll go through two ways to change the Router ID. Back on R1, create a Loopback interface as shown:
in lo0
ip add 1.0.0.2 255.255.255.255


This is the official definition for the Router ID:
"The OSPF router ID is a 32-bit IP address selected at the start of the OSPF process. The highest IP address configured on the router is the router ID. If a loopback address is configured, it is the router ID. In the case of multiple loopback addresses, the highest loopback address is the router ID. Once the router ID is elected, it does not change until OSPF restarts or is manually changed with the [router-id] command under [the OSPF context]."

At this point, the Router ID would still not change if you check it with:
show ip ospf

To make the changes apply, you'll need to use:
clear ip ospf proc

If it doesn't change, you may have to reset the whole system:
wr
reload


Another way to change the Router ID is simply using the command:
router-id 1.0.0.2

The recommended way is the router-id command because it is important for advanced features like Virtual Link and you wouldn't want it to change by chance. As usual, you would have to clear the OSPF process.

Another way to influence DR/BDR election is to use the "priority" command under the interface:
in f0/0
ip ospf priority 2


A router with the priority of 0 will exempt it from election. You would have to clear the process of the existing DR and BDR after changing the priority of any router because it does not do preemption.

Now that we're done with the basic concepts, we'll go through some basic verification commands:

To check the timers being used, we can use:
show ip ospf int

To check the topology table, we can use:
show ip ospf database

In the topology table, we can check the age (in seconds) and the sequence number (a 4-byte-value) which increases every update. Once the sequence number reaches 0x8fffffff, it will notify neighbors with a special process and it starts from 0 again.

To check the neighbor table, we can use:
show ip ospf nei

No comments :

Post a Comment

<