从本地 linux ,我尝试检查 vpn 状态。
为什么详细状态不进行?为什么状态仍然是“FIRST_HANDSHAKE”?
共享密钥和 TargetIP 没有错。
$ gcloud compute vpn-tunnels describe gvis-vpn-tunnel
回声就在这里。
creationTimestamp: '2020-07-28T15:05:44.541-07:00'
description: ''
detailedStatus: Allocating resources. VPN tunnel will start soon.
id:'2892217179569987543'
ikeVersion: 2
kind: compute#vpnTunnel
:
region: https://www.googleapis.com/compute/v1/projects/[project-id]/regions/us-east1
:
sharedSecret: '*************'
:
status: FIRST_HANDSHAKE
targetVpnGateway: https://www.googleapis.com/compute/v1/projects/[project-id]/regions/us-east1/targetVpnGateways/gvis-vpn
更新
上周,我可以连接 VPN 隧道。从这个星期一开始,无法连接,我看到日志如下:
2020-07-28T22:45:04.831987016Z initiating IKE_SA vpn_58.xxx.xxx.xxx[779] to 58.xxx.xxx.xxx
2020-07-28T22:45:04.758749637Z creating acquire job for policy with reqid {1}
2020-07-28T22:45:02.148478373Z sending packet: from 35.xxx.xxx.xxx[4500] to 58.xxx.xxx.xxx[4500] (80 bytes)
2020-07-28T22:45:02.148478373Z generating INFORMATIONAL request 2 [ N(AUTH_FAILED) ]
2020-07-28T22:45:02.148478373Z tried 1 shared key for '35.xxx.xxx.xxx' - '58.xxx.xxx.xxx', but MAC mismatched
2020-07-28T22:45:02.148478373Z parsed IKE_AUTH response 1 [ IDr AUTH N(ESP_TFC_PAD_N) N(NON_FIRST_FRAG) SA TSi TSr ]
2020-07-28T22:45:02.105535147Z received packet: from 58.xxx.xxx.xxx[4500] to 35.xxx.xxx.xxx[4500] (256 bytes)
2020-07-28T22:45:02.029020541Z sending packet: from 35.xxx.xxx.xxx[4500] to 58.xxx.xxx.xxx[4500] (336 bytes)
2020-07-28T22:45:02.029020541Z generating IKE_AUTH request 1 [ IDi AUTH SA TSi TSr N(EAP_ONLY) ]
2020-07-28T22:45:02.029020541Z establishing CHILD_SA vpn_58.xxx.xxx.xxx{1}
2020-07-28T22:45:02.029020541Z authentication of '35.xxx.xxx.xxx' (myself) with pre-shared key
2020-07-28T22:45:02.029020541Z remote host is behind NAT
2020-07-28T22:45:02.029020541Z parsed IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) ]
2020-07-28T22:45:01.933846400Z received packet: from 58.xxx.xxx.xxx[500] to 35.xxx.xxx.xxx[500] (464 bytes)
2020-07-28T22:45:01.819625244Z sending packet: from 35.xxx.xxx.xxx[500] to 58.xxx.xxx.xxx[500] (892 bytes)
2020-07-28T22:45:01.819625244Z generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) ]
自 2019 年 12 月以来,预共享密钥是相同的。每天,当我想连接时,像这样制作 vpn-tunnel,
gcloud compute vpn-tunnels create [my-vpn-tunnel] \
--peer-address 58.xxx.xxx.xxx \
--ike-version 2 \
--shared-secret [Pre-shared key] \
--local-traffic-selector=192.xxx.100.0/24 \
--remote-traffic-selector=172.xx.xx.0/24,192.xxx.10.0/24 \
--target-vpn-gateway [my-vpn] \
--region us-east1 \
--project [project-id]
当我断开连接时,像这样删除 vpn-tunnel,
gcloud compute vpn-tunnels delete [my-vpn-tunnel] --region=us-east1
我一直在我的 linux shell 脚本上使用 gcloud。