Figure 5-9 OSPF Network
Just like EIGRP, OSPF configuration is divided into two parts – the global configuration and the interface level configuration. Globally, configuring OSPF includes enabling the process and adding networks to be advertised. To enable the OSPF process use the router ospf process_id global configuration command. In this command, process_id is a locally significant number and does not represent the AS. Since multiple OSPF processes can run on a router, the process_id is used to keep the processes separate. The process id can be different on every router. On entering the command, you will arrive at the router configuration mode when the network command can be used to specify the networks that will be advertised. In respect to OSPF, the network command actually identifies the interfaces on which OSPF will be enabled and the network to which the interface belongs will be advertised. The syntax of the command is:
network network_number wildcard_mask area area_id
In the above command, network_number and wildcard_mask combine to identify the interface on which OSPF will be enabled. While network_number is a network address (example 192.168.1.0), a wildcard_mask is the inverse of subnet mask. In a subnet mask a 255 is an octet means the corresponding octet in the network number should match exactly while a 0 means it can be anything. In a wildcard mask a 255 means the corresponding octet in a network number can be anything and 0 means the corresponding octet should match exactly. Confusing? Table 5-3 shows a few examples. The last component of the above command is the area_id to which the interface will belong.
Table 5-3 Wildcard Mask examples
Network | Wildcard | Matches | Explanation |
192.168.1.1 | 0.0.0.0 | 192.168.1.1 | Since each octet of the wildcard mask is a zero, only an interface with an IP address specified by the network number will be matched. |
192.168.1.0 | 0.0.0.255 | 192.168.1.0-192.168.1.255 | Since the last octet is 255, the value of the last octet of the network number does not matter as long as the first three octets match the given network number. |
10.1.0.0 | 0.255.255.255 | 10.0.0.0-10.255.255.255 | A wildcard mask of 0.255.255.255 means that as long as the first octet matches, the rest can be anything. |
If you want to enable OSPF on each interface individually then you can use a wildcard mask of 0.0.0.0 with network numbers consisting of the IP address of each interface. This is the simplest and easiest way to configure OSPF but you can also use wildcard mask to cover a range of addresses. For example, In Figure 5-9, RouterF has two interfaces and OSPF can be enabled on them using two network commands like:
network 192.168.6.0 0.0.0.255 area 2
network 192.168.7.0 0.0.0.255 area 2
Another way to configure OSPF on RouterF is to use a single network commands as shown below:
network 192.168.0.0 0.0.255.255 area 2
While the first method is precise and safe, the second method can introduce problems since it covers a wide range of networks. Another method to use wildcard masks is to specify network blocks. Wilcard masks can represent blocks of network just like network masks. You may recall that network masks can represent only specific sizes of blocks – 2, 4, 8, 16, 32, 64, 128 and 255. To specify a block with wildcard mask simply deduct one from the block size. For example, in RouterF networks 192.168.6.0 and 192.168.7.0 can be covered using any of the following:
192.168.6.0 0.0.1.255 (a block size of 2 starting with 192.168.6.0)
192.168.4.0 0.0.3.255 (a block size of 4 starting with 192.168.4.0)
192.168.0.0 0.0.7.255 (a block size of 8 starting with 192.168.0.0)
Now that you understand the network command, let us configure the OSPF in the network shown in Figure 5-9. I will be using a mix of wildcard masks types discussed above to configure each router. Make sure you pay attention to the area each interface should belong to. With OSPF, area 0 should be configured first, so we will start with routers belonging to area 0.
Area 0
RouterB has one interface in area 0 while RouterC has 2 interfaces in area 0. The best way to configure them is to use a wildcard mask of 0.0.0.0 with the interfaces addresses.
RouterB(config)#router ospf 1
RouterB(config-router)#network 192.168.3.2 0.0.0.0 area 0
RouterC(config)#router ospf 1
RouterC(config-router)#network 192.168.3.3 0.0.0.0 area 0
RouterC(config-router)#network 192.168.4.3 0.0.0.0 area 0
Note that 192.168.3.0 and 192.168.4.0 cannot be configured as a single block since a block of 2 or 4 will not cover them and a block of 8 will cover 192.168.5.0, which is in area 2. So we had to use two statements with a mask of 0.0.0.0.
Area 1
Now that area 0 has been configured, other areas can be configured. RouterA has two interfaces in area 1 and RouterB has one interface in that area.
RouterA(config)#router ospf 1
RouterA(config-router)#network 0.0.0.0 255.255.255.255 area 1
RouterB(config)#router ospf 1
RouterB(config-router)#network 192.168.2.2 0.0.0.0 area 1
Notice that on RouterA a network number of 0.0.0.0 and a wildcard mask of 255.255.255.255 are used. This mask essentially means all networks and can be used on RouterA since both the interfaces belong to area 1.
Area 2
The final area spans across four routers. All interfaces of RouterD, RouterE and RouterF belong to area 2.
RouterC(config)#router ospf 1
RouterC(config-router)#network 192.168.5.3 0.0.0.0 area 2
RouterD(config)#router ospf 1
RouterD(config-router)#network 0.0.0.0 255.255.255.255 area 2
RouterE(config)#router ospf 1
RouterE(config-router)#network 192.168.5.5 0.0.0.0 area 2
RouterE(config-router)#network 192.168.6.5 0.0.0.0 area 2
RouterF(config)#router ospf 1
RouterF(config-router)#network 192.168.6.0 0.0.1.255 area 2
In the above configuration notice the three different ways wildcard has been used on RouterD, RouterE and RouterF.
Now that OSPF configuration is complete, let us take a look at the routing table on each router to verify the configuration.
RouterA#sh ip route
–output truncated–
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/138] via 192.168.2.2, 00:04:35, Serial0/0
O IA 192.168.5.0/24 [110/138] via 192.168.2.2, 00:04:35, Serial0/0
O IA 192.168.6.0/24 [110/148] via 192.168.2.2, 00:03:50, Serial0/0
O IA 192.168.7.0/24 [110/158] via 192.168.2.2, 00:03:50, Serial0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
O IA 192.168.3.0/24 [110/128] via 192.168.2.2, 00:04:35, Serial0/0
RouterB#sh ip route
–output truncated–
Gateway of last resort is not set
O 192.168.4.0/24 [110/74] via 192.168.3.3, 00:04:38, Serial0/1
O IA 192.168.5.0/24 [110/74] via 192.168.3.3, 00:04:38, Serial0/1
O IA 192.168.6.0/24 [110/84] via 192.168.3.3, 00:03:53, Serial0/1
O IA 192.168.7.0/24 [110/94] via 192.168.3.3, 00:03:53, Serial0/1
O 192.168.1.0/24 [110/74] via 192.168.2.1, 00:04:38, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.3.0/24 is directly connected, Serial0/1
RouterC#sh ip route
–output truncated–
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/1
O 192.168.6.0/24 [110/20] via 192.168.5.5, 00:03:55, FastEthernet0/1
[110/20] via 192.168.5.4, 00:03:55, FastEthernet0/1
O 192.168.7.0/24 [110/30] via 192.168.5.5, 00:03:55, FastEthernet0/1
[110/30] via 192.168.5.4, 00:03:55, FastEthernet0/1
O IA 192.168.1.0/24 [110/138] via 192.168.3.2, 00:04:40, Serial0/0
O IA 192.168.2.0/24 [110/128] via 192.168.3.2, 00:04:40, Serial0/0
C 192.168.3.0/24 is directly connected, Serial0/0
RouterD#sh ip route
–output truncated–
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/20] via 192.168.5.3, 00:03:57, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/1
O 192.168.7.0/24 [110/20] via 192.168.6.6, 00:03:57, FastEthernet0/1
O IA 192.168.1.0/24 [110/148] via 192.168.5.3, 00:03:57, FastEthernet0/0
O IA 192.168.2.0/24 [110/138] via 192.168.5.3, 00:03:57, FastEthernet0/0
O IA 192.168.3.0/24 [110/74] via 192.168.5.3, 00:03:57, FastEthernet0/0
RouterE#sh ip route
–output truncated–
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/20] via 192.168.5.3, 00:03:59, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/1
O 192.168.7.0/24 [110/20] via 192.168.6.6, 00:03:59, FastEthernet0/1
O IA 192.168.1.0/24 [110/148] via 192.168.5.3, 00:03:59, FastEthernet0/0
O IA 192.168.2.0/24 [110/138] via 192.168.5.3, 00:03:59, FastEthernet0/0
O IA 192.168.3.0/24 [110/74] via 192.168.5.3, 00:03:59, FastEthernet0/0
RouterF#sh ip route
–output truncated–
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/30] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/30] via 192.168.6.4, 00:03:51, FastEthernet0/0
O 192.168.5.0/24 [110/20] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/20] via 192.168.6.4, 00:03:51, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
O IA 192.168.1.0/24 [110/158] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/158] via 192.168.6.4, 00:03:51, FastEthernet0/0
O IA 192.168.2.0/24 [110/148] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/148] via 192.168.6.4, 00:03:51, FastEthernet0/0
O IA 192.168.3.0/24 [110/84] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/84] via 192.168.6.4, 00:03:51, FastEthernet0/0
The above outputs show that all networks are known across the internetwork. You should also notice the following:
◈ While an O precedes OSPF routes, inter-area routes are preceded with an IA also.
◈ In the outputs from RouterC and RouterF notice that OSPF is load balancing across equal cost paths.
Influencing path selection
As discussed in the earlier section, Cisco uses interface bandwidth as a metric for cost and the sum of cost of the entire path is used to select the best route to a destination. The cost of an interface can be manually changed using the ip ospf cost command in the interface configuration mode.
For example, in the network shown in Figure 5-9, traffic going from RouterF to 192.168.4.0/24 is being load balanced between the paths going through RouterD and RouterE. RouterF can be made to route traffic only through RouterD and use RouterE has a backup path by increasing the cost associated with interface fa0/0 on RouterE. This will cause the cost of the entire path to increase causing RouterF to not use that path along with the other path. The following commands will increase the cost on RouterE:
RouterE(config)#int fa0/0
RouterE(config-if)#ip ospf cost 20
The effect of this change will almost immediately be seen on the routing table of RouterF:
RouterF#sh ip route
–output truncated–
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/30] via 192.168.6.4, 00:04:15, FastEthernet0/0
O 192.168.5.0/24 [110/20] via 192.168.6.4, 00:03:04, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
O IA 192.168.1.0/24 [110/158] via 192.168.6.4, 00:04:15, FastEthernet0/0
O IA 192.168.2.0/24 [110/148] via 192.168.6.4, 00:04:15, FastEthernet0/0
O IA 192.168.3.0/24 [110/84] via 192.168.6.4, 00:04:15, FastEthernet0/0
In the output above, notice that RouterF is no longer load balancing the traffic across the two paths.
Influencing DR/BDR election
In the previous section you learned that OSPF routes do not form adjacencies with all neighbors in a multi-access network. A DR and a BDR are elected and all other routers form adjacencies with them. This election takes into consideration the OSPF priority and in case of a tie, the Router ID.
For example, in the network shown in Figure 5-9, RouterE will be the DR and RouterD will be the BDR in the Ethernet network 192.168.5.0/24 because RouterE has the highest router ID (192.168.6.5) and RouterD has the second highest router ID (192.168.6.4). RouterC has a router ID of 192.168.6.3. If you wanted RouterC to always be the DR, either the priority or the Router ID would have to be increased. The easiest way to do this is to increase the priority on interface fa0/1 of RouterC as shown below:
RouterC(config)#int fa0/1
RouterC(config-if)#ip ospf priority 10
The show ip ospf interface interface command can be used as shown below:
RouterC#sh ip ospf interface fa0/1
FastEthernet0/1 is up, line protocol is up
Internet Address 192.168.5.3/24, Area 2
Process ID 1, Router ID 192.168.5.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DROTHER, Priority 10
Designated Router (ID) 192.168.6.5, Interface address 192.168.5.5
Backup Designated router (ID) 192.168.6.4, Interface address 192.168.5.4
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:05
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.6.4 (Backup Designated Router)
Adjacent with neighbor 192.168.6.5 (Designated Router)
Suppress hello for 0 neighbor(s)
While the entire output is discussed in the next section, notice that the third line shows the state as DOTHER. DOTHER means that the router is not a DR or BDR. So why did the new priority not cause RouterC to become the DR or BDR?
That is because a DR/BDR election does not take place till the existing DR/BDR leaves the network. One way to force a reelection is to restart the OSPF process on the current DR and BDR. A reset will cause the OSPF process to restart and the network will think that the DR and BDR are lost and will force an election. You can rest the process using clear ip ospf process command. To force an election in the network, let’s reset the OSPF process on RouterD and RouterE as shown below:
RouterE#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
RouterD#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
Once the adjacencies are reestablished, the output of show ip ospf interface on RouterC looks like the following:
RouterC#show ip ospf interface fa0/1
FastEthernet0/1 is up, line protocol is up
Internet Address 192.168.5.3/24, Area 2
Process ID 1, Router ID 192.168.5.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 10
Designated Router (ID) 192.168.5.3, Interface address 192.168.5.3
Backup Designated router (ID) 192.168.6.5, Interface address 192.168.5.5
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:04
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 2
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.6.4
Adjacent with neighbor 192.168.6.5 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Notice that RouterC is now the DR. Another way to influence the election would have been to create a loop back interface on RouterC with a high IP address as shown below:
RouterC(config)#interface loopback 0
RouterC(config)#ip address 192.168.100.1 255.255.255.0
This would cause the router ID of RouterC to be higher than the rest.
0 comments:
Post a Comment