实验步骤:
R1:
en
confif t
int Loo0
ip add 1.1.1.1 255.255.255.0
no shut
exit
int s 0/1
ip add 13.1.1.1 255.255.255.0
no shut
exit
int s 0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
router ospf 110
router-id 1.1.1.1
network 13.1.1.1 0.0.0.0 area 0
exit
router rip
version 2
no auto-summary
network 1.0.0.0
network 12.0.0.0
exit
router os 110//将RIP重分发进OSPF
redistribute rip subnets
exit
//////////////////////////////////顺时针方向重分发完成
router rip
redisttibute ospf 110 metric 3
//管理距离仅具有本地意义
//更改RIP域内两条路由的管理距离为109(管理距离值仅具有本地意义)
access-list 10 permit 2.2.2.0
access-list 10 permit 24.1.1.0
router rip
distance 109 12.1.1.2 0.0.0.0 10//12.1.1.2 为获取RIP路由的路由器的接口的IP地址
end
show ip route
//路由优化 ,不适用负载均衡,使其选择最优路径,修改重分发过来的路由seed metric
值,要想实现精确修改,可以调用route-map,对于距离矢量协议,可以通过使用
offset-list来实现,对于链路状态协议,可以通过修改度量值类型来实现。绝对不可使用distribute-list。
ip prefix-list 10 permit 34.1.1.0/24
ip prefix-list 10 permit 4.4.4.0/24
route-map song permit 10
match ip address prefix-list 10
set metric 4
exit
route-map song permit 20
exit
router rip
redistribute ospf 110 metric 3 route-map song
ip prefix-list 20 permit 1.1.1.0/24
ip prefix-list 20 permit 12.1.1.0/24
route-map song permit 10
match ip address prefix-list 20
set metric-type type-1
exit
route-map song permit 20
exit
router os 110
redistribute rip subnets route-map song
R2:
en
conf t
int loo0
ip add 2.2.2.2 255.255.255.0
no shut
exit
int s 0/1
ip add 12.1.1.2 255.255.255.0
no shut
exit
int s 0/0
ip add 24.1.1.2 255.255.255.0
no shut
exit
router rip
version 2
no auto-summary
network 0.0.0.0
R3:
en
conf t
int loo0
ip add 3.3.3.3 255.255.255.0
no shut
ip ospf network point-to-point
exit
int s 0/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int s 0/1
ip add 34.1.1.3 255.255.255.0
no shutdown
exit
router os 110
router-id 3.3.3.3
network 0.0.0.0 255.255.255.255 area 0
exit
R4:
en
conf t
int loo0
ip add 4.4.4.4 255.255.255.0
no shut
ip ospf network point-to-point
exit
int s 0/1
ip add 24.1.1.4 255.255.255.0
no shut
exit
int s 0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
router os 110
router-id 4.4.4.4
network 4.4.4.4 0.0.0.0 area 0
network 34.1.1.4 0.0.0.0 area 0
exit
router rip
version 2
no auto-summary
network 24.0.0.0
exit
router os 110 //更改路由的管理距离,在本地路由器上改
distance 121 1.1.1.1 0.0.0.0 10//通告者(ASBR)的IP
ex
access-list 10 permit 1.1.1.0
access-list 10 permit 12.1.1.0
access-list 10 permit 2.2.2.0
router rip //将OSPF重分发进RIP
redistribute ospf 110 metric 3
exit
//////////////////////////////////顺时针重分发完成
router ospf 110
redistribute rip subnets
exit
//路由优化
access-list 20 permit 13.1.1.0
router rip
offset-list 20 out 1 serial 1/1
access-list 30 permit 24.1.1.0
route-map song permit 10
match ip address 30
set metric-type type-1(OE 1的路由的优先级大于OE 2)
exit
route-map song permit 20
exit
router ospf 110
redistribute rip subnets route-map song