您的位置首页生活百科

怎样配置静态路由

怎样配置静态路由

的有关信息介绍如下:

怎样配置静态路由

怎样配置静态路由

设置计算机A的IP为192.168.1.2子网掩码为255.255.255.0网关为192.168.1.1

设置计算机B的IP为192.168.2.2子网掩码为255.255.255.0网关为192.168.2.1

给路由A的fastEthernet 0/0端口配置IP为192.168.1.1子网掩码为255.255.255.0,由于路由默认的端口是关闭的,所以在给路由端口配置好IP以后,要注意用no shutdown命令把端口开启。如下是配置路由A端口fastEthernet 0/0的所有命令:

Continuewith configuration dialog? [yes/no]: no

Router#configure terminal

Router(config)#interfacefastEthernet 0/0

Router(config-if)#noshutdown

给路由A的fastEthernet 1/0端口配置IP为192.168.3.1子网掩码为255.255.255.0,如下是配置路由A端口fastEthernet1/0的所有命令

Router(config-if)#exit

Router(config)#interfacefastEthernet 1/0

Router(config-if)#ipaddress 192.168.3.1 255.255.255.0

Router(config-if)#noshutdown

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

Router(config-if)#exit

给路由B的fastEthernet 1/0端口配置IP为192.168.3.2子网掩码为255.255.255.0,如下是配置路由B端口fastEthernet1/0的所有命令

Continuewith configuration dialog? [yes/no]: no

Router>enable

Router#configure terminal

Enterconfiguration commands, one per line.End with CNTL/Z.

Router(config)#interfacefastEthernet 0/0

Router(config-if)#ipaddress 192.168.3.2 255.255.255.0

Router(config-if)#noshutdown

给路由B的fastEthernet 0/0端口配置IP为192.168.2.1子网掩码为255.255.255.0,如下是配置路由A端口fastEthernet1/0的所有命令

Router(config-if)#exit

Router(config)#interface fastEthernet 1/0

Router(config-if)#ip address 192.168.2.1 255.255.255.0

Router(config-if)#no shutdown

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

Router(config-if)#exit

给路由B设置静态跳转,若遇到访问计算机A这个网段的数据包,给他规定了往路由A的1/0端口,跳转,再在跳转后到达的路由查询路由表,查询计算机A的这个网段再转发数据包。具体命令如下:

Router(config)#iproute 192.168.1.0 255.255.255.0 192.168.3.1

在路由A也设置一个跳转,要不数据发送出去了,找不到回来就路,那么就没返回信息了,具体命令如下:

Router(config)#iproute 192.168.2.0 255.255.255.0 192.168.3.2

用ping命令测试全网是否连通了!如果前面的步骤你都没操作错的话,那么现在的测试,你会得到结果。