本文主要是介绍OSPF的stub区域,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、 OSPF的stub区域
a、 stub区域不能学习外部路由,只能通过默认路由
b、 在区域内配置:area 区域-id stub
R1配置
en
conf t
hostname R1int loopback 0
ip address 1.1.1.1 255.255.255.0
no shutdown
exitint f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exitrouter ospf 1
network 1.1.1.0 0.0.0.255 area 1
network 192.168.1.0 0.0.0.255 area 1
area 1 stub
exit
end
R2配置
en
conf t
hostname R2int loopback 0
ip address 2.2.2.2 255.255.255.0
no shutdown
exitint f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exitint f0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exitrouter ospf 1
network 2.2.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 1
network 192.168.2.0 0.0.0.255 area 0
area 1 stub
exit
end
R3配置
en
conf t
hostname R3int loopback 0
ip address 3.3.3.3 255.255.255.0
no shutdown
exitint f0/1
ip address 192.168.2.2 255.255.255.0
no shutdown
exitint f0/0
ip address 202.168.1.1 255.255.255.0
no shutdown
exitrouter ospf 1
network 192.168.2.0 0.0.0.255 area 0
network 3.3.3.0 0.0.0.255 area 0
redistribute static metric-type 1 subnets
exitip route 4.4.4.0 255.255.255.0 f0/0
end
R4配置
en
conf t
hostname R4int f0/0
ip address 202.168.1.2 255.255.255.0
no shutdown
exitint loopback 0
ip address 4.4.4.4 255.255.255.0
no shutdown
exitip route 0.0.0.0 0.0.0.0 f0/0
end
R1#show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 135 0x80000003 0x00500e 2
2.2.2.2 2.2.2.2 135 0x80000002 0x005515 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.2 2.2.2.2 135 0x80000001 0x00741f
Summary Net Link States (Area1)
Link ID ADV Router Age Seq# Checksum
192.168.2.0 2.2.2.2 115 0x80000001 0x008f5b
0.0.0.0 2.2.2.2 115 0x80000002 0x0055ff
2.2.2.2 2.2.2.2 115 0x80000003 0x00f655
3.3.3.3 2.2.2.2 115 0x80000004 0x00d075
R1#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 192.168.1.2 tonetwork 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/2] via 192.168.1.2, 00:01:52, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/3] via 192.168.1.2, 00:01:52, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
O IA 192.168.2.0/24 [110/2] via192.168.1.2, 00:01:52, FastEthernet0/0
O*IA 0.0.0.0/0 [110/2] via 192.168.1.2,00:01:52, FastEthernet0/0
解释:存根区域不能学习外部路由,可以通过默认路由0.0.0.0
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 22 0x80000003 0x0057f7 2
3.3.3.3 3.3.3.3 22 0x80000003 0x004af6 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.2.2 3.3.3.3 22 0x80000001 0x007f07
Summary Net Link States (Area0)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 2.2.2.2 17 0x80000001 0x009a51
1.1.1.1 2.2.2.2 17 0x80000002 0x00311f
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 22 0x80000003 0x005316 1
1.1.1.1 1.1.1.1 22 0x80000003 0x00500e 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.2 2.2.2.2 22 0x80000001 0x00741f
Summary Net Link States (Area1)
Link ID ADV Router Age Seq# Checksum
2.2.2.2 2.2.2.2 17 0x80000001 0x00fa53
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:20, 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:15, 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:15, 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。
这篇关于OSPF的stub区域的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!