OSPF多区域实验:
-----------------------------------------------------
r1
-----------------------------------------------------
en
conf t
ho R1
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 1.1.1.1 255.255.255.0
int f0/0
ip add 192.168.10.1 255.255.255.0
no shu
exit
router ospf 1
network 192.168.10.0 0.0.0.255 area 1
area 1 stub
end
------------------------------------------------------
r2
------------------------------------------------------
en
conf t
ho R2
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 2.2.2.2 255.255.255.0
int f0/0
ip add 192.168.10.2 255.255.255.0
no shu
int s2/0
ip add 192.168.20.2 255.255.255.0
no shu
int f1/0
ip add 192.168.1.2 255.255.255.0
no shu
exit
router ospf 1
network 192.168.10.0 0.0.0.255 area 1
network 192.168.20.0 0.0.0.255 area 2
network 192.168.1.0 0.0.0.255 area 0
area 1 stub
area 2 nssa
end
------------------------------------------------------
r3
------------------------------------------------------
en
conf t
ho R3
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 3.3.3.3 255.255.255.0
int s0/0
ip add 192.168.20.3 255.255.255.0
no shu
int s0/1
ip add 192.168.30.3 255.255.255.0
no shu
exit
router ospf 1
network 192.168.20.0 0.0.0.255 area 2
area 2 nssa
redistribute rip subnets
exit
router rip
version 2
no auto
network 192.168.30.0
redistribute ospf 1 metric 5
end
-----------------------------------------------------
r4
-----------------------------------------------------
en
conf t
ho R4
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 4.4.4.4 255.255.255.0
int l1
ip add 192.168.80.4 255.255.255.0
int s0/1
ip add 192.168.30.4 255.255.255.0
no shu
exit
router rip
version 2
no auto
network 192.168.30.0
network 192.168.80.0
end
------------------------------------------------------
r5配置根据R7/R8运行OSPF/RIP决定,详细见下面:
------------------------------------------------------
r6
------------------------------------------------------
en
conf t
ho R6
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 6.6.6.6 255.255.255.0
int f0/0
ip add 192.168.40.6 255.255.255.0
no shu
exit
router ospf 1
network 192.168.40.0 0.0.0.255 area 3
area 3 stub no-summary
end
------------------------------------------------------
R7/8运行RIP协议,验证NSSA区域对其它区域传来的外部路由的
学习(R3/R4上能否有到60/70的网段)
------------------------------------------------------
r5
------------------------------------------------------
en
conf t
ho R5
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 5.5.5.5 255.255.255.0
int f1/0
ip add 192.168.1.5 255.255.255.0
no shu
int f0/0
ip add 192.168.40.5 255.255.255.0
no shu
int s2/0
ip add 192.168.50.5 255.255.255.0
no shu
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 3
network 192.168.50.0 0.0.0.255 area 4
area 3 stub no-summary
end
------------------------------------------------------
r7
------------------------------------------------------
en
conf t
ho R7
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 7.7.7.7 255.255.255.0
int s0/0
ip add 192.168.50.7 255.255.255.0
no shu
int s0/1
ip add 192.168.60.7 255.255.255.0
no shu
exit
router ospf 1
network 192.168.50.0 0.0.0.255 area 4
redistribute rip subnets
exit
router rip
version 2
no auto
network 192.168.60.0
redistribute ospf 1 metric 3
end
------------------------------------------------------
r8
------------------------------------------------------
en
conf t
ho R8
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 8.8.8.8 255.255.255.0
int l1
ip add 192.168.70.8 255.255.255.0
int s0/1
ip add 192.168.60.8 255.255.255.0
no shu
exit
router rip
version 2
no auto
network 192.168.60.0
network 192.168.70.0
end
------------------------------------------------------
R7/8运行OSPF区域,用于做虚链路实验(所有路由全通)
------------------------------------------------------
r5
------------------------------------------------------
en
conf t
ho R5
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 5.5.5.5 255.255.255.0
int f1/0
ip add 192.168.1.5 255.255.255.0
no shu
int f0/0
ip add 192.168.40.5 255.255.255.0
no shu
int s2/0
ip add 192.168.50.5 255.255.255.0
no shu
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 3
network 192.168.50.0 0.0.0.255 area 4
area 3 stub no-summary
area 4 virtual-link 7.7.7.7
end
------------------------------------------------------
r7
------------------------------------------------------
en
conf t
ho R7
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 7.7.7.7 255.255.255.0
int s0/0
ip add 192.168.50.7 255.255.255.0
no shu
int s0/1
ip add 192.168.60.7 255.255.255.0
no shu
exit
router ospf 1
network 192.168.50.0 0.0.0.255 area 4
network 192.168.60.0 0.0.0.255 area 5
area 4 virtual-link 5.5.5.5
end
------------------------------------------------------
r8
------------------------------------------------------
en
conf t
ho R8
no ip do lo
lin c 0
no exec-t
logg s
exit
int l0
ip add 8.8.8.8 255.255.255.0
int l1
ip add 192.168.70.8 255.255.255.0
int s0/1
ip add 192.168.60.8 255.255.255.0
no shu
exit
router ospf 1
network 192.168.60.0 0.0.0.255 area 5
network 192.168.70.0 0.0.0.255 area 5
end