点赞收藏关注,谢谢大家。
r1配置:
<Huawei>sys //进入系统视图
[Huawei]sys r1 //更改名称为r1
[r1]int g0/0/0 //进入g0/0/0接口
[r1-GigabitEthernet0/0/0]ip add 100.64.88.1 24 //配置ip地址
[r1-GigabitEthernet0/0/0]int g0/0/1 //进入g0/0/1接口
[r1-GigabitEthernet0/0/1]ip add 192.168.1.254 24 //配置ip地址
[r1-GigabitEthernet0/0/1]q //退一层
[r1]ip route-static 0.0.0.0 0 100.64.88.2 //配置缺省路由
[r1]acl number 2000 //访问控制列表
[r1-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255 //设置允许此ip通过
r1-acl-basic-2000]q //退一层
[r1]int g0/0/0 //进入g0/0/0接口
[r1-GigabitEthernet0/0/0]nat outbound 2000 //配置将私有地址转换为公有地址
[r1-GigabitEthernet0/0/0]q //退一层
[r1]int t0/0/0 //进入tunnel接口
[r1-Tunnel0/0/0]ip add 40.1.1.1 24 //设置ip地址
[r1-Tunnel0/0/0]tunnel-protocol gre //配置tunnel接口的隧道协议
[r1-Tunnel0/0/0]source 100.64.88.1 //配置源接口
[r1-Tunnel0/0/0]destination 200.64.88.3 //配置对端接口ip
[r1-Tunnel0/0/0]q //退一层
[r1]ip route-static 192.168.2.0 24 t0/0/0 //配置路由
[r1]int t0/0/0 //进入tunnel接口
[r1-Tunnel0/0/0]keepalive period 3 //在GRE隧道接口启用Keepalive检测功能
[r1-Tunnel0/0/0]q //退一层
r3和r1配置基本一样,这里不在进行解释,如有看不懂请看r1。
r2配置:
<Huawei>sys
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 100.64.88.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 200.64.88.2 24
[r2-GigabitEthernet0/0/1]q
r3配置:
<Huawei>sys
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 200.64.88.3 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.2.254 24
[r3-GigabitEthernet0/0/1]q
[r3]ip route-static 0.0.0.0 0 200.64.88.2
[r3]acl number 2000
[r3-acl-basic-2000]rule 5 permit source 192.168.2.0 0.0.0.255
[r3-acl-basic-2000]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]nat outbound 2000
[r3-GigabitEthernet0/0/0]q
[r3]int t0/0/0
[r3-Tunnel0/0/0]ip add 40.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre
[r3-Tunnel0/0/0]source 200.64.88.3
[r3-Tunnel0/0/0]destination 100.64.88.1
[r3-Tunnel0/0/0]q
[r3]ip route-static 192.168.1.0 24 t0/0/0
[r3]int t0/0/0
[r3-Tunnel0/0/0]keepalive period 3
[r3-Tunnel0/0/0]q
[r3]dis int t0/0/0
Tunnel0/0/0 current state : UP
Line protocol current state : UP
Last line protocol up time : 2024-01-10 16:58:09 UTC-08:00
Description:HUAWEI, AR Series, Tunnel0/0/0 Interface
Route Port,The Maximum Transmit Unit is 1500
Internet Address is 40.1.1.3/24
Encapsulation is TUNNEL, loopback not set
Tunnel source 200.64.88.3 (GigabitEthernet0/0/0), destination 100.64.88.1
Tunnel protocol/transport GRE/IP, key disabled
keepalive enable period 3 retry-times 3
Checksumming of packets disabled
Current system time: 2024-01-10 17:08:39-08:00
300 seconds input rate 0 bits/sec, 0 packets/sec
300 seconds output rate 120 bits/sec, 0 packets/sec
0 seconds input rate 0 bits/sec, 0 packets/sec
0 seconds output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes
0 input error
199 packets output, 9852 bytes
0 output error
Input bandwidth utilization : --
Output bandwidth utilization : --