a、 静态路由重分布,使得外部路由能注入自治系统
b、 必须包含主干区域,主干区域负责收集非主干区域发出的汇总路由信息,并将这些信息返回给到其他区域
R1配置
en
conf t
hostname R1
int loopback 0
ip address 1.1.1.1 255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
exit
end
R2配置
en
conf t
hostname R2
int loopback 0
ip address 2.2.2.2 255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
router ospf 1
network 2.2.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 1
exit
end
R3配置
en
conf t
hostname R3
int loopback 0
ip address 3.3.3.3 255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.2.2 255.255.255.0
no shutdown
exit
int f0/0
ip address 202.168.1.1 255.255.255.0
no shutdown
exit
router ospf 1
network 192.168.2.0 0.0.0.255 area 1
network 3.3.3.0 0.0.0.255 area 1
redistribute static metric-type 1 subnets
exit
ip route 4.4.4.0 255.255.255.0 f0/0
end
R4配置
en
conf t
hostname R4
int f0/0
ip address 202.168.1.2 255.255.255.0
no shutdown
exit
int loopback 0
ip address 4.4.4.4 255.255.255.0
no shutdown
exit
ip route 0.0.0.0 0.0.0.0 f0/0
end
R2#show ip ospf database
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 6 0x80000004 0x00410e 2
1.1.1.1 1.1.1.1 6 0x80000003 0x00500e 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.2 2.2.2.2 6 0x80000001 0x00741f
Summary Net Link States (Area0)
Link ID ADV Router Age Seq# Checksum
192.168.2.0 2.2.2.2 1 0x80000001 0x008f5b
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 6 0x80000002 0x005d0c 1
3.3.3.3 3.3.3.3 6 0x80000003 0x004af6 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.2.2 3.3.3.3 6 0x80000001 0x007f07
Summary Net Link States (Area1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 2.2.2.2 1 0x80000001 0x009a51
2.2.2.2 2.2.2.2 1 0x80000002 0x00f854
1.1.1.1 2.2.2.2 1 0x80000003 0x002f20
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
4.4.4.0 3.3.3.3 50 0x80000001 0x005bcd 0
解释:外部路由通过LSA5传送到各个路由器。
R2#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 - OSPFexternal 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
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 192.168.1.1, 00:00:08, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 192.168.2.2, 00:00:03, FastEthernet0/1
4.0.0.0/24 is subnetted, 1 subnets
O E1 4.4.4.0 [110/21] via 192.168.2.2, 00:00:03, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
解释:OE1表示外部路由,路由重分布到本区域。