华为路由器:静态路由实现跨网段

一、实验环境

华为路由器:静态路由实现跨网段_第1张图片

二、配置R1

路由器改名R1
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R1

给R1的lan口配置网段和网关

[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]ip add	
[R1-GigabitEthernet0/0/1]ip address 192.168.1.254 24
[R1-GigabitEthernet0/0/1]q

给R1的wan口添加静态路由

[R1]int s2/0/0
[R1-Serial2/0/0]ip add	
[R1-Serial2/0/0]ip address 202.196.1.1 24
[R1-Serial2/0/0]q	
[R1]ip route-static 192.168.2.0 255.255.255.0 202.196.2.1
[R1]

三、配置R2

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn	
[Huawei]sysname R2     #改名
[R2]
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add	
[R2-GigabitEthernet0/0/0]ip address 192.168.2.254 24    #给g0/0/0接口配置网关


[R2-GigabitEthernet0/0/0]int s2/0/0
[R2-Serial2/0/0]ip address 202.196.2.1 24    #给s2/0/0接口配置IP
[R2-Serial2/0/0]q

[R2]ip route-static 192.168.1.0 255.255.255.0 202.196.1.1    #给R2添加静态路由
[R2]

四、验证

在PC1上面pingPC2

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.1: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.2.1: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.2.1: bytes=32 seq=4 ttl=126 time=16 ms
From 192.168.2.1: bytes=32 seq=5 ttl=126 time=15 ms

你可能感兴趣的:(HCIE)