实验十、静态路由和直连路由引入配置
一、 实验目的
1. 掌握路由引入的配置
2. 理解路由引入的原理
二、 应用环境
1. 在某些应用环境中需要将静态路由引入到某些动态路由协议里
三、 实验设备
DCR-1751 两台
四、 实验拓扑
五、 实验要求
配置表:
Router-A Router-B
F0/0 192.168.0.1/24 F0/0 192.168.2.1/24
S1/1 (DCE) 192.168.1.1/24 S1/0 192.168.1.2/24
在A 上配置将直连和静态路由引入到RIP 和OSPF 协议中
六、 实验步骤
第一部分:引入到RIP 协议中:
第一步:参照实验三和上表配置接口地址并测试连通性
第二步:配置路由器A 的静态路由,查看直连和静态路由
Router-A#config
Router-A_config#ip route 191.13.2.0 255.255.255.0 192.168.0.4 !配置静态路由
Router-A_config#^Z Router-A#sh ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type
VRF ID: 0
S 191.13.2.0/24 [1,0] via 192.168.0.4
C 192.168.0.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/1
第三步:在A 上配置RIP 协议,并将直连和静态路由引入
Router-A_config#router rip
Router-A_config_rip#network 192.168.1.0 !注意并没有宣告192.168.0.0
Router-A_config_rip#redistribute connect !将直连的路由引入
Router-A_config_rip#redistribute static !将静态路由引入
第四步:在B 上配置RIP 协议,查看从A 学习到的被引入的路由
Router-B#conf
Router-B_config#router rip
Router-B_config_rip#network 192.168.1.0
Router-B_config_rip#^Z
Router-B#sh ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type
VRF ID: 0
R 191.13.0.0/16 [120,1] via 192.168.1.1(on Serial1/0) !注意是有类的路由
R 192.168.0.0/16 [120,1] via 192.168.1.1(on Serial1/0)
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
第二部分:引入到OSPF 协议中
第一步和第二步同上
第三步:在A 上配置OSPF 协议,并将直连和静态引入
Router-A#conf
Router-A_config#router ospf 1 Router-A_config_ospf_1#net 192.168.1.0 255.255.255.0 area 0
Router-A_config_ospf_1#redistribute connect
Router-A_config_ospf_1#redistribute static
第四步:在B 上配置OSPF 协议,并查看从A 学习到的路由
Router-B#conf
Router-B_config#router ospf 1
Router-B_config_ospf_1#net 192.168.1.0 255.255.255.0 area 0
Router-B_config_ospf_1#exit
Router-B_config#no router rip
Router-B_config#^Z
Router-B#sh ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type
VRF ID: 0
O E2 191.13.2.0/24 [150,100] via 192.168.1.1(on Serial1/0)
!注意管理距离和花费值
O E2 192.168.0.0/24 [150,100] via 192.168.1.1(on Serial1/0)
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
OK!!!!!!!!!!!!!!!!!!!!!!!