我正在尝试为大型电信公司设置站点到站点 VPN。
我们在 AWS 中运行 VyOS 1.1.7;他们使用的是 Cisco ASA 5520。
由于电信公司很大,而我们很小,他们已经为我们规定了所有必需的设置,并且不太可能代表我们进行任何更改。此外,从中获取日志文件或更多配置信息可能很乏味。
从他们的角度来看,他们希望为所有应用程序流量 (http) 将我们的单个静态 IP 列入白名单。因此,我们向它们发起的任何连接都必须看起来好像来自我们的静态 IP,无论我们内部网络架构的其余部分是什么样子。所以我们使用NAT来满足这个需求。
无论如何,我们可以成功地与它们建立 IKEv1 连接以及 ESP 连接,并且 ICMP 和 TCP 流量都可以双向流动。我们可以 ping 他们,他们可以 ping 我们,并且到我们的应用程序服务器的入站 http 流量也可以工作。
对我来说,这意味着我们的 AWS 安全策略配置正确,我们的防火墙规则正常,我们的 VPN 设置匹配,并且我们的子网路由也能正常工作。
问题是,在很短的时间后,比如大约 10 分钟,从电信公司的角度来看,我们不再可用。
在我们这边,从的输出show vpn ipsec sa表明隧道都还在运行:
vyos@VPN-FW01:~$ show vpn ipsec sa
Peer ID / IP Local ID / IP
------------ -------------
<TELCO IP> <MY IP>
Tunnel State Bytes Out/In Encrypt Hash NAT-T A-Time L-Time Proto
------ ----- ------------- ------- ---- ----- ------ ------ -----
1 up 0.0/0.0 aes128 sha1 no 2153 28800 all
2 up 0.0/0.0 aes128 sha1 no 1964 28800 all
3 up 0.0/0.0 aes128 sha1 no 1906 28800 all
4 up 0.0/0.0 aes128 sha1 no 1864 28800 all
但是正如您所看到的,隧道中没有任何流量通过。
日志文件中似乎也没有任何信息。的输出show log有许多如下所示的条目:
Jun 17 11:46:06 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-1" #347: sent QI2, IPsec SA established {ESP=>0x1e15be1f <0xc9355ae4}
Jun 17 11:54:26 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-1" #14: received Delete SA payload: replace IPSEC State #338 in 10 seconds
Jun 17 11:54:36 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-2" #348: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP to replace #338 {using isakmp#14}
Jun 17 11:54:36 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-2" #348: sent QI2, IPsec SA established {ESP=>0xa48e62c1 <0xc67eaa07}
Jun 17 12:02:26 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-1" #14: received Delete SA payload: replace IPSEC State #332 in 10 seconds
Jun 17 12:02:36 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-3" #349: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP to replace #332 {using isakmp#14}
Jun 17 12:02:36 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-3" #349: sent QI2, IPsec SA established {ESP=>0xe0d44968 <0xccc1945f}
Jun 17 12:03:56 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-1" #14: received Delete SA payload: replace IPSEC State #333 in 10 seconds
Jun 17 12:04:06 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-4" #350: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP to replace #333 {using isakmp#14}
Jun 17 12:04:06 VPN-FW01 pluto[18897]: "peer-TELCO-IP-tunnel-4" #350: sent QI2, IPsec SA established {ESP=>0xad009d57 <0xc8b2287d}
但没有其他错误或任何东西。
tcpdump在我们这边使用也没有显示任何信息。许多如下所示的条目,以及典型的 ARP 流量、NTP 等。
TELCO-IP.isakmp > ip-MY-IP.ec2.internal.isakmp: isakmp 1.0 msgid dd22ed6d: phase 2/others ? inf[E]: [encrypted hash]
12:06:59.148180 IP (tos 0x0, ttl 64, id 2672, offset 0, flags [DF], proto UDP (17), length 120)
ip-MY-IP.ec2.internal.isakmp > TELCO-IP.isakmp: isakmp 1.0 msgid f8f1d9ba: phase 2/others ? inf[E]: [encrypted hash]
12:07:19.147638 IP (tos 0x0, ttl 234, id 31559, offset 0, flags [none], proto UDP (17), length 120)
但是我们再也看不到传入的 ping 和 http 流量了。
有趣的一点是,如果我们从我们这边 ping 电信公司的子网,那么传入的流量,包括 http,在下降之前会再运行大约 10 分钟。
有什么线索吗?
我的 VyOS 配置在这里:
firewall {
all-ping enable
broadcast-ping disable
config-trap disable
group {
address-group TELCO-HOSTS {
address 192.xx.yy.38
address 192.xx.yy.39
address 192.xx.yy.40
address 192.xx.yy.41
}
}
ipv6-receive-redirects disable
ipv6-src-route disable
ip-src-route disable
log-martians enable
name eth0in {
default-action reject
rule 20 {
action accept
description "accept ICMP pings"
icmp {
type-name echo-request
}
protocol icmp
}
rule 30 {
action accept
destination {
port 22
}
protocol tcp
}
rule 40 {
action accept
description "accept all internal traffic"
source {
address 10.113.0.0/16
}
}
rule 50 {
action accept
description "accept expected tunneled TCP traffic from TELCO"
destination {
port 5101,8310,8443,8080,9101,9107,9109
}
protocol tcp
source {
group {
address-group TELCO-HOSTS
}
}
}
rule 200 {
action drop
}
}
name eth0out {
default-action accept
}
receive-redirects disable
send-redirects enable
source-validation disable
state-policy {
established {
action accept
}
invalid {
action drop
}
related {
action accept
}
}
syn-cookies enable
twa-hazards-protection disable
}
interfaces {
ethernet eth0 {
address dhcp
duplex auto
firewall {
in {
name eth0in
}
out {
name eth0out
}
}
hw-id 0a:d2:b0:8e:53:f3
smp_affinity auto
speed auto
}
loopback lo {
}
}
nat {
source {
rule 10 {
description "US to TELCO"
destination {
address 192.xx.yy.0/24
}
outbound-interface eth0
translation {
address <MY-APP-SERVER>
}
}
rule 500 {
description "US to anywhere else"
outbound-interface eth0
source {
address 10.113.0.0/16
}
translation {
address masquerade
}
}
}
}
service {
ssh {
disable-password-authentication
port 22
}
}
vpn {
ipsec {
esp-group ESP {
compression disable
lifetime 28800
mode tunnel
pfs enable
proposal 1 {
encryption aes128
hash sha1
}
}
ike-group IKE {
key-exchange ikev1
lifetime 86400
proposal 1 {
dh-group 5
encryption aes256
hash sha1
}
}
ipsec-interfaces {
interface eth0
}
site-to-site {
peer <TELCO-STATIC-IP> {
authentication {
mode pre-shared-secret
pre-shared-secret ****************
}
connection-type initiate
ike-group IKE
local-address <MY-IP>
tunnel 1 {
allow-nat-networks disable
allow-public-networks disable
esp-group ESP
local {
prefix 10.113.0.0/24
}
remote {
prefix 192.xx.yy.38/32
}
}
tunnel 2 {
allow-nat-networks disable
allow-public-networks disable
esp-group ESP
local {
prefix 10.113.0.0/24
}
remote {
prefix 192.xx.yy.39/32
}
}
tunnel 3 {
allow-nat-networks disable
allow-public-networks disable
esp-group ESP
local {
prefix 10.113.0.0/24
}
remote {
prefix 192.xx.yy.40/32
}
}
tunnel 4 {
allow-nat-networks disable
allow-public-networks disable
esp-group ESP
local {
prefix 10.113.0.0/24
}
remote {
prefix 192.xx.yy.41/32
}
}
}
}
}
}