Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.20.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.30.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.50.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/1
Router(config-if)#ip address 192.168.60.1 255.255.255.0
Router(config-if)#no shut
路由器1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.20.1 255.255.255.0
Router(config-if)#no shut
路由器2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.40.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.30.2 255.255.255.0
Router(config-if)#no shut
路由器3
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.50.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.70.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.80.1 255.255.255.0
Router(config-if)#no shut
路由器4
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.60.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.120.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.130.1 255.255.255.0
Router(config-if)#no shut
路由器5
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.80.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.90.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.100.1 255.255.255.0
Router(config-if)#no shut
路由器6
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.130.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.140.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.150.1 255.255.255.0
Router(config-if)#no shut
路由器7
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.100.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.110.1 255.255.255.0
Router(config-if)#no shut
路由器8
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.150.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.160.1 255.255.255.0
Router(config-if)#no shut
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
Router(config-router)#network 192.168.10.0 0.0.0.255 area 0
路由器2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.30.0 0.0.0.255 area 0
Router(config-router)#network 192.168.40.0 0.0.0.255 area 0
路由器0
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
Router(config-router)#network 192.168.30.0 0.0.0.255 area 0
Router(config-router)#network 192.168.50.0 0.0.0.255 area 0
Router(config-router)#network 192.168.60.0 0.0.0.255 area 0
配置area1区域 路由器3
Router(config-router)#network 192.168.50.0 0.0.0.255 area 0
Router(config-router)#network 192.168.70.0 0.0.0.255 area 1
Router(config-router)#network 192.168.80.0 0.0.0.255 area 1
路由器5
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.80.0 0.0.0.255 area 1
Router(config-router)#network 192.168.90.0 0.0.0.255 area 1
Router(config-router)#network 192.168.100.0 0.0.0.255 area 1
路由器7
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.100.0 0.0.0.255 area 1
Router(config-router)#network 192.168.110.0 0.0.0.255 area 1
配置area2区域 路由器4
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.60.0 0.0.0.255 area 0
Router(config-router)#network 192.168.130.0 0.0.0.255 area 2
Router(config-router)#network 192.168.120.0 0.0.0.255 area 2
路由器6
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.130.0 0.0.0.255 area 2
Router(config-router)#network 192.168.140.0 0.0.0.255 area 2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route rip
Router(config-router)#version 2
Router(config-router)#network 192.168.150.0
Router(config-router)#network 192.168.160.0
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#redistribute rip metric 1000 metric-type 1 subnets
Router(config-router)#exit
Router(config)#route rip
Router(config-router)#redistribute ospf 1 metric 5
此时每个路由器都存在各个路由器的路由表 查看其中一个路由器的路由表看一下 例如路由器8
Router#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type1, N2 - OSPF NSSA external type2
E1 - OSPF external type1, E2 - OSPF external type2, 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 isnotset
R 192.168.10.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.20.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.30.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.40.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.50.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.60.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.70.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.80.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.90.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.100.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.110.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.120.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.130.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0
R 192.168.140.0/24[120/5] via 192.168.150.1,00:00:04, Serial0/3/0192.168.150.0/24is variably subnetted,2 subnets,2 masks
C 192.168.150.0/24is directly connected, Serial0/3/0
L 192.168.150.2/32is directly connected, Serial0/3/0192.168.160.0/24is variably subnetted,2 subnets,2 masks
C 192.168.160.0/24is directly connected, GigabitEthernet0/0
L 192.168.160.1/32is directly connected, GigabitEthernet0/0
7.验证主机连通
使用主机PC0ping主机PC1,2,3,4,5,6,7
C:\>ping 192.168.40.11
Pinging 192.168.40.11with32bytes of data:
Request timed out.
Reply from192.168.40.11:bytes=32 time<1ms TTL=125
Reply from192.168.40.11:bytes=32 time<1ms TTL=125
Reply from192.168.40.11:bytes=32 time<1ms TTL=125
Ping statistics for192.168.40.11:
Packets: Sent =4, Received =3, Lost =1(25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\>ping 192.168.70.11
Pinging 192.168.70.11with32bytes of data:
Request timed out.
Reply from192.168.70.11:bytes=32 time=5ms TTL=125
Reply from192.168.70.11:bytes=32 time=1ms TTL=125
Reply from192.168.70.11:bytes=32 time=1ms TTL=125
Ping statistics for192.168.70.11:
Packets: Sent =4, Received =3, Lost =1(25% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 5ms, Average = 2ms
C:\>ping 192.168.120.11
Pinging 192.168.120.11with32bytes of data:
Reply from192.168.120.11:bytes=32 time=11ms TTL=125
Reply from192.168.120.11:bytes=32 time=2ms TTL=125
Reply from192.168.120.11:bytes=32 time=1ms TTL=125
Reply from192.168.120.11:bytes=32 time=1ms TTL=125
Ping statistics for192.168.120.11:
Packets: Sent =4, Received =4, Lost =0(0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 11ms, Average = 3ms
C:\>ping 192.168.90.11
Pinging 192.168.90.11with32bytes of data:
Reply from192.168.90.11:bytes=32 time=1ms TTL=124
Reply from192.168.90.11:bytes=32 time=1ms TTL=124
Reply from192.168.90.11:bytes=32 time=1ms TTL=124
Reply from192.168.90.11:bytes=32 time=1ms TTL=124
Ping statistics for192.168.90.11:
Packets: Sent =4, Received =4, Lost =0(0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
C:\>ping 192.168.140.11
Pinging 192.168.140.11with32bytes of data:
Request timed out.
Reply from192.168.140.11:bytes=32 time=1ms TTL=124
Reply from192.168.140.11:bytes=32 time=1ms TTL=124
Reply from192.168.140.11:bytes=32 time=1ms TTL=124
Ping statistics for192.168.140.11:
Packets: Sent =4, Received =3, Lost =1(25% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
C:\>ping 192.168.110.11
Pinging 192.168.110.11with32bytes of data:
Reply from192.168.110.11:bytes=32 time=2ms TTL=123
Reply from192.168.110.11:bytes=32 time=7ms TTL=123
Reply from192.168.110.11:bytes=32 time=3ms TTL=123
Reply from192.168.110.11:bytes=32 time=2ms TTL=123
Ping statistics for192.168.110.11:
Packets: Sent =4, Received =4, Lost =0(0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 7ms, Average = 3ms
C:\>ping 192.168.160.11
Pinging 192.168.160.11with32bytes of data:
Request timed out.
Reply from192.168.160.11:bytes=32 time=2ms TTL=123
Reply from192.168.160.11:bytes=32 time=5ms TTL=123
Reply from192.168.160.11:bytes=32 time=2ms TTL=123
Ping statistics for192.168.160.11:
Packets: Sent =4, Received =3, Lost =1(25% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 5ms, Average = 3ms
C:\>