大家好,又见面了,我是你们的朋友全栈君。
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
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(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(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(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://javaforall.cn/190021.html原文链接:https://javaforall.cn