静态路由
是一种需要管理员手工配置的特殊路由,静态路由比动态路由使用更少的带宽,并且不占用CPU资源来计算和分析路由更新。但是当网络发生故障或者拓扑发生变化后,静态路由不会自动更新,必须手动重新配置。
当网络结构比较简单时,只需配置静态路由就可以使网络正常工作。路由是双向的,在本端配置完静态路由后,仍需要在对端设备上配置回程路由。
下面配置教育楼的PC1与综合楼的PC2互通的静态路由;

首先配置好两台PC的IP地址、子网掩码、网关信息。

下面再配置路由器R1,R2,R3接口地址信息。
路由器R1的配置
sys
[Huawei]undo info-center enable
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 11.11.11.1 24
[R1-GigabitEthernet0/0/0]q
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.10.10.254 24
[R1-GigabitEthernet0/0/1]q
[R1]ping 10.10.10.1

路由器R2的配置
system-view
[Huawei]undo info-center e
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 11.11.11.2 24
[R2-GigabitEthernet0/0/0]q
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 22.22.22.1 24
[R2-GigabitEthernet0/0/1]q
[R2]

路由器R3的配置
system-view
[Huawei]undo info-center enable
[Huawei]sysname R3
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 22.22.22.2 24
[R3-GigabitEthernet0/0/1]q
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[R3-GigabitEthernet0/0/0]q
[R3]ping 192.168.1.10


配置好路由器的接口地址后,相邻两个路由器之间能够互通互联,但两台PC之间还是不能互通,下面来配置静态路由;

[R1]ip route-static 192.168.1.0 24 11.11.11.2
[R1]ip route-static 22.22.22.0 24 11.11.11.2
[R2]ip route-static 192.168.1.0 24 22.22.22.2
[R2]ip route-static 10.10.10.0 24 11.11.11.1
[R3]ip route-static 10.10.10.0 24 22.22.22.1
[R3]ip route-static 11.11.11.0 24 22.22.22.1
[R3]
这样两台电脑就能通讯了。

第一次PING,前面有丢包的现象,那是因为,路由器要有一个学习ARP的过程。
用trace命令测试route
tracert 192.168.1.10

我们一起学习智能化技术,欢迎转发、关注、收藏!
关键词:静态路由完成异地的两幢楼内不同电脑间互访、通信