R1,R2,R3,R4这四个路由器运行ospf协议
R3,R4,R5这三个路由器运行isis协议
R1上有环回口IP为1.1.1.1/32 有一条静态路由 static 192.168.2.0/24(把静态路由引入到ospf)
R5上有环回口IP为5.5.5.5/32
两个环回口分别加到各自的路由协议中
在R3和R4上:
ospf协议中引入isis协议
isis协议中引入ospf协议( 共计4次import-route)
(从优先级低的路由引入到优先级高的路由协议中会产生次优路径,反之没有)
利用如下配置可完美解决路由回馈,环路,次优路径等问题
网络拓扑图如下
拓扑图中的命令配置相对方便理解,下面文字为详细配置,大家可以根据A>B>C>D的顺序进行配置与理解
R1
interface GigabitEthernet0/0/0
ip address 10.1.12.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 1 router-id 1.1.1.1
import-route static (把这条静态路由引入)
(写这条静态路由的原因是:把静态路由引入到ospf中时为ospf的5类lsa,优先级为150比isis协议优先级15要低,优先级越小越优先,如果不进行对应配置就会产生路由环路)
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.12.1 0.0.0.0
#
ip route-static 192.168.2.0 255.255.255.0 NULL0
(R1配置相对简单只需要建立ospf邻居关系即可)
R2
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.23.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.1.24.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.12.2 0.0.0.0
network 10.1.23.2 0.0.0.0
network 10.1.24.2 0.0.0.0
(R2配置相对简单只需要建立ospf邻居即可)
oti:在isis协议中引入ospf协议
ito:在ospf协议中引入isis协议(方便记忆)
R3
isis 1
is-level level-2(所有isis协议运行级别二)
cost-style wide(把isis的开销风格改为宽度量值风格,这样才能让isis协议携带tag)
network-entity 49.0345.0000.0003.00
import-route ospf 1 route-policy oti(把ospf协议引入时执行oti这条前缀列表)
#
interface GigabitEthernet0/0/0
ip address 10.1.23.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.35.3 255.255.255.0
isis enable 1
#
ospf 1 router-id 3.3.3.3
import-route isis 1 route-policy ito(把isis协议引入时执行ito这条前缀列表)
preference ase route-policy ase 10(默认引入ospf的路由优先级设置为10,但是要先匹配策略路由内的设置)
area 0.0.0.0
network 10.1.23.3 0.0.0.0
(接下来是各种策略路由,需要跟R4配合完成,单看较为困难建议用ensp做实验)
#
route-policy oti deny node 10
if-match tag 20(如果看到带tag20的路由拒绝引入)(在R4中找tag20的来源)
#
route-policy oti permit node 20
apply tag 10(允许路由通过,通过的路由打上tag10的标记)
#
route-policy ito deny node 10
if-match tag 30(同上,因为是两个协议互相引入所以共需要4种tag标记方便区分)
#
route-policy ito permit node 20
apply tag 40(同上)
#
route-policy ase permit node 10(当发现带tag20标记的路由,把路由优先级设置为150)
if-match tag 20
apply preference 150
(打tag的目的时防止路由回馈,例:从R3引入的路由不能从R4引回)
(R4配置与R3基本类似详情备注参照R3)
R4
isis 1
is-level level-2
cost-style wide(把isis的开销风格改为宽度量值风格,全网运行isis协议的路由器都需要设置)
network-entity 49.0345.0000.0004.00
import-route ospf 1 route-policy oti
#
interface GigabitEthernet0/0/0
ip address 10.1.24.4 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.45.4 255.255.255.0
isis enable 1
#
ospf 1 router-id 4.4.4.4
import-route isis 1 route-policy ito
preference ase route-policy ase 10
area 0.0.0.0
network 10.1.24.4 0.0.0.0
#
route-policy ase permit node 10
if-match tag 40
apply preference 150
#
route-policy oti deny node 10
if-match tag 40
#
route-policy oti permit node 20
apply tag 30
#
route-policy ito deny node 10
if-match tag 10
#
route-policy ito permit node 20
apply tag 20
R5
isis 1
is-level level-2
cost-style wide(所有运行isis的路由器都需要敲此命令)
network-entity 49.0345.0000.0005.00
#
interface GigabitEthernet0/0/0
ip address 10.1.35.5 255.255.255.0
isis enable 1
#
interface GigabitEthernet0/0/1
ip address 10.1.45.5 255.255.255.0
isis enable 1
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
isis enable 1
(R5配置相对简单只需要建立isis邻居关系即可)