【发布时间】:2016-03-30 04:18:24
【问题描述】:
我正在尝试在两个 AWS 区域(俄勒冈州和爱尔兰)之间设置 VPN。在俄勒冈地区,我使用了 AWS VPN 服务,在爱尔兰,我使用了市场上的 vyos EC2 实例。 在俄勒冈州,我启动了一个实例并为 ICMP 请求打开了它的安全组(0.0.0.0/0 用于测试)。我的 Vyos 实例的安全组也已打开。
VPN 双方都已启动,但我有一个奇怪的问题。
测试1:
从 EC2-Oregon ping 到 EC2-Vyos:工作
测试2:
从 EC2-Vyos 到 EC2-Oregon 的 Ping:不工作
但是如果我在 EC2-Oregon 上启动了一个 wireshark,我看到了 ICMP 请求,问题似乎出在 ICMP 回复上:
11.609958 169.254.12.138 -> 10.10.2.45 ICMP 98 Echo (ping) request id=0x2f3d, seq=1/256, ttl=63
11.929702 10.0.1.177 -> 10.10.2.45 ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
12.610213 169.254.12.138 -> 10.10.2.45 ICMP 98 Echo (ping) request id=0x2f3d, seq=2/512, ttl=63
12.929659 10.0.1.177 -> 10.10.2.45 ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
13.610111 169.254.12.138 -> 10.10.2.45 ICMP 98 Echo (ping) request id=0x2f3d, seq=3/768, ttl=63
13.929952 10.0.1.177 -> 10.10.2.45 ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
IPs Informations:
10.0.1.177: EC2-Vyos
10.10.2.45: EC2-Oregon
169.254.12.138: The IP of my vti1 in the Vyos conf
测试3:
将爱尔兰的另一个 EC2 实例 ping 到 EC2-Oregon:不工作
但是在 EC2-Oregon 实例上,我又看到了一次 ICMP 请求(10.2.10 是我在爱尔兰的 EC2 实例):
0.361551 10.0.2.10 -> 10.10.2.45 ICMP 98 Echo (ping) request id=0x130d, seq=4/1024, ttl=62
0.361569 10.10.2.45 -> 10.0.2.10 ICMP 98 Echo (ping) reply id=0x130d, seq=4/1024, ttl=64
0.627332 10.0.1.177 -> 10.10.2.45 ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
1.369717 10.0.2.10 -> 10.10.2.45 ICMP 98 Echo (ping) request id=0x130d, seq=5/1280, ttl=62
我不明白问题出在哪里。
我的 vyos 配置:
interfaces {
ethernet eth0 {
address dhcp
duplex auto
hw-id 0a:14:25:f4:8f:e9
smp_affinity auto
speed auto
}
loopback lo {
}
vti vti0 {
address 169.254.12.62/30
description "VPC tunnel 1"
mtu 1436
}
vti vti1 {
address 169.254.12.138/30
description "VPC tunnel 2"
mtu 1436
}
}
protocols {
bgp 65000 {
neighbor 169.254.12.61 {
remote-as 7224
soft-reconfiguration {
inbound
}
timers {
holdtime 30
keepalive 30
}
}
neighbor 169.254.12.137 {
remote-as 7224
soft-reconfiguration {
inbound
}
timers {
holdtime 30
keepalive 30
}
}
network 10.0.0.0/16 {
}
}
static {
route 10.0.0.0/16 {
next-hop 10.0.1.1 {
}
}
}
}
service {
ssh {
disable-password-authentication
port 22
}
}
system {
config-management {
commit-revisions 20
}
console {
device ttyS0 {
speed 9600
}
}
host-name VyOS-AMI
login {
user vyos {
authentication {
encrypted-password "*"
public-keys aws_key-XXXXXX {
key AAAAB3....
type ssh-rsa
}
}
level admin
}
}
ntp {
server 0.pool.ntp.org {
}
server 1.pool.ntp.org {
}
server 2.pool.ntp.org {
}
}
package {
auto-sync 1
repository community {
components main
distribution helium
password ""
url http://packages.vyos.net/vyos
username ""
}
}
syslog {
global {
facility all {
level notice
}
facility protocols {
level debug
}
}
}
time-zone UTC
}
vpn {
ipsec {
esp-group AWS {
compression disable
lifetime 3600
mode tunnel
pfs enable
proposal 1 {
encryption aes128
hash sha1
}
}
ike-group AWS {
dead-peer-detection {
action restart
interval 15
timeout 30
}
key-exchange ikev1
lifetime 28800
proposal 1 {
dh-group 2
encryption aes128
hash sha1
}
}
ipsec-interfaces {
interface eth0
}
nat-traversal enable
site-to-site {
peer 52.XX.XXX.113 {
authentication {
id 52.XX.XXX.132
mode pre-shared-secret
pre-shared-secret 7bRiFaXXXXXX
remote-id 52.XX.XXX.113
}
connection-type initiate
description "VPC tunnel 1"
ike-group AWS
local-address 10.0.1.177
vti {
bind vti0
esp-group AWS
}
}
peer 54.186.XXX.33 {
authentication {
id 52.XX.XXX.132
mode pre-shared-secret
pre-shared-secret AT2Q4XXXXXXXXXX
remote-id 54.XXX.XXX.33
}
connection-type initiate
description "VPC tunnel 2"
ike-group AWS
local-address 10.0.1.177
vti {
bind vti1
esp-group AWS
}
}
}
}
}
更新:
问题解决了。
您可以在此 repo https://github.com/mboret/aws-vyos 上找到配置过程的整个(工作)
【问题讨论】:
-
俄勒冈地区的 VPN 是否禁用了源/目标检查?
-
不,我已在我的 Vyos 实例上禁用,而不是在俄勒冈州的 EC2 实例上禁用。
-
EC2 实例是指俄勒冈州的 VPN 实例吗?还是俄勒冈州的其他一些测试实例?