基于gre配置vpn

基于GRE配置VPN

1.拓扑图

image-20250704111803101

2.配置R1

<Huawei>sys

[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 20.1.1.2 24

[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 20.1.2.2 24

3.配置R2

<Huawei>sys
[Huawei]sys R2

[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.1.1.1 24

[R2]interface vlanif1
[R2-Vlanif1]ip address 10.1.1.1 24

[R2]ip route-static 20.1.2.0 24 20.1.1.2

4.配置R3

<Huawei>sys
[Huawei]sys R3

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 20.1.2.1 24

[R3]int vlanif1
[R3-Vlanif1]ip address 10.1.2.1 24

[R3]ip route-static 20.1.1.0 24 20.1.2.2

5.连通性测试

image-20250704115001446

6.配置VPN-GRE

6.1.配置R2:

<R2>sys
[R2]interface Tunnel 0/0/1
[R2-Tunnel0/0/1]tunnel-protocol gre
[R2-Tunnel0/0/1]ip address 40.1.1.1 24
[R2-Tunnel0/0/1]source 20.1.1.1
[R2-Tunnel0/0/1]destination 20.1.2.1
[R2-Tunnel0/0/1]quit

[R2]ip route-static 10.1.2.0 24 Tunnel 0/0/1

6.2.配置R3:

<R3>sys

[R3]interface Tunnel 0/0/1
[R3-Tunnel0/0/1]tunnel-protocol gre
[R3-Tunnel0/0/1]ip add 40.1.1.2 24
[R3-Tunnel0/0/1]source 20.1.2.1
[R3-Tunnel0/0/1]destination 20.1.1.1
[R3-Tunnel0/0/1]quit

[R3]ip route-static 10.1.1.0 24 Tunnel 0/0/1

6.3.测试

PC1 PING通 PC2

image-20250704111703889

6.4.抓包

image-20250704112117169

image-20250704112057253

[R2]display interface GigabitEthernet 0/0/0 #可查找接口的MAC地址
[R2]display mac-address
[R2]display interface Tunnel 0/0/1
image-20250704114830953

7.名词解释

image-20250707111314030

image-20250707111402832

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注