标签:
Single-Area OSPF Link Costs and Interface Priorities
Note: Another option for adding individual directly connected networks into OSPF process is to use the ip ospf process-id area area-id interface command.
R2#debug ip ospf adj
OSPF adjacency events debugging is on
*Jul 30 08:59:26.351: OSPF: Rcv DBD from 10.1.1.1 on FastEthernet0/0 seq 0x1984 opt 0x52 flag 0x7 len 32 mtu 1500 state INIT
*Jul 30 08:59:26.355: OSPF: 2 Way Communication to 10.1.1.1 on FastEthernet0/0, state 2WAY
*Jul 30 08:59:26.355: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul 30 08:59:26.355: OSPF: DR/BDR election on FastEthernet0/0
*Jul 30 08:59:2
R2#6.355: OSPF: Elect BDR 10.1.3.1
*Jul 30 08:59:26.359: OSPF: Elect DR 10.1.2.1
*Jul 30 08:59:26.359: DR: 10.1.2.1 (Id) BDR: 10.1.3.1 (Id)
*Jul 30 08:59:26.359: OSPF: Send DBD to 10.1.1.1 on FastEthernet0/0 seq 0x419 opt 0x52 flag 0x7 len 32
*Jul 30 08:59:26.359: OSPF: First DBD and we are not SLAVE
*Jul 30 08:59:26.367: OSPF: Rcv DBD from 10.1.1.1 on FastEthernet0/0 seq 0x419 opt 0x52 flag 0x2 len 92 mtu 1500 state EXSTART
*Jul 30 08:59:26.371: OSPF: NBR Negotiation Done. We are the MASTER
*Jul 30 08:59:26.371: OSPF: Send DBD to 10.1.1.1 on FastEthernet0/0 seq 0x41A opt 0x52 flag 0x3 len 112
*Jul 30 08:59:26.383: OSPF: Rcv DBD from 10.1.1.1 on FastEthernet0/0 seq 0x41A opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE
*Jul 30 08:59:26.387: OSPF: Send DBD to 10.1.1.1 on FastEthernet0/0 seq 0x41B opt 0x52 flag 0x1 len 32
*Jul 30 08:59:26.387: OSPF: Send LS REQ to 10.1.1.1 length 12 LSA count 1
*Jul 30 08:59:26.415: OSPF: Rcv LS REQ from 10.1.1.1 on FastEthernet0/0 le
R2#ngth 60 LSA count 3
*Jul 30 08:59:26.419: OSPF: Send UPD to 10.1.200.1 on FastEthernet0/0 length 132 LSA count 3
*Jul 30 08:59:26.419: OSPF: Rcv DBD from 10.1.1.1 on FastEthernet0/0 seq 0x41B opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE
*Jul 30 08:59:26.419: OSPF: Exchange Done with 10.1.1.1 on FastEthernet0/0
*Jul 30 08:59:26.423: OSPF: Rcv LS UPD from 10.1.1.1 on FastEthernet0/0 length 76 LSA count 1
*Jul 30 08:59:26.423: OSPF: Synchronized with 10.1.1.1 on FastEthernet0/0, state FULL
*Jul 30 08:59:26.423: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Jul 30 08:59:26.439: OSPF: Rcv LS UPD from 10.1.1.1 on FastEthernet0/0 length 88 LSA count 1
R2#
R1#show ip protocols
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.1.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.1.1.0 0.0.0.255 area 0
10.1.100.0 0.0.0.255 area 0
10.1.200.0 0.0.0.255 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
10.1.2.1 110 00:08:06
10.1.3.1 110 00:08:06
10.1.1.1 110 00:08:16
Distance: (default is 110)
R1#show ip ospf
Routing Process "ospf 1" with ID 10.1.1.1
Start time: 00:00:09.764, Time elapsed: 00:21:06.656
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Area BACKBONE(0)
Number of interfaces in this area is 3
Area has no authentication
SPF algorithm last executed 00:09:36.428 ago
SPF algorithm executed 8 times
Area ranges are
Number of LSA 4. Checksum Sum 0x01F7DC
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.2.1 5 FULL/DR 00:00:32 10.1.200.2 FastEthernet0/0
10.1.3.1 1 FULL/BDR 00:00:32 10.1.200.3 FastEthernet0/0
10.1.2.1 0 FULL/ - 00:00:36 10.1.100.2 Serial1/0
If you need more detail than the standard one-line summaries of neighbors, use the show ip ospf neighbor detail command. However, generally, the regular command gives you all that you need.
R1#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.1.200.1/24, Area 0
Process ID 1, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 50
Transmit Delay is 1 sec, State DROTHER, Priority 10
Designated Router (ID) 10.1.2.1, Interface address 10.1.200.2
Backup Designated router (ID) 10.1.3.1, Interface address 10.1.200.3
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:03
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 10.1.2.1 (Designated Router)
Adjacent with neighbor 10.1.3.1 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
R1#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Fa0/0 1 0 10.1.200.1/24 50 DROTH 2/2
Se1/0 1 0 10.1.100.1/24 1562 P2P 1/1
Lo1 1 0 10.1.1.1/24 1 P2P 0/0
R1#show ip ospf database
OSPF Router with ID (10.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.1.1.1 10.1.1.1 1224 0x80000008 0x006F5D 4
10.1.2.1 10.1.2.1 1227 0x80000005 0x00A328 4
10.1.3.1 10.1.3.1 1233 0x80000003 0x000E08 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.1.200.2 10.1.2.1 1225 0x80000002 0x00D74F
Now you can see the loopbacks of the other routers, but their subnet mask is incorrect, because the default network type on loopback interfaces advertises them as /32 (host) routes. As you can see in the output of the show ip ospf interface Lo1 command, the default OSPF network type for a loopback interface is LOOPBACK, causing the OSPF to advertise host routes instead of actual network masks.
R1(config-if)#interface loopback 1
R1(config-if)#ip ospf network type point-to-point
R1#show ip ospf int lo 1
Loopback1 is up, line protocol is up
Internet Address 10.1.1.1/24, Area 0
Process ID 1, Router ID 10.1.1.1, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
R2#show ip route ospf
10.0.0.0/24 is subnetted, 5 subnets
O 10.1.3.0 [110/51] via 10.1.200.3, 00:24:12, FastEthernet0/0
O 10.1.1.0 [110/51] via 10.1.200.1, 00:24:02, FastEthernet0/0
Note: The OSPF network type of LOOPBACK is a Cisco-proprietary extension that is not configurable but that is present on loopback interfaces by default. In some applications such as MPLS, the possible discrepancy between the real loopback interface mask and the advertised address/mask can lead to reachability or functionality issues, and care must be taken to either use /32 mask on loopbacks, or whenever a different mask is used, the OSPF network type must be changed to point-to-point.
Change the Ethernet cost to 50
R1(config)#interface f0/0
R1(config-if)#ip ospf cost 50
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.1.200.1/24, Area 0
Process ID 1, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 50
R1#show ip route ospf
10.0.0.0/24 is subnetted, 5 subnets
O 10.1.3.0 [110/51] via 10.1.200.3, 00:28:51, FastEthernet0/0
O 10.1.2.0 [110/51] via 10.1.200.2, 00:28:51, FastEthernet0/0
For reference, here are some default link costs (taken from Cisco.com):
• 64-kb/s serial link: 1562
• T1 (1.544-Mb/s serial link): 64
• E1 (2.048-Mb/s serial link): 48
• Ethernet: 10
• Fast Ethernet: 1
• FDDI: 1
• X25: 5208
• ATM: 1
OSPF uses a reference bandwidth of 100 Mb/s for cost calculation. The formula to calculate the cost is the reference bandwidth divided by the interface bandwidth.
For example, in the case of Ethernet, is the cost is 100 Mb/s / 10 Mb/s = 10.
The cost calculation can be adjusted to account for network links that are faster than 100 Mb/s by using the auto-cost reference-bandwidth command to change the reference bandwidth.
R1(config)# router ospf 1
R1(config-router)# auto-cost reference-bandwidth 1000
I want to make R1 become DR and R2 become the BDR
R1: priority 10
R2:priority 5
R3:priority 1
Router(config)#router ospf 1
Router(config-route)#ip ospf priority X
R1#clear ip ospf process
Reset ALL OSPF processes? [no]:
R1#
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
R1#
R1#
R1#
*Jul 30 09:35:32.559: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Jul 30 09:35:32.563: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.3.1 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Jul 30 09:35:32.563: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on Serial1/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Jul 30 09:35:32.667: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.3.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Jul 30 09:35:32.671: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on Serial1/0 from LOADING to FULL, Loading Done
R1#
*Jul 30 09:35:32.679: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
奇怪:
R3#show ip ospf neighbor detail
Neighbor 10.1.1.1, interface address 10.1.200.1
In the area 0 via interface FastEthernet0/0
Neighbor priority is 10, State is FULL, 30 state changes
DR is 10.1.200.2 BDR is 10.1.200.3
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:32
Neighbor is up for 00:03:07
Index 2/2, retransmission queue length 0, number of retransmission 9
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 2
Last retransmission scan time is 0 msec, maximum is 0 msec
Neighbor 10.1.2.1, interface address 10.1.200.2
In the area 0 via interface FastEthernet0/0
Neighbor priority is 5, State is FULL, 6 state changes
DR is 10.1.200.2 BDR is 10.1.200.3
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:33
Neighbor is up for 00:52:56
Index 1/1, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
结果现在不正确
R3#show ip ospf nei detail
Neighbor 10.1.1.1, interface address 10.1.200.1
In the area 0 via interface FastEthernet0/0
Neighbor priority is 10, State is FULL, 12 state changes
DR is 10.1.200.1 BDR is 10.1.200.2
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:38
Neighbor is up for 00:03:11
Index 1/1, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
Neighbor 10.1.2.1, interface address 10.1.200.2
In the area 0 via interface FastEthernet0/0
Neighbor priority is 5, State is FULL, 17 state changes
DR is 10.1.200.1 BDR is 10.1.200.2
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:38
Neighbor is up for 00:00:51
Index 2/2, retransmission queue length 0, number of retransmission 3
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 2, maximum is 2
Last retransmission scan time is 0 msec, maximum is 0 msec
终于慢慢调正确了
foreach address {
10.1.1.1
10.1.2.1
10.1.3.1
10.1.100.1
10.1.100.2
10.1.200.1
10.1.200.2
10.1.200.3
} {
ping $address }
OSPF, like many link-state routing protocols, is reasonably fast when it comes to convergence. To test this, have R3 send a large number of pings to the R1 loopback. By default, the pings take the path from R3 to R1 over Fast Ethernet because it has the lowest total path cost.
R3#traceroute 10.1.1.1
Type escape sequence to abort.
Tracing the route to 10.1.1.1
1 10.1.200.1 8 msec 20 msec 12 msec
R3#ping 10.1.1.1 repeat 10000
Type escape sequence to abort.
Sending 10000, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
....................
*Jul 30 09:54:30.291: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.1.1 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 98 percent (1303/1325), round-trip min/avg/max = 4/16/40 ms
R1(config)#int f0/0
R1(config-if)#sh
R3#traceroute 10.1.1.1
Type escape sequence to abort.
Tracing the route to 10.1.1.1
1 10.1.200.2 28 msec 12 msec 8 msec
2 10.1.100.1 16 msec 32 msec 20 msec
LAB – CCNP Single-Area OSPF Link Costs and Interface priorities
标签:
原文地址:http://www.cnblogs.com/elewei/p/4688330.html