读文网>电脑>网络知识>路由器>路由器基础

静态路由能胜任多网段之间进行通信

有很多网友经常单机使用电脑,并不会接触路由器这个东西,所以会对这个东西不会了解,今天小编就来和大家说一下,下文是小编向您带来的静态路由也能胜任多网段之间进行通信,欢迎大家阅读

如果多个网段之间要实现通信,必须使用路由器,这个毫无疑问。如果多个网段之间存在多个可选择的路径,最方便的是采取配置路由选择协议的方法,简单点的网络可以采用RIP协议,如果是复杂的网络则可以采用OSPF。当然在选择的路径不多时也可以采用静态路由的方法。

但是,当多个网段之间只有一条路径时,那么仅仅是配置静态路由就足够了。如果是在企业中工作,那么往往配置简单的静态路由就足够了。

为了更有说服力和便于理解我用CPT(Cisco Packet Tracer)演示了一下。

拓扑图如下图所示:

分别有四个网段,10.0.0.0/8、112.237.228.0/24、192.168.10.0/24、211.86.104.0/24。

静态路由设置如下:

ip route 192.168.10.0 255.255.255.0 112.237.228.1

ip route 211.86.104.0 255.255.255.0 112.237.228.1

ip route 10.0.0.0 255.0.0.0 112.237.228.244

ip route 211.86.104.0 255.255.255.0 192.168.10.1

ip route 112.237.228.0 255.255.255.0 192.168.10.2

ip route 10.0.0.0 255.0.0.0 192.168.10.2

配置如下:

1.PC0的IP配置:

Packet Tracer PC Command Line 1.0

PC>ipconfig

IP Address......................: 10.0.0.3

Subnet Mask.....................: 255.0.0.0

Default Gateway.................: 10.0.0.1

PC>

2.PC1的IP配置:

Packet Tracer PC Command Line 1.0

PC>ipconfig

IP Address......................: 211.86.104.52

Subnet Mask.....................: 255.255.255.0

Default Gateway.................: 211.86.104.254

PC>

3.R1的配置:

Router>enable

Routeconfigureterminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(confighostnameR1

R1(configinterfaceFastEthernet0/1

R1(config-ifipaddress 10.0.0.1 255.0.0.0

R1(config-ifnoshutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

R1(config-if)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

Rconft

Enter configuration commands, one per line. End with CNTL/Z.

R1(configintf0/0

R1(config-ifipaddr 112.237.228.244 255.255.255.0

R1(config-ifnoshutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

R1(config-if)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

Rconft

Enter configuration commands, one per line. End with CNTL/Z.

R1(configiproute 192.168.10.0 255.255.255.0 112.237.228.1

R1(configiproute 211.86.104.0 255.255.255.0 112.237.228.1

R1(config)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

R1#

4.R2的配置:

Router>enable

Routeconfigureterminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(confighostnameR2

R2(config)#

R2(configinterfaceFastEthernet0/1

R2(config-ifipaddress 112.237.228.1 255.255.255.0

R2(config-ifnoshutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

R2(config-if)#

R2(config-if)#exit

R2(configinterfaceFastEthernet0/0

R2(config-ifipaddress 192.168.10.2 255.255.255.0

R2(config-ifnoshutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

R2(config-if)#end

Rconft

Enter configuration commands, one per line. End with CNTL/Z.

R2(configiproute 10.0.0.0 255.0.0.0 112.237.228.244

R2(configiproute 211.86.104.0 255.255.255.0 192.168.10.1

R2(config)#end

R2#

%SYS-5-CONFIG_I: Configured from console by console

R2#

5.R3的配置:

Router>enable

Routeconfigureterminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(confighostnameR3

R3(config)#

R3(configinterfaceFastEthernet0/1

R3(config-ifipaddress 192.168.10.1 255.255.255.0

R3(config-ifnoshutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

R3(config-if)#

R3(config-if)#exit

R3(configinterfaceFastEthernet0/0

R3(config-ifipaddress 211.86.104.254 255.255.255.0

R3(config-ifnoshutdown

R3(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

R3>enable

Rconft

Enter configuration commands, one per line. End with CNTL/Z.

R3(configiproute 112.237.228.0 255.255.255.0 192.168.10.2

R3(configiproute 10.0.0.0 255.0.0.0 192.168.10.2

R3(config)#end

R3#

%SYS-5-CONFIG_I: Configured from console by console

R3#

6.使用tracert进行测试:

测试从PC0能否路由到PC1。

使用tracert进行测试

结果表明测试成功。

测试从PC1能否路由到PC0。

结果表明测试成功

相关热搜

相关文章

【路由器基础】热点

【路由器基础】最新