本文主要是介绍华为路由器AR2220简单的静态路由配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
简单的静态路由配置
- 配置静态路由命令
- R1的配置
- R2的配置
- 测试PC的连通Ping
配置静态路由命令
主要命令
interface G0/0/1 //进入端口G0/0/1
ip add 10.1.1.1 24 //配置目前端口的ip地址为 10.1.1.1.1子网掩24位
ip route-staic 30.1.1.0 24 20.1.1.2 //添加静态IP条目 :目的ip30.1.1.0 掩码 24 下一跳 :20.1.1.2
R1的配置
The device is running!<Huawei>sys //进入系统模式
Enter system view, return user view with Ctrl+Z.[Huawei]interface G0/0/0 //进入G0/0/1端口
[Huawei-GigabitEthernet0/0/0]ip add 20.1.1.1 24 //为该端口设置IP地址 20.1.1.1
Jun 16 2020 21:14:06-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocolIP on the interface GigabitEthernet0/0/0 has entered the UP state. //设置成功
[Huawei-GigabitEthernet0/0/0]q //退出当前端口
[Huawei]interface G0/0/1 // 进入G0/0/1端口
[Huawei-GigabitEthernet0/0/1]ip add 10.1.1.254 24 //设置IP
Jun 16 2020 21:14:41-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocolIP on the interface GigabitEthernet0/0/1 has entered the UP state. //设置成功
[[Huawei-GigabitEthernet0/0/1]q //退出[Huawei]ip route-static 30.1.1.0 24 20.1.1.2
//添加静态路由条目 目的ip: 30.1.1.0 (0)表示广播地址 掩码 24 位 下一跳 20.1.1.2
R2的配置
The device is running!<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]interface G0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 20.1.1.2 24
Jun 16 2020 21:15:30-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocolIP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface G0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 30.1.1.254 24
Jun 16 2020 21:16:00-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocolIP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]
[Huawei]ip route-static 10.1.1.0 24 20.1.1.1
测试PC的连通Ping
用PC1 ping PC2 成功
OK!
PC>ping 30.1.1.1Ping 30.1.1.1: 32 data bytes, Press Ctrl_C to break
From 30.1.1.1: bytes=32 seq=1 ttl=126 time=15 ms
From 30.1.1.1: bytes=32 seq=2 ttl=126 time=15 ms
From 30.1.1.1: bytes=32 seq=3 ttl=126 time=15 ms
From 30.1.1.1: bytes=32 seq=4 ttl=126 time=15 ms
From 30.1.1.1: bytes=32 seq=5 ttl=126 time=15 ms--- 30.1.1.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/15/15 msPC>
PC2 ping PC1 OK
哈拉少~ ~
PC>ping 10.1.1.1Ping 10.1.1.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 10.1.1.1: bytes=32 seq=2 ttl=126 time=15 ms
From 10.1.1.1: bytes=32 seq=3 ttl=126 time=31 ms
From 10.1.1.1: bytes=32 seq=4 ttl=126 time=16 ms
From 10.1.1.1: bytes=32 seq=5 ttl=126 time=16 ms--- 10.1.1.1 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/19/31 msPC>
这篇关于华为路由器AR2220简单的静态路由配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!