R6(config-router)#redistribute static
% Only classful networks will be redistributed
!!不加上subnets只重发布classful路由
记录如下:
拓扑:
R4 s1/1-->s1/0 R5 s1/1 -->s1/0 R6
R6(config-router)#do sh run
Building configuration...
Current configuration : 1335 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R6
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.224.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 100
log-adjacency-changes
redistribute
static
(默认情况下,OPPF使用E2类型的LSA,不计算AS内部路径所带来的COST值)
network 192.168.224.0 0.0.0.255 area 51
!
ip classless (将静态路由指向空接口)
ip route 192.168.240.0
255.255.255.0 Null0
ip route 192.168.244.0
255.255.255.0 Null0
ip route 192.168.248.0
255.255.255.0 Null0
ip route 192.168.252.0
255.255.255.0 Null0
no ip http server
邻居路由器所学到的路径信息如下:
R5#sh 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
C
192.168.224.0/24 is directly connected, Serial1/1
O E2
192.168.240.0/24 [110/20] via 192.168.224.2, 00:05:55,
Serial1/1
O E2
192.168.244.0/24 [110/20] via 192.168.224.2, 00:05:55,
Serial1/1
O E2
192.168.248.0/24 [110/20] via 192.168.224.2, 00:05:55,
Serial1/1
C
192.168.1.0/24 is directly connected, Serial1/0
O E2
192.168.252.0/24 [110/20] via 192.168.224.2, 00:05:55,
Serial1/1
C
192.168.3.0/24 is directly connected, Loopback0
O IA 192.168.64.0/18 [110/65] via 192.168.1.1, 00:05:55,
Serial1/0
R4#sh 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
O IA 192.168.224.0/24 [110/128] via 192.168.1.3, 00:11:52,
Serial1/1
O E2 192.168.240.0/24 [110/20] via 192.168.1.3, 00:06:06,
Serial1/1
O E2 192.168.244.0/24 [110/20] via 192.168.1.3, 00:06:06,
Serial1/1
C
192.168.64.0/24 is directly connected, Loopback0
9.0.0.0/24 is subnetted, 1 subnets
C
9.0.0.0 is directly connected, Loopback5
C
192.168.80.0/24 is directly connected, Loopback1
C
192.168.96.0/24 is directly connected, Loopback2
O E2
192.168.248.0/24 [110/20] via
192.168.1.3, 00:06:06, Serial1/1
C
192.168.112.0/24 is directly connected, Loopback3
C
192.168.1.0/24 is directly connected, Serial1/1
O E2
192.168.252.0/24 [110/20] via
192.168.1.3, 00:06:06, Serial1/1
192.168.3.0/32 is subnetted, 1 subnets
O
192.168.3.1 [110/65] via 192.168.1.3, 00:11:53, Serial1/1
O
192.168.64.0/18 is a summary, 00:12:03, Null0
R6(config-router)#redistribute
static metric-type 1
% Only classful networks will be redistributed
R5#sh 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
C
192.168.224.0/24 is directly connected, Serial1/1
O E1 192.168.240.0/24 [110/84] via
192.168.224.2, 00:01:44, Serial1/1
O E1 192.168.244.0/24 [110/84] via
192.168.224.2, 00:01:44, Serial1/1
O E1 192.168.248.0/24 [110/84] via 192.168.224.2, 00:01:44,
Serial1/1
C
192.168.1.0/24 is directly connected, Serial1/0
O E1 192.168.252.0/24 [110/84] via 192.168.224.2, 00:01:44,
Serial1/1
C
192.168.3.0/24 is directly connected, Loopback0
O IA 192.168.64.0/18 [110/65] via 192.168.1.1, 00:08:19,
Serial1/0
R4#sh 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
O IA 192.168.224.0/24 [110/128] via 192.168.1.3, 00:14:54,
Serial1/1
O E1 192.168.240.0/24 [110/148] via
192.168.1.3, 00:02:37, Serial1/1
O E1 192.168.244.0/24 [110/148] via
192.168.1.3, 00:02:37, Serial1/1
C
192.168.64.0/24 is directly connected, Loopback0
9.0.0.0/24 is subnetted, 1 subnets
C
9.0.0.0 is directly connected, Loopback5
C
192.168.80.0/24 is directly connected, Loopback1
C
192.168.96.0/24 is directly connected, Loopback2
O E1 192.168.248.0/24 [110/148] via
192.168.1.3, 00:02:37, Serial1/1
C
192.168.112.0/24 is directly connected, Loopback3
C
192.168.1.0/24 is directly connected, Serial1/1
O E1 192.168.252.0/24 [110/148] via
192.168.1.3, 00:02:37, Serial1/1
192.168.3.0/32 is subnetted, 1 subnets
O
192.168.3.1 [110/65] via 192.168.1.3, 00:14:55, Serial1/1
O
192.168.64.0/18 is a summary, 00:15:05, Null0
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15453509/viewspace-441661/
,如需转载,请注明出处,否则将追究法律责任。