首页 > 解决方案 > 无法通过 IPSec 跨 GRE 隧道 ping 远程主机

问题描述

我需要在 IPSec 上设置 GRE 隧道以支持多播,同时加密我的通信。

我设法在 EC2 中设置了 IPSec 隧道(strongswan)。我可以 ping 远程主机,并验证一切正常。

我尝试通过 IPSec 隧道配置 GRE,尽管接口已启动且配置看起来不错,但我无法访问远程主机。

我已经编辑了我的安全组的入站规则以允许 GRE、AH 和 ESP 协议、UDP 端口 4500 和 500 以及 ICMP 协议。

IPSec隧道

My IP: 10.0.0.1
Theirs: 10.0.0.2

GRE隧道

My IP: 10.244.251.210
Theirs: 10.244.251.209
Subnet: 10.244.251.208/30

/etc/网络/接口

auto tun0
iface tun0 inet static
address 10.244.251.210
netmask 255.255.255.252
pre-up ip tunnel add tun0 mode gre local 10.0.0.1 remote 10.0.0.2 ttl 255
up ip link set tun0 multicast on
up ip link set tun0 up
up ip addr add 10.244.251.210/30 dev tun0

ubuntu:~$ ip 路由

default via 172.10.0.1 dev eth0
10.244.251.208/30 dev tun0  proto kernel  scope link  src 10.244.251.210

ubuntu:~$ ip 地址

5: tun0@NONE: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 8977 qdisc noqueue state UNKNOWN group default qlen 1
    link/gre 10.0.0.1 peer 10.0.0.2
    inet 10.244.251.210/30 brd 10.244.251.211 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::5efe:af4:f68a/64 scope link
       valid_lft forever preferred_lft forever

你看到什么错误或遗漏了吗?

谢谢,亚历克斯。

标签: linuxamazon-ec2vpntunnelipsec

解决方案


推荐阅读