大家好,欢迎来到IT知识分享网。
静态路由的基本配置
- 静态路由配置图如下
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://yundeesoft.com/24665.html