routerA:
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/1
ip address 192.1.1.1 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
serial restart-delay 0
!
router ospf 10
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 192.1.1.0 0.0.0.255 area 0
routerB:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial0/2
ip address 192.1.1.2 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
ip ospf priority 0
serial restart-delay 0
frame-relay map ip 192.1.1.1 201 broadcast
frame-relay map ip 192.1.1.3 201 broadcast
!
router ospf 10
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
network 192.1.1.0 0.0.0.255 area 0
routerC:
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Serial0/3
ip address 192.1.1.3 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
ip ospf priority 0
serial restart-delay 0
frame-relay map ip 192.1.1.1 301 broadcast
frame-relay map ip 192.1.1.2 301 broadcast
!
router ospf 10
log-adjacency-changes
network 3.3.3.0 0.0.0.255 area 0
network 192.1.1.0 0.0.0.255 area 0
看一下邻居关系
routerA#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/DROTHER 00:00:38 192.1.1.2 Serial0/1
3.3.3.3 0 FULL/DROTHER 00:00:32 192.1.1.3 Serial0/1
routerB#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:32 192.1.1.1 Serial0/2
routerC#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:38 192.1.1.1 Serial0/3
路由表;
routerA#sh ip route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 192.1.1.2, 00:03:14, Serial0/1
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 192.1.1.3, 00:03:14, Serial0/1
C 192.1.1.0/24 is directly connected, Serial0/1
routerB#sh ip route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.1.1.1, 00:03:22, Serial0/2
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 192.1.1.3, 00:03:22, Serial0/2
C 192.1.1.0/24 is directly connected, Serial0/2
routerC#sh ip route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.1.1.1, 00:03:25, Serial0/3
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 192.1.1.2, 00:03:25, Serial0/3
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.1.1.0/24 is directly connected, Serial0/3
如果把routerB的优先级改成10,重启后routerB会成为DR,routerA为BDR,routerC为DROTHER
routerB(config)#interface s0/2
routerB(config-if)#ip os pri 10
routerC#sh ip route
Gateway of last resort is not set
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.1.1.0/24 is directly connected, Serial0/3
因为Adv Router 不可达,因此routerC不能学到路由
routerC#sh ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 10)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 137 0x8000000B 0x00B78C 2
2.2.2.2 2.2.2.2 140 0x80000007 0x00D367 2
3.3.3.3 3.3.3.3 139 0x80000009 0x00D953 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.1.1.2 2.2.2.2 142 0x80000001 0x00E47C
routerC#sh ip ospf database router
OSPF Router with ID (3.3.3.3) (Process ID 10)
Router Link States (Area 0)
Adv Router is not-reachable
LS age: 160
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 8000000B
Checksum: 0xB78C
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.1.1.2
(Link Data) Router Interface address: 192.1.1.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 1.1.1.1
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Adv Router is not-reachable
LS age: 166
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 2.2.2.2
Advertising Router: 2.2.2.2
LS Seq Number: 80000007
Checksum: 0xD367
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.1.1.2
(Link Data) Router Interface address: 192.1.1.2
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 2.2.2.2
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 169
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 80000009
Checksum: 0xD953
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.1.1.1
(Link Data) Router Interface address: 192.1.1.3
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 3.3.3.3
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1