网络拓扑图:
OSPF多区域配置
R1:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain lookup
Router(config)#hostname Rz1
Rz1(config)#int s1/0
Rz1(config-if)#ip address 192.168.12.1 255.255.255.0
Rz1(config-if)#no shut
Rz1(config-if)#exit
Rz1(config)#int lo0
Rz1(config-if)#ip address 10.17.10.128 255.255.255.0
Rz1(config-if)#no shut
Rz1(config-if)#exit
Rz1(config)#int fa0/0
Rz1(config-if)#ip address 10.172.196.254 255.255.255.0
Rz1(config-if)#no shut
Rz1(config-if)#exit
Rz1(config)#router ospf 11 =================配置OSPF协议
Rz1(config-router)#router-id 1.1.1.1
Rz1(config-router)#network 192.168.12.0 0.0.0.255 area 1
Rz1(config-router)#network 10.17.10.0 0.0.0.255 area 1
Rz1(config-router)#network 10.172.196.0 0.0.0.255 area 1
Rz1(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz1#write
Building configuration...
[OK]
Rz1#
R2:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain lookup
Router(config)#hostname Rz2
Rz2(config)#int s1/1
Rz2(config-if)#ip address 192.168.12.2 255.255.255.0
Rz2(config-if)#clock rate 56000
Rz2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial1/1, changed state to up
Rz2(config-if)#exit
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
Rz2(config)#int s1/1
Rz2(config-if)#exit
Rz2(config)#int s1/0
Rz2(config-if)#ip address 192.168.23.2 255.255.255.0
Rz2(config-if)#clock rate 56000
Rz2(config-if)#no shu
%LINK-5-CHANGED: Interface Serial1/0, changed state to down
Rz2(config-if)#exit
Rz2(config)#router ospf 22 =================配置OSPF协议
Rz2(config-router)#router-id 2.2.2.2
Rz2(config-router)#network 192.168.12.0 0.0.0.255 area 1
Rz2(config-router)#network 192.168.23.0 0.0.0.255 area 0
Rz2(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz2#write
Building configuration...
[OK]
Rz2#
R3:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain lookup
Router(config)#hostname Rz3
Rz3(config)#int s1/0
Rz3(config-if)#ip address 192.168.23.3 255.255.255.0
Rz3(config-if)#no shut
Rz3(config-if)#exit
Rz3(config)#int s1/1
Rz3(config-if)#ip address 192.168.34.3 255.255.255.0
Rz3(config-if)#clock rate 56000
Rz3(config-if)#no shut
Rz3(config-if)#exit
Rz3(config)#int fa0/0
Rz3(config-if)#ip address 10.157.196.254 255.255.255.0
Rz3(config-if)#no shut
Rz3(config-if)#exit
Rz3(config)#router ospf 33 =====================配置OSPF协议
Rz3(config-router)#router-id 3.3.3.3
Rz3(config-router)#network 10.157.196.0 0.0.0.255 area 0
Rz3(config-router)#network 192.168.23.0 0.0.0.255 area 0
Rz3(config-router)#network 192.168.34.0 0.0.0.255 area 1
Rz3(config-router)#end
Rz3#write
Building configuration...
[OK]
Rz3#
R4:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain lookup
Router(config)#hostname Rz4
Rz4(config)#int s1/0
Rz4(config-if)#ip address 192.168.34.4 255.255.255.0
Rz4(config-if)#no shut
%LINK-5-CHANGED: Interface Serial1/0, changed state to up
Rz4(config-if)#exit
Rz4(config)#int lo0
Rz4(config-if)#ip address 172.20.196.4 255.255.255.0
Rz4(config-if)#no shut
Rz4(config-if)#exit
Rz4(config)#int fa0/0
Rz4(config-if)#ip address 112.10.17.254 255.255.255.0
Rz4(config-if)#no shut
Rz4(config-if)#exit
Rz4(config)#int fa0/1
Rz4(config-if)#ip address 10.110.122.254 255.255.255.0
Rz4(config-if)#no shut
Rz4(config-if)#exit
Rz4(config)#router ospf 44 =========配置OSPF协议
Rz4(config-router)#router-id 4.4.4.4
Rz4(config-router)#network 192.168.34.0 0.0.0.255 area 2
Rz4(config-router)#network 172.20.196.0 0.0.0.255 area 2
Rz4(config-router)#network 10.110.122.0 0.0.0.255 area 2
Rz4(config-router)#network 112.10.17.0 0.0.0.255 area 2
Rz4(config-router)#end
Rz4#write
Building configuration...
[OK]
Rz4#
配置完成。
测试:
查看路由表:
1、查看R1路由器的路由表:
Rz1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 4 subnets
C 10.17.10.0 is directly connected, Loopback0
O IA 10.110.122.0 [110/2344] via 192.168.12.2, 00:39:19, Serial1/0
O IA 10.157.196.0 [110/1563] via 192.168.12.2, 00:40:50, Serial1/0
C 10.172.196.0 is directly connected, FastEthernet0/0
112.0.0.0/24 is subnetted, 1 subnets
O IA 112.10.17.0 [110/2344] via 192.168.12.2, 00:39:04, Serial1/0
172.20.0.0/32 is subnetted, 1 subnets
O IA 172.20.196.4 [110/2344] via 192.168.12.2, 00:53:51, Serial1/0
C 192.168.12.0/24 is directly connected, Serial1/0
O IA 192.168.23.0/24 [110/1562] via 192.168.12.2, 01:00:15, Serial1/0
O IA 192.168.34.0/24 [110/2343] via 192.168.12.2, 00:56:38, Serial1/0
Rz1#
2、查看R2路由器的路由表:
R2:
Rz2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O 10.17.10.128/32 [110/782] via 192.168.12.1, 01:02:01, Serial1/1
O IA 10.110.122.0/24 [110/1563] via 192.168.23.3, 00:40:03, Serial1/0
O 10.157.196.0/24 [110/782] via 192.168.23.3, 00:41:33, Serial1/0
O 10.172.196.0/24 [110/782] via 192.168.12.1, 00:43:01, Serial1/1
112.0.0.0/24 is subnetted, 1 subnets
O IA 112.10.17.0 [110/1563] via 192.168.23.3, 00:39:47, Serial1/0
172.20.0.0/32 is subnetted, 1 subnets
O IA 172.20.196.4 [110/1563] via 192.168.23.3, 00:54:34, Serial1/0
C 192.168.12.0/24 is directly connected, Serial1/1
C 192.168.23.0/24 is directly connected, Serial1/0
O IA 192.168.34.0/24 [110/1562] via 192.168.23.3, 00:57:21, Serial1/0
Rz2#
3、查看R3路由器的路由表:
R3:
Rz3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O IA 10.17.10.128/32 [110/1563] via 192.168.23.2, 01:00:17, Serial1/0
O 10.110.122.0/24 [110/782] via 192.168.34.4, 00:40:59, Serial1/1
C 10.157.196.0/24 is directly connected, FastEthernet0/0
O IA 10.172.196.0/24 [110/1563] via 192.168.23.2, 00:43:48, Serial1/0
112.0.0.0/24 is subnetted, 1 subnets
O 112.10.17.0 [110/782] via 192.168.34.4, 00:40:44, Serial1/1
172.20.0.0/32 is subnetted, 1 subnets
O 172.20.196.4 [110/782] via 192.168.34.4, 00:55:31, Serial1/1
O IA 192.168.12.0/24 [110/1562] via 192.168.23.2, 01:00:17, Serial1/0
C 192.168.23.0/24 is directly connected, Serial1/0
C 192.168.34.0/24 is directly connected, Serial1/1
Rz3#
4、查看R4路由器的路由表:
R4:
Rz4#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O IA 10.17.10.128/32 [110/2344] via 192.168.34.3, 00:56:18, Serial1/0
C 10.110.122.0/24 is directly connected, FastEthernet0/1
O IA 10.157.196.0/24 [110/782] via 192.168.34.3, 00:42:49, Serial1/0
O IA 10.172.196.0/24 [110/2344] via 192.168.34.3, 00:44:12, Serial1/0
112.0.0.0/24 is subnetted, 1 subnets
C 112.10.17.0 is directly connected, FastEthernet0/0
172.20.0.0/24 is subnetted, 1 subnets
C 172.20.196.0 is directly connected, Loopback0
O IA 192.168.12.0/24 [110/2343] via 192.168.34.3, 00:56:18, Serial1/0
O IA 192.168.23.0/24 [110/1562] via 192.168.34.3, 00:56:18, Serial1/0
C 192.168.34.0/24 is directly connected, Serial1/0
Rz4#
用ping命令测试:
PC>ping DNS.Server.com
Pinging 10.157.196.10 with 32 bytes of data:
Reply from 10.157.196.10: bytes=32 time=125ms TTL=125
Reply from 10.157.196.10: bytes=32 time=110ms TTL=125
Reply from 10.157.196.10: bytes=32 time=78ms TTL=125
Reply from 10.157.196.10: bytes=32 time=125ms TTL=125
Ping statistics for 10.157.196.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 78ms, Maximum = 125ms, Average = 109ms
PC>
PC>ping Web.cysd.com
Pinging 112.10.17.3 with 32 bytes of data:
Reply from 112.10.17.3: bytes=32 time=110ms TTL=124
Reply from 112.10.17.3: bytes=32 time=143ms TTL=124
Reply from 112.10.17.3: bytes=32 time=141ms TTL=124
Reply from 112.10.17.3: bytes=32 time=172ms TTL=124
Ping statistics for 112.10.17.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 110ms, Maximum = 172ms, Average = 141ms
PC>
PC>ping Market.cysd.com
Pinging 10.110.122.3 with 32 bytes of data:
Reply from 10.110.122.3: bytes=32 time=156ms TTL=124
Reply from 10.110.122.3: bytes=32 time=140ms TTL=124
Reply from 10.110.122.3: bytes=32 time=128ms TTL=124
Reply from 10.110.122.3: bytes=32 time=141ms TTL=124
Ping statistics for 10.110.122.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 128ms, Maximum = 156ms, Average = 141ms
PC>
对路由器进行安全设置:
1、 对路由器进行con和vty配置:
R1:
Rz1>en
Rz1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Rz1(config)#line console 0
Rz1(config-line)#password cisco
Rz1(config-line)#login
Rz1(config-line)#exit
Rz1(config)#line vty 0 4
Rz1(config-line)#password cisco
Rz1(config-line)#login
Rz1(config-line)#exit
Rz1(config)#enable password cisco
Rz1(config)#service password-encryption
Rz1(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz1#write
Building configuration...
[OK]
Rz1#
R2:
Rz2>enable
Rz2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Rz2(config)#line console 0
Rz2(config-line)#password cisco
Rz2(config-line)#login
Rz2(config-line)#exit
Rz2(config)#line vty 0 4
Rz2(config-line)#password cisco
Rz2(config-line)#login
Rz2(config-line)#exit
Rz2(config)#enable password cisco
Rz2(config)#service password-encryption
Rz2(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz2#write
Building configuration...
[OK]
Rz2#
R3:
Rz3>enable
Rz3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Rz3(config)#line console 0
Rz3(config-line)#password cisco
Rz3(config-line)#login
Rz3(config-line)#exit
Rz3(config)#line vty 0 4
Rz3(config-line)#password cisco
Rz3(config-line)#login
Rz3(config-line)#exit
Rz3(config)#enable password cisco
Rz3(config)#service password-encryption
Rz3(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz3#write
Building configuration...
[OK]
Rz3#
R4:
Rz4>enable
Rz4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Rz4(config)#line console 0
Rz4(config-line)#password cisco
Rz4(config-line)#login
Rz4(config-line)#exit
Rz4(config)#line vty 0 4
Rz4(config-line)#password cisco
Rz4(config-line)#login
Rz4(config-line)#exit
Rz4(config)#enable password cisco
Rz4(config)#service password-encryption
Rz4(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Rz4#write
Building configuration...
[OK]
Rz4#
实验完成。
转载于:https://blog.51cto.com/19880423/1015081