静态路由配置教程

要求:++让三台电脑互相能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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值