1、网络拓扑
![]()
2、R1\R2\R3 OSPF配置
R1:
enable
config t
no ip domain lookup
line console 0
no exec-timeout
logging synchronous
exit
interface f0/0
no shutdown
ip add 1.1.123.1 255.255.255.224
exit
interface loopback 0
ip add 10.10.1.1 255.255.255.0
no shutdown
exit
end
R2:
enable
config t
no ip domain lookup
line console 0
no exec-timeout
logging synchronous
exit
interface f0/0
no shutdown
ip add 1.1.123.2 255.255.255.224
exit
interface s1/0
no shutdown
ip add 1.1.24.1 255.255.255.248
exit
interface loopback 0
ip add 10.10.2.2 255.255.255.0
no shutdown
exit
end
R3:
enable
config t
no ip domain lookup
line console 0
no exec-timeout
logging synchronous
exit
interface f0/0
no shutdown
ip add 1.1.123.3 255.255.255.224
exit
interface s1/1
no shutdown
ip add 1.1.34.1 255.255.255.248
exit
interface loopback 0
ip add 10.10.3.3 255.255.255.0
no shutdown
exit
end
R4 :
enable
config t
no ip domain lookup
line console 0
no exec-timeout
logging synchronous
exit
interface s1/0
no shutdown
ip add 1.1.24.2 255.255.255.248
exit
interface s1/1
no shutdown
ip add 1.1.34.2 255.255.255.248
exit
interface s1/2
no shutdown
ip add 1.1.45.2 255.255.255.0
exit
interface loopback 0
no shut
ip address 10.10.4.4 255.255.255.0
end
R5 :
enable
config t
no ip domain lookup
line console 0
no exec-timeout
logging synchronous
exit
interface s1/2
no shutdown
ip add 1.1.45.1 255.255.255.0
exit
interface loopback 0
no shut
ip add 10.10.5.5 255.255.255.0
end
R1-OSPF-Router config
config t
router ospf 1
router-id 1.1.1.1
network 1.1.123.1 0.0.0.0 area 2
network 10.10.1.1 0.0.0.0 area 2
end
R2-OSPF-Router config
config t
router ospf 1
router-id 2.2.2.2
network 1.1.123.2 0.0.0.0 area 2
network 10.10.2.2 0.0.0.0 area 2
end
config t
router ospf 2
router-id 2.2.2.3
network 1.1.24.1 0.0.0.0 area 2
end
q
R3-OSPF-Router config
config t
router ospf 1
router-id 3.3.3.3
network 1.1.123.3 0.0.0.0 area 2
network 10.10.3.3 0.0.0.0 area 2
end
config t
router ospf 2
router-id 3.3.3.3
network 1.1.34.1 0.0.0.0 area 2
end
R4-OSPF-Router config
config t
router ospf 2
router-id 4.4.4.4
network 1.1.24.2 0.0.0.0 area 2
network 1.1.34.2 0.0.0.0 area 2
network 1.1.45.2 0.0.0.0 area 2
network 10.10.4.4 0.0.0.0 area 2
end
R5-OSPF-Router config
config t
router ospf 2
router-id 5.5.5.5
network 1.1.45.1 0.0.0.0 area 2
network 10.10.5.5 0.0.0.0 area 2
end
3、 OSPF配置
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:33 1.1.123.1 FastEthernet0/0
2.2.2.2 1 FULL/DR 00:00:32 1.1.123.2 FastEthernet0/0
- DR: Designate router,指定路由器
- BDR:Backup Disignate router,备用指定路由器
- DROthers:其余非DR/BDR路由器
- DR/BDR选举规则:先比较接口优先级,越大越优先。优先级相同,比较RID,越大越优先
R3#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 1.1.123.3/27, Area 2
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DROTHER, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 1.1.123.2
Backup Designated router (ID) 1.1.1.1, Interface address 1.1.123.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Index 1/1, 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 1.1.1.1 (Backup Designated Router)
Adjacent with neighbor 2.2.2.2 (Designated Router)
Suppress hello for 0 neighbor(s)
R3#