码迷,mamicode.com
首页 > 其他好文 > 详细

静态路由配置实验

时间:2018-05-22 00:50:46      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:静态路由   IP route   下一跳   出接口   

技术分享图片

1、 根据拓扑链接,配置PC 的IP和网关
2、 路由器基本配置
路由器R0基本配置
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#inter
Router(config)#interface f0/0
Router(config-if)#ip add 192.168.1.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#interface s2/0
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#clock rate 64000 时钟频率
Router(config-if)#no shutdown
Router(config-if)#interface s3/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#clock rate 64000 时钟频率
Router(config-if)#no shutdown
Router(config-if)#end
Router#
Router#show ip route 查看路由表 都是直连路由

C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial3/0
C 192.168.3.0/24 is directly connected, Serial2/0
Router#conf t
Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.3.2
配置静态路由命令格式:IP route 目标网段 掩码 下一跳或者出接口
Router(config)#ip route 192.168.5.0 255.255.255.0 192.168.2.2

Router(config)#end
Router#
Router#show ip route

C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial3/0
C 192.168.3.0/24 is directly connected, Serial2/0
S 192.168.5.0/24 [1/0] via 192.168.2.2
S 192.168.6.0/24 [1/0] via 192.168.3.2

Router#

路由器R2基本配置
Router>
Router>en
Router#conf t
Router(config)#interface f0/0
Router(config-if)#ip add 192.168.5.2 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
Router(config-if)#exit
Router(config)#interface s2/0
Router(config-if)#ip add 192.168.2.2 255.255.255.0
Router(config-if)#no shu
Router(config-if)#no shutdown
Router(config-if)#interface s3/0
Router(config-if)#ip add 192.168.4.2 255.255.255.0
Router(config-if)#no shu
Router(config-if)#no shutdown
Router(config-if)#end
Router#
Router#show ip route
C 192.168.2.0/24 is directly connected, Serial2/0
C 192.168.4.0/24 is directly connected, Serial3/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0

Router#conf t
Router(config)#ip rou
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.4.1

Router(config)#end
Router#
Router#show ip rou
Router#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

S 192.168.1.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, Serial2/0
C 192.168.4.0/24 is directly connected, Serial3/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
S 192.168.6.0/24 [1/0] via 192.168.4.1
Router#

路由器R3基本配置
Router>
Router>en
Router#conf t
Router(config)#interface f0/0

Router(config-if)#ip add 192.168.6.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#inter
Router(config)#interface s2/0
Router(config-if)#ip add 192.168.3.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#no shutdown

Router(config-if)#interface s3/0
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown
Router(config-if)#end
Router#
Router#show ip route

C 192.168.3.0/24 is directly connected, Serial2/0
C 192.168.4.0/24 is directly connected, Serial3/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
Router#conf t
Router(config)#ip rou
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
Router(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.2

Router(config)#

最后测试三台PC是否可以ping通!如果通说明实验成功,如果不通要检查路由,检查网关等

静态路由配置实验

标签:静态路由   IP route   下一跳   出接口   

原文地址:http://blog.51cto.com/ronning/2118893

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!