要求:++让三台电脑互相能ping通++
通过配置静态路由实现
1.先如图配置与选好路由器和PC,并配置PC相应的IP地址
2.给路由器增加接口并开启,然后进行连接
3.给路由配置PC 的网关地址,3个路由器配置3次。注意:PC要能ping通网关地址
//以PC1为例
C:\>ping 192.168.80.254
Pinging 192.168.80.254 with 32 bytes of data:
Reply from 192.168.80.254: bytes=32 time<1ms TTL=255
Reply from 192.168.80.254: bytes=32 time=1ms TTL=255
4.给路由器配置接口IP地址
//R1配置
R1(config)#int s0/0/0
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#do wr
//R2配置
R1(config)#int s0/0/0 //配置R1与R2相连的接口
R1(config-if)#ip add 172.16.1.2 255.255.255.0
R1(config)#int s0/0/1 //配置R2与R3相连的接口
R1(config-if)#ip add 172.16.2.1 255.255.255.0
R1(config-if)#do wr
//R3配置
R1(config)#int s0/0/1 //配置R2与R3相连的接口
R1(config-if)#ip add 172.16.2.2 255.255.255.0
R1(config-if)#do wr
/*
注意:
R1与R2之间的S0/0/0接口要在同一网段(172.16.1.0)
R2与R3之间的S0/0/1接口要在同一网段(172.16.2.0)
*/
5.配置静态路由
/*
ip route 目的网络 掩码{目的网关地址 接口}
*/
//R1配置
R1(config)#ip route 192.168.90.0 255.255.255.0 172.16.1.2
R1(config)#do wr
//R2配置
R2(config)#ip route 192.168.80.0 255.255.255.0 172.16.1.1
R2(config)#do wr
R2(config)#ip route 192.168.100.0 255.255.255.0 172.16.2.2
R2(config)#do wr
//R3配置
R3(config)#ip route 192.168.90.0 255.255.255.0 172.16.2.1
R3(config)#do wr
注意:
ip route 192.168.80.0 255.255.255.0 172.16.1.1
这句话的意思是:路由器见到了目的网段为192.168.8
0.0的数据包,就将数据包发送到172.16.1.0网段上。
也就是要想去往192.168.80.0,就要经过172.168.1.0
配置到这PC0可以和PC1互相ping通;
PC2可以和PC1互相互相ping通
最后一步使PC0和PC2ping通
//R1配置
R1(config)#ip route 192.168.100.0 255.255.255.0 172.16.1.2
R1(config)#do wr
//R2配置
R2(config)#ip route 192.168.80.0 255.255.255.0 172.16.2.1
R2(config)#do wr
到这三台PC就可以互相ping通了
C:\>ping 192.168.100.100
Pinging 192.168.100.100 with 32 bytes of data:
Reply from 192.168.100.100: bytes=32 time=2ms TTL=125
Reply from 192.168.100.100: bytes=32 time=5ms TTL=125
C:\>ping 192.168.80.80
Pinging 192.168.80.80 with 32 bytes of data:
Reply from 192.168.80.80: bytes=32 time=15ms TTL=125
Reply from 192.168.80.80: bytes=32 time=12ms TTL=125