实训三十一 静态路由和直连路由引入配置
一、实验目的
1.掌握路由引入的配置
2.理解路由引入的原理
二、应用环境
1.在某些应用环境中需要将静态路由引入到某些动态路由协议里
三、实验设备
1、DCR-2655 两台
2、网线(交叉线) 三条
六、实验步骤
第一部分:引入到 RIP 协议中
第一步:参照上表配置接口地址并测试连通性
Router_config#hostname Router-A
Router-A_config#interface g0/3
Router-A_config_g0/3#ip address 192.168.1.1 255.255.255.0
Router-A_config_g0/3#no shutdown
Router-A_config_g0/3#exit
Router-A_config#interface g0/4
Router-A_config_g0/4#ip address 192.168.0.1 255.255.255.0
Router-A_config_g0/4#no shutdown
Router-A_config_g0/4#exit
192.168.2.1/24Router-B 配置 略
第二步:配置路由器 A 的静态路由,查看直连和静态路由
Router-A#config
Router-A_config#ip route 172.16.2.0 255.255.255.0 192.168.0.5 !配置静态路由
Router-A_config#exit
Router-A#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, 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, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
S 172.16.2.0/24 [1,0] via 192.168.0.5(on GigaEthernet0/4)
C 192.168.0.0/24 is directly connected, GigaEthernet0/4
C 192.168.1.0/24 is directly connected, GigaEthernet0/3
Router-A#
第三步:在 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#config
Router-B_config#router rip
Router-B_config_rip#network 192.168.1.0 !注意只宣告了 192.168.1.0
Router-B_config_rip#exit
Router-B#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, 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, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
R 172.16.0.0/16 [120,1] via 192.168.1.1(on GigaEthernet0/3) !注意
是有类的路由
R 192.168.0.0/24 [120,1] via 192.168.1.1(on GigaEthernet0/3) C 192.168.1.0/24 is directly connected, GigaEthernet0/3
C 192.168.2.0/24 is directly connected, GigaEthernet0/4
Router-B#
第二部分:引入到 OSPF 协议中
重新做上图,重新配置
!注意此实验与“静态路由和直连路由引入到 RIP 协议中”不是同一个实验
第一步和第二步同上
第三步:在 A 上配置 OSPF 协议,并将直连和静态引入
Router-A_config#router ospf 1
Router-A_config_ospf_1#network 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_config#router ospf 1
Router-B_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0
Router-B_config_ospf_1#exit
Router-B#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, 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, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
O E2 172.16.2.0/24 [150,100] via 192.168.1.1(on GigaEthernet0/3)
O E2 192.168.0.0/24 [150,100] via 192.168.1.1(on GigaEthernet0/3)
!注意管理距离和花费值
C 192.168.1.0/24 is directly connected, GigaEthernet0/3
C 192.168.2.0/24 is directly connected, GigaEthernet0/4