R1:
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.14.1 255.255.255.0
interface GigabitEthernet0/0/2
ip address 192.168.15.1 255.255.255.0
interface LoopBack0
ip address 10.10.10.1 255.255.255.255
interface LoopBack1
ip address 10.10.20.1 255.255.255.255
ospf 1
asbr-summary 5.5.0.0 255.255.0.0//外部路由执行路由汇聚
import-route static type 1//外部路由协议注入OSPF路由协议中,并修改链路类型
area 0.0.0.1
network 10.10.10.1 0.0.0.0
network 10.10.20.1 0.0.0.0
network 192.168.12.0 0.0.0.255
ip route-static 5.5.4.0 255.255.255.0 192.168.14.4
ip route-static 5.5.5.0 255.255.255.0 192.168.15.5
R2:
interface GigabitEthernet0/0/0
ip address 192.168.23.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.12.2 255.255.255.0
ospf 1
area 0.0.0.0
network 192.168.23.0 0.0.0.255
area 0.0.0.1
abr-summary 10.10.0.0 255.255.0.0
network 192.168.12.0 0.0.0.255
R3:
interface GigabitEthernet0/0/1
ip address 192.168.23.3 255.255.255.0
ospf 1
area 0.0.0.0
network 192.168.23.0 0.0.0.255
R4:
interface GigabitEthernet0/0/0
ip address 192.168.14.4 255.255.255.0
interface GigabitEthernet0/0/1
interface GigabitEthernet0/0/2
interface NULL0
interface LoopBack0
ip address 5.5.4.4 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 192.168.14.1
R5:
interface GigabitEthernet0/0/0
ip address 192.168.15.5 255.255.255.0
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 192.168.15.1
验证:
查看ospf路由表
< R3>dis ospf routing
OSPF Process 1 with Router ID 192.168.23.3
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.23.0/24 1 Transit 192.168.23.3 192.168.23.3 0.0.0.0
10.10.0.0/16 2 Inter-area 192.168.23.2 192.168.23.2 0.0.0.0
192.168.12.0/24 2 Inter-area 192.168.23.2 192.168.23.2 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
5.5.0.0/16 3 Type1 1 192.168.23.2 192.168.12.
1
Total Nets: 4
Intra Area: 1 Inter Area: 2 ASE: 1 NSSA: 0
查看OSPF数据表
< R3>dis ospf lsdb
OSPF Process 1 with Router ID 192.168.23.3
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 192.168.23.3 192.168.23.3 1093 36 80000007 1
Router 192.168.23.2 192.168.23.2 1087 36 80000009 1
Network 192.168.23.2 192.168.23.2 1087 32 80000003 0
Sum-Net 10.10.0.0 192.168.23.2 213 28 80000003 1
Sum-Net 192.168.12.0 192.168.23.2 249 28 80000003 1
Sum-Asbr 192.168.12.1 192.168.23.2 829 28 80000002 1
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 5.5.0.0 192.168.12.1 774 36 80000002 1
查看ASBR信息
< R3>dis ospf lsdb ase 5.5.0.0
OSPF Process 1 with Router ID 192.168.23.3
Link State Database
Type : External
Ls id : 5.5.0.0
Adv rtr : 192.168.12.1
Ls age : 853
Len : 36
Options : E
seq# : 80000002
chksum : 0x953a
Net mask : 255.255.0.0
TOS 0 Metric: 1
E type : 1
Forwarding Address : 0.0.0.0
Tag : 1
Priority : Low
注意:
1、OSPF注入外部路由协议,外部路由注入通过ASBR路由器注入,通过ABR通告。
2、ospf路由汇聚,可以在区域内通过ABR路由器汇聚,也可以通过ASBR路由器汇聚。
3、ospf外部路由注入链路类型可以手工更改,type : 1为近距离链路需要计算ospf内部路由开销,type : 2为远距离链路忽略不计算ospf内部路由开销。
来源:CSDN
作者:两个男孩
链接:https://blog.csdn.net/weixin_39041972/article/details/104426138