组网需求
- Router B与Router A之间通过OSPF协议交换路由信息,与Router C之间通过IS-IS协议交换路由信息
- 要求在Router B上将IS-IS网络中路由引入到OSPF网络后,OSPF网络中路由172.17.1.0/24的优先级较低
- 路由172.17.2.0/24具有标识,方便以后运用路由策略
组网拓扑
配置思路
- 在Router B上配置路由策略,将172.17.1.0/24的路由的开销值设置为100,在OSPF引入IS-IS路由时应用路由策略
- 将172,。17.2.0/24的路由的Tag属性设置成20,实现路由172.17.2.0/24,方便以后运用路由策略
配置命令
配置路由器基本功能以及各个接口IP地址
Router A配置
1
2
3
4
5
6sys
sys Router A
int g0/0/0
ip add 192.168.1.1 30
int LoopBack 0
ip add 1.1.1.1 32
Router B配置
1
2
3
4
5
6
7
8sys
sys Router B
int g0/0/0
ip add 192.168.1.2 30
int g0/0/1
ip add 192.168.2.2 30
int LoopBack 0
ip add 2.2.2.2 32
Router C配置
1
2
3
4
5
6sys
sys Router C
int g0/0/1
ip add 192.168.2.1 30
int LoopBack 0
ip add 3.3.3. 32
配置OSPF协议
Router A配置
1
2
3
4sys
ospf 1 router-id 1.1.1.1
area 0
network 192.168.1.0 0.0.0.3
Router B配置
1
2
3
4sys
ospf 1 router-id 2.2.2.2
area 0
network 192.168.1.0 0.0.0.3
配置IS-IS协议
Router B配置
1
2
3
4
5
6
7sys
isis 1
is-level level-2
network-entity 86.0010.0020.0200.2002
int g0/0/1
isis enable 1
isis small-hello
Router C配置
1
2
3
4
5
6
7
8sys
isis 1
is-level level-2
network-entity 86.0010.0030.0300.3003
int g0/0/1
isis enable 1
isis small-hello
配置路由引入
Router B配置
1
2
3
4
5
6sys
isis 1
import-route ospf 1
ospf 1
import-route isis 1
Router C配置
1
2
3
4
5
6
7sys
ip route-static 172.17.1.0 24 NULL 0
ip route-static 172.17.2.0 24 NULL 0
ip route-static 172.17.3.0 24 NULL 0
isis 1
import-route static
配置过滤器(Router B)
1
2
3
4
5sys
acl 2002
rule 0 permit source 172.17.2.0 0.0.0.255
q
ip ip-prefix isis_2.0 index 1 permit 172.17.1.0 24
配置路由策略(Router B)
1
2
3
4
5
6
7
8sys
route-policy isis_to_ospf permit node 10
if-match ip-prefix isis_2.0
apply cost 100
route-policy isis_to_ospf premit node 20
if-match acl 2002
apply tag 20
route-policy isis_to_ospf permit node 30
应用路由策略(Router A)
1
2
3sys
ospf 1
import isis 1 route-policy isis_to_ospf
查看结果
查看配置路由引入后的路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20display ospf routing
<Router A>dis ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.1.0/30 1 Transit 192.168.1.1 1.1.1.1 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
172.17.1.0/24 1 Type2 1 192.168.1.2 2.2.2.2
172.17.2.0/24 1 Type2 1 192.168.1.2 2.2.2.2
172.17.3.0/24 1 Type2 1 192.168.1.2 2.2.2.2
192.168.2.0/30 1 Type2 1 192.168.1.2 2.2.2.2
Total Nets: 5
Intra Area: 1 Inter Area: 0 ASE: 4 NSSA: 0
查看应用路由策略后的路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20display ospf routing
<Router A>dis ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.1.0/30 1 Transit 192.168.1.1 1.1.1.1 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
172.17.1.0/24 100 Type2 1 192.168.1.2 2.2.2.2 //Cost值为100
172.17.2.0/24 1 Type2 20 192.168.1.2 2.2.2.2 //Tag值为20
172.17.3.0/24 1 Type2 1 192.168.1.2 2.2.2.2
192.168.2.0/30 1 Type2 1 192.168.1.2 2.2.2.2
Total Nets: 5
Intra Area: 1 Inter Area: 0 ASE: 4 NSSA: 0