A公司用的是IS-IS,B公司用的是OSPF,现在这两个公司要合并,网络要相通
项目目标
前期准备
- 配置IP地址:完成IP地址规划,A公司和B公司内部网络通过路由器R2和R4环回接口模拟。配置路由器接口的IP地址并测试所有直连链路的连通性
- 配置IS-IS:路由器R1、R2和R3上网络配置IS-IS路由协议,区域为49.0001,R2上引入直连路由
- 配置OSPF:路由器R1、R3和R4上配置OSPF路由协议,区域为0,R4上引入直连路由
核心
- 配置路由引入:在边界设备R1和R3上配置路由引入。
- 分析次优路由:在路由器R3上首先执行OSPF和IS-IS双向路由引入,在路由器R1的路由表中出现到达R4环回接口所在网络的次优路由。
- 分析路由环路:在路由器R1上也完成OSPF和IS-IS双向路由引入,在器R1、R2和R3路由器上中出现到达R4环回接口所在网络的路由环路。
- 解决路由环路和次优路由:在路由引入时使用路由策略和路由标记来解决次优路由、路由反馈和路由环路的方案扩展性非常好
项目步骤
准备工作
(1)配置各设备的IP地址
完成实验拓扑图的IP的地址规划,AR2、AR4之间的内部网络通过环回接口模拟
# AR1配置
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 172.16.12.1 255.255.255.0
[AR1-GigabitEthernet0/0/0]q
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 172.16.134.1 24
[AR1-GigabitEthernet0/0/1]q
[AR1]# AR2配置
[AR2]interface LoopBack 2
[AR2-LoopBack2]ip address 172.16.2.2 24
[AR2-LoopBack2]q
[AR2]interface LoopBack 22
[AR2-LoopBack22]ip address 172.16.22.2 24
[AR2-LoopBack22]q
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 172.16.12.2 24
[AR2-GigabitEthernet0/0/0]q
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 172.16.23.2 24
[AR2-GigabitEthernet0/0/1]q
[AR2]# AR3配置
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ip address 172.16.23.3 24
[AR3-GigabitEthernet0/0/0]q
[AR3]interface GigabitEthernet 0/0/1
[AR3-GigabitEthernet0/0/1]ip address 172.16.134.3 24
[AR3-GigabitEthernet0/0/1]q
[AR3]# AR4配置
[AR4]interface GigabitEthernet 0/0/0
[AR4-GigabitEthernet0/0/0]ip address 172.16.134.4 24
[AR4-GigabitEthernet0/0/0]q
[AR4]interface LoopBack 4
[AR4-LoopBack4]ip address 172.16.4.4 24
[AR4-LoopBack4]q
[AR4]interface LoopBack 44
[AR4-LoopBack44]ip address 172.16.44.4 24
[AR4-LoopBack44]q
[AR4]
验证(以AR2为例)
<AR2>display ip interface brief | exclude unassigned
(2)配置IS-IS
路由器AR1、AR2、AR3上网络配置IS-IS路由协议,区域为49.0001,AR2上引入直连路由
# AR1配置
[AR1]isis 1
[AR1-isis-1]cost-style wide
[AR1-isis-1]network-entity 49.0001.1111.1111.1111.00
[AR1-isis-1]q
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]isis enable 1
[AR1-GigabitEthernet0/0/0]q
[AR1]# AR2配置
[AR2]isis 1
[AR2-isis-1]cost-style wide
[AR2-isis-1]network-entity 49.0001.2222.2222.2222.00
[AR2-isis-1]import-route direct
[AR2-isis-1]q
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]isis enable 1
[AR2-GigabitEthernet0/0/0]q
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]isis enable 1
[AR2-GigabitEthernet0/0/1]q
[AR2]# AR3配置
[AR3]isis 1
[AR3-isis-1]cost-style wide
[AR3-isis-1]network-entity 49.0001.3333.3333.3333.00
[AR3-isis-1]q
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]isis enable 1
[AR3-GigabitEthernet0/0/0]q
[AR3]
验证(以AR1为例)
<AR1>display ip routing-table protocol isis
(3)配置OSPF
路由器AR1、AR3、AR4上配置OSPF路由协议,区域为0,AR4上引入直连路由
# AR1配置
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]bandwidth-reference 1000
Info: Reference bandwidth is changed. Please ensure that the reference bandwidththat is configured for all the routers are the same.
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 172.16.134.1 0.0.0.0
[AR1-ospf-1-area-0.0.0.0]q
[AR1-ospf-1]q
[AR1]# AR3配置
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]bandwidth-reference 1000
Info: Reference bandwidth is changed. Please ensure that the reference bandwidththat is configured for all the routers are the same.
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 172.16.134.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]q
[AR3-ospf-1]q
[AR3]# AR4配置
[AR4]ospf 1 router-id 4.4.4.4
[AR4-ospf-1]import-route direct cost 10
[AR4-ospf-1]bandwidth-reference 1000
Info: Reference bandwidth is changed. Please ensure that the reference bandwidththat is configured for all the routers are the same.
[AR4-ospf-1]area 0
[AR4-ospf-1-area-0.0.0.0]network 172.16.134.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]q
[AR4-ospf-1]q
[AR4]
验证(以AR1为例)
<AR1>display ip routing-table protocol ospf
核心工作
(1)配置路由引入
在路由器AR3上首先执行OSPF和IS-IS双向路由引入
[AR3]ospf 1
[AR3-ospf-1]import-route isis 1
[AR3-ospf-1]q[AR3]isis 1
[AR3-isis-1]import-route ospf 1
[AR3-isis-1]q
[AR3]
(2)分析次优路由
在路由器AR3上首先执行OSPF和IS-IS双向路由引入后,在路由器AR1的路由表中,发现到目的网络172.16.4.0和172.16.44.0的下一跳地址是172.16.12.2,也就是经过路由器AR2和AR3到达,而没有选择直接到AR4,就是次优路由
<AR1>display ip routing-table protocol isis
由于172.16.4.0和172.16.44.0是通过在路由器AR4引入直连进入OSPF的,所以是OSPF ASE路由,在路由器AR1和AR3上没有执行双向路由引入之前,路由172.16.4.0和172.16.44.0会以O_ASE代码出现在路由器AR1和AR3的路由表上,路由优先级为150。
在路由器AR3上首先执行了OSPF和IS-IS双向路由引入,外部路由条目172.16.4.0和172.16.44.0进入OSPF进程,该条目通过5类LSA传递给路由器AR1,路由器AR1通过比较路由优先级,发现从路由器AR2收到该路由条目的优先级为15,而从路由器AR4收到的路由条目优先级为150,所以路由器AR1更新路由表,选择路由条目优先级低的路由安装进路由表,即下一跳指向路由器AR2,所以造成了次优路由
查看AR1到达172.16.4.4的信息
<AR1>tracert 172.16.4.4
(3)分析次优路由
在路由器AR1上也完成OSPF和IS-IS双向路由引入,在路由器AR1、AR2和AR3上出现到达AR4环回接口所在网络的路由环路
[AR1]ospf 1
[AR1-ospf-1]import-route isis 1
[AR1-ospf-1]q[AR1]isis 1
[AR1-isis-1]import-route ospf 1
[AR1-isis-1]q
[AR1]
接下来在路由器AR1、AR2、AR3上查看路由表,只需要关注172.16.4.0和172.16.44.0两条路由(以AR1为例)
<AR1>display ip routing-table
以上输出关注3台路由器上路由条目172.16.4.0和172.16.44.0的下一跳,发现路由环路已经产生
(4)解决路由环路和次优路由
在路由引入时使用路由策略和路由标记来解决次优路由、路由反馈和路由环路
首先通过修改路由优先级来解决次优路由和路由反馈的问题
# AR1配置
[AR1]ip ip-prefix 4 index 10 permit 172.16.4.0 24
[AR1]ip ip-prefix 4 index 20 permit 172.16.44.0 24
[AR1]route-policy PRE permit node 10
Info: New Sequence of this List.
[AR1-route-policy]if-match ip-prefix 4
[AR1-route-policy]apply preference 160
[AR1-route-policy]q
[AR1]route-policy PRE permit node 20
Info: New Sequence of this List.
[AR1-route-policy]q
[AR1]isis 1
[AR1-isis-1]preference route-policy PRE
[AR1-isis-1]q
[AR1]# AR3配置
[AR3]ip ip-prefix 4 index 10 permit 172.16.4.0 24
[AR3]ip ip-prefix 4 index 20 permit 172.16.44.0 24
[AR3]route-policy PRE permit node 10
Info: New Sequence of this List.
[AR3-route-policy]if-match ip-prefix 4
[AR3-route-policy]apply preference 160
[AR3-route-policy]q
[AR3]route-policy PRE permit node 20
Info: New Sequence of this List.
[AR3-route-policy]q
[AR3]isis 1
[AR3-isis-1]preference route-policy PRE
[AR3-isis-1]q
[AR3]
然后用路由策略和路由标记来解决路由环路问题
# AR1配置
[AR1]route-policy O2I deny node 10
Info: New Sequence of this List.
[AR1-route-policy]if-match tag 200
[AR1-route-policy]q
[AR1]route-policy O2I permit node 20
Info: New Sequence of this List.
[AR1-route-policy]apply tag 100
[AR1-route-policy]q
[AR1]route-policy I2O deny node 10
Info: New Sequence of this List.
[AR1-route-policy]if-match tag 400
[AR1-route-policy]q
[AR1]route-policy I2O permit node 20
Info: New Sequence of this List.
[AR1-route-policy]apply tag 300
[AR1-route-policy]q[AR1]ospf 1
[AR1-ospf-1]import-route isis 1 route-policy I2O
[AR1-ospf-1]q
[AR1]isis 1
[AR1-isis-1]import-route ospf 1 route-policy O2I
[AR1-isis-1]q
[AR1]# AR3配置
[AR3]route-policy I2O deny node 10
Info: New Sequence of this List.
[AR3-route-policy]if-match tag 100
[AR3-route-policy]q
[AR3]route-policy I2O permit node 20
Info: New Sequence of this List.
[AR3-route-policy]apply tag 200
[AR3-route-policy]q
[AR3]route-policy O2I deny node 10
Info: New Sequence of this List.
[AR3-route-policy]if-match tag 300
[AR3-route-policy]q
[AR3]route-policy O2I permit node 20
Info: New Sequence of this List.
[AR3-route-policy]apply tag 400
[AR3-route-policy]q[AR3]ospf 1
[AR3-ospf-1]import-route isis 1 route-policy I2O
[AR3-ospf-1]q
[AR3]isis 1
[AR3-isis-1]import-route ospf 1 route-policy I2O
[AR3-isis-1]q
[AR3]