3.7 路由器静态路由配置
预备知识:
一、实训目的
二、应用环境
三、实训要求
1、实训设备
2、实训拓扑图
3、配置要求及实训效果
四、实训思路
五、实训步骤
1、按实训拓扑图添加2台2811路由器和2台PC机,并按图连接网络。
2、按配置要求设置PC1和PC2的IP地址及网关信息。
3、进入路由器R1命令行配置窗口,更改路由器名称,为F0/0、F0/1接口配置IP地址并打开接口。
Router>enable
Router#conf t
Router(config)#hostname R1
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
/*此时注意观察F0/0接口的状态*/
R1(config-if)#exit
R1(config)#interface f0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
4、同样的方法进入路由器R2命令行配置窗口,更改路由器名称,为F0/0、F0/1接口配置IP地址并打开接口。
Router>enable
Router#conf t
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no shutdown
/*此时注意观察F0/0接口的状态*/
R2(config-if)#exit
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
/*此时注意观察R1和R2的F0/1接口的状态*/
5、使用PC1测试与PC2的连通性,此时不能连通,如下图所示。
目标不可达,PC1
与PC2不通。
6、使用SHOW IP ROUTE命令在特权用户配置模式下查看R1上的路由信息表,如下所示。
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
7、使用SHOW IP ROUTE命令在特权用户配置模式下查看R2上的路由信息表,如下所示。R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
8、在R1上进入全局配置模式配置到网段192.168.3.0的静态路由信息,如下所示。
R1#conf t
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#
9、同样的方法,在R2上进入全局配置模式配置到网段192.168.1.0的静态路由信息,如下所示。
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#
10、使用PC1测试与PC2的连通性,此时连通,如下图所示。
11、再次查看R1上的路由信息表,此时已有非直连网段的静态路由信息,如下所示。 R1(config)#exit
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S 192.168.3.0/24 [1/0] via 192.168.2.2
R1#
12、再次查看R2上的路由信息表,此时已有非直连网段的静态路由信息,如下所示。 R2(config)#exit
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
PC1与PC2连通。
R1路由表,S 表标静态路由。
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
S 192.168.1.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, FastEthernet0/1 C 192.168.3.0/24 is directly connected, FastEthernet0/0 R2#
六、相关命令
七、相关知识
八、实训报告
九、实训巩固R2路由表,S表标静态路由。