admin管理员组文章数量:1598078
静态路由的基本配置
- 静态路由配置图如下
PC1 IP地址:192.168.1.2
PC2 IP地址:192.168.2.2
PC3 IP地址:192.168.3.2
PC4 IP地址:192.168.4.2
R1 IP地址:
f1/0 192.168.3.1
f0/2 192.168.4.1
s2/0 1.1.1.1
R2 IP地址:
f0/0 192.168.1.1
f1/0 192.168.2.1
s2/0 1.1.1.2
注:图中的端口号写错了f0/1应该是f1/0
- 配置好四台电脑的IP,不懂得可以去主页看上一篇文章
- 配置R1ip
Router>enable
Router#conf
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#int f0/0
R1(config-if)#ip address 192.168.4.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#int f1/0
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R1(config-if)#int s2/0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
R1(config-if)#
- 配置R2的ip
R2(config)#int f0/0
R2(config-if)#ip add 192.168.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int f1/0
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R2(config-if)#int s2/0
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
R2(config-if)#
4.配置完ip后配置静态路由
注:ip routte的配置命令解释
ip route [network] [mask ] [address]
ip route :创建静态路由
network:目标网络号
mask:目标子网掩码
address:下一跳的IP地址
- R1的静态路由配置
如下 R1的静态路由,因为R1的数据要去访问R2上的目标,使用得告诉R1,R2上有多少个网络号,并且指向从S2/0口的1.1.1.2出去访问R2
R1(config)#ip route 192.168.1.0 255.255.255.0 1.1.1.2
R1(config)#ip route 192.168.2.0 255.255.255.0 1.1.1.2
- R2的静态路由配置
R2(config)#ip route 192.168.3.0 255.255.255.0 1.1.1.1
R2(config)#ip route 192.168.4.0 255.255.255.0 1.1.1.1
5.配置完静态路由后,四台PC就可以相互ping通了
版权声明:本文标题:静态路由的基本配置 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1728299543a1152844.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论