一 构建拓扑图
二 配置PCipv4地址
pc1
pc2
三 配置路由器
静态路由简介
/系统视图下,配置R1到不同网段的静态路由
[R1]ip route-static 192.168.20.0 24 172.16.16.2
/目的网段、子网掩码、下一跳地址
注:结合拓扑图思考,思路更清晰。
AR1
配置端口IP地址
sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname R1 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.10.1 24 [R1-GigabitEthernet0/0/0]quit [R1]int g0/0/1 [R1-GigabitEthernet0/0/1]ip add 172.16.16.1 24
静态路由
[R1]ip route-static 192.168.20.0 24 172.16.16.2 [R1]quit save The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait… Configuration file had been saved successfully Note: The configuration file will take effect after being activated
AR2
配置端口IP地址
sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname R2 [R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ip add 192.168.20.1 24 [R2-GigabitEthernet0/0/0]quit [R2]int g0/0/1 [R2-GigabitEthernet0/0/1]ip add 172.16.16.2 24
静态路由
[R2]ip route-static 192.168.10.0 24 172.16.16.1 [R2]quit save The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait… Configuration file had been saved successfully Note: The configuration file will take effect after being activated
四 查看路由表
ping操作
pc1 ping pc2
pc2 ping pc1
五 路由追踪
pc2 追踪 pc1
六 总结
pc网关一定要配置,静态路由的三个关键一定不要混淆,目的网段、子网掩码和下一跳地址。多结合拓扑图思考,思路理清晰,效果更好。
|