R2#show ip route
Codes: 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 type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.12.0 [120/1] via 172.16.11.2, 00:00:01, Serial1/0
C 172.16.10.0 is directly connected, Loopback0
C 172.16.11.0 is directly connected, Serial1/0
R 172.16.1.0 [120/5] via 172.16.11.2, 00:00:01, Serial1/0
之后:
R2#show ip route
Codes: 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 type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 6 subnets
R 172.16.12.0 [120/1] via 172.16.11.2, 00:00:16, Serial1/0
C 172.16.10.0 is directly connected, Loopback0
C 172.16.11.0 is directly connected, Serial1/0
R 172.16.1.0 [120/5] via 172.16.11.2, 00:00:16, Serial1/0
R 172.16.2.0 [120/1] via 172.16.11.2, 00:00:16, Serial1/0
R 172.16.3.0 [120/1] via 172.16.11.2, 00:00:16, Serial1/0
==============================================================================
R4#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, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks
C 172.16.12.0/24 is directly connected, Serial1/0
R 172.16.10.0/24 [120/1] via 172.16.11.1, 00:00:01, Serial1/1
C 172.16.11.0/24 is directly connected, Serial1/1
O 172.16.1.0/24 [110/65] via 172.16.12.1, 00:00:31, Serial1/0
O 172.16.2.0/27 [110/65] via 172.16.12.1, 00:00:31, Serial1/0
O 172.16.3.0/30 [110/65] via 172.16.12.1, 00:00:31, Serial1/0
之后:
R4#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, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 8 subnets, 3 masks
C 172.16.12.0/24 is directly connected, Serial1/0
R 172.16.10.0/24 [120/1] via 172.16.11.1, 00:00:02, Serial1/1
C 172.16.11.0/24 is directly connected, Serial1/1
O 172.16.1.0/24 [110/65] via 172.16.12.1, 00:01:28, Serial1/0
S 172.16.2.0/24 is directly connected, Null0
O 172.16.2.0/27 [110/65] via 172.16.12.1, 00:01:28, Serial1/0
S 172.16.3.0/24 is directly connected, Null0
O 172.16.3.0/30 [110/65] via 172.16.12.1, 00:01:28, Serial1/0
两步:1、汇总
2、写静态路由(指向null0)
R4#show run
Building configuration...
Current configuration : 1034 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R4
!
!
ip subnet-zero
!
!
no ip domain-lookup
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
ip address 172.16.12.2 255.255.255.0
serial restart-delay 0
clock rate 64000
!
interface Serial1/1
ip address 172.16.11.2 255.255.255.0
serial restart-delay 0
clock rate 64000
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
area 0 range 172.16.2.0 255.255.255.0
area 0 range 172.16.3.0 255.255.255.0
redistribute rip subnets
network 172.16.12.0 0.0.0.255 area 0
!
router rip
redistribute ospf 1 metric 5
network 172.16.0.0
!
ip classless
ip route 172.16.2.0 255.255.255.0 Null0
ip route 172.16.3.0 255.255.255.0 Null0
ip http server
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
end