

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 对 Yamaha 客户网关设备的 AWS Site-to-Site VPN 连接进行故障排除
<a name="Yamaha_Troubleshooting"></a>

对雅马哈客户网关设备的连接进行故障排除时，请考虑四件事：IKE、 IPsec、隧道和 BGP。您可以按任何次序对这些方面进行故障排除，不过建议您从 IKE 开始（位于网络堆栈的底部）并依次向上排除。

**注意**  
IKE 的第 2 阶段中使用的 `proxy ID` 设置在 Yamaha 路由器上默认处于禁用状态。这可能会导致连接到 Site-to-Site VPN 时出现问题。如果您的路由器上未配置，请查看 AWS提供的 Yamaha 示例配置文件以进行正确设置。`proxy ID`

## IKE
<a name="YamahaIKE"></a>

运行如下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
# show ipsec sa gateway 1
```

```
sgw  flags local-id                      remote-id        # of sa
--------------------------------------------------------------------------
1    U K   YOUR_LOCAL_NETWORK_ADDRESS     72.21.209.225    i:2 s:1 r:1
```

您应该可以看到包含隧道中所指定远程网关的 `remote-id` 值的行。您可以通过省略隧道号来列出所有安全关联 (SAs)。

如需进一步排查问题，请运行下面的命令，启用可提供诊断信息的 DEBUG 级日志消息。

```
# syslog debug on
# ipsec ike log message-info payload-info key-info
```

要取消记录项，请运行下面的命令。

```
# no ipsec ike log
# no syslog debug on
```

## IPsec
<a name="YamahaIPsec"></a>

运行如下命令。响应显示 IPsec配置正确的客户网关设备。

```
# show ipsec sa gateway 1 detail
```

```
SA[1] Duration: 10675s
Local ID: YOUR_LOCAL_NETWORK_ADDRESS
Remote ID: 72.21.209.225
Protocol: IKE
Algorithm: AES-CBC, SHA-1, MODP 1024bit

SPI: 6b ce fd 8a d5 30 9b 02 0c f3 87 52 4a 87 6e 77 
Key: ** ** ** ** **  (confidential)   ** ** ** ** **
----------------------------------------------------
SA[2] Duration: 1719s
Local ID: YOUR_LOCAL_NETWORK_ADDRESS
Remote ID: 72.21.209.225
Direction: send
Protocol: ESP (Mode: tunnel)
Algorithm: AES-CBC (for Auth.: HMAC-SHA)
SPI: a6 67 47 47 
Key: ** ** ** ** **  (confidential)   ** ** ** ** **
----------------------------------------------------
SA[3] Duration: 1719s
Local ID: YOUR_LOCAL_NETWORK_ADDRESS
Remote ID: 72.21.209.225
Direction: receive
Protocol: ESP (Mode: tunnel)
Algorithm: AES-CBC (for Auth.: HMAC-SHA)
SPI: 6b 98 69 2b 
Key: ** ** ** ** **  (confidential)   ** ** ** ** **
----------------------------------------------------
SA[4] Duration: 10681s
Local ID: YOUR_LOCAL_NETWORK_ADDRESS
Remote ID: 72.21.209.225
Protocol: IKE
Algorithm: AES-CBC, SHA-1, MODP 1024bit
SPI: e8 45 55 38 90 45 3f 67 a8 74 ca 71 ba bb 75 ee 
Key: ** ** ** ** **  (confidential)   ** ** ** ** **
----------------------------------------------------
```

对于每个隧道接口，您应该可以看到 `receive sas` 和 `send sas`。

如需进一步排除故障，请使用下面的命令启用调试。

```
# syslog debug on
# ipsec ike log message-info payload-info key-info
```

运行下面的命令以禁用调试。

```
# no ipsec ike log
# no syslog debug on
```

## 隧道
<a name="YamahaTunnel"></a>

首先，检查必要的防火墙规则是否已布置到位。有关规则列表，请参阅[AWS Site-to-Site VPN 客户网关设备的防火墙规则](FirewallRules.md)。

如果您的防火墙规则设置正确，则请使用下面的命令继续排除故障。

```
# show status tunnel 1
```

```
TUNNEL[1]: 
Description: 
  Interface type: IPsec
  Current status is Online.
  from 2011/08/15 18:19:45.
  5 hours 7 minutes 58 seconds  connection.
  Received:    (IPv4) 3933 packets [244941 octets]
               (IPv6) 0 packet [0 octet]
  Transmitted: (IPv4) 3933 packets [241407 octets]
               (IPv6) 0 packet [0 octet]
```

确保`current status`值在线，也`Interface type`就是说 IPsec。确保在两个隧道接口上运行命令。如需在此解决任何问题，请核查配置。

## BGP
<a name="YamahaBGP"></a>

运行如下命令。

```
# show status bgp neighbor
```

```
BGP neighbor is 169.254.255.1, remote AS 7224, local AS 65000, external link
  BGP version 0, remote router ID 0.0.0.0
  BGP state = Active
  Last read 00:00:00, hold time is 0, keepalive interval is 0 seconds
  Received 0 messages, 0 notifications, 0 in queue
  Sent 0 messages, 0 notifications, 0 in queue
  Connection established 0; dropped 0
  Last reset never
Local host: unspecified
Foreign host: 169.254.255.1, Foreign port: 0

BGP neighbor is 169.254.255.5, remote AS 7224, local AS 65000, external link
  BGP version 0, remote router ID 0.0.0.0
  BGP state = Active
  Last read 00:00:00, hold time is 0, keepalive interval is 0 seconds
  Received 0 messages, 0 notifications, 0 in queue
  Sent 0 messages, 0 notifications, 0 in queue
  Connection established 0; dropped 0
  Last reset never
Local host: unspecified
Foreign host: 169.254.255.5, Foreign port:
```

两个邻系统均已列出。对于每个系统，您应看到 `BGP state` 值为 `Active`。

如果 BGP 对等体已运行，请验证您的客户网关设备正在向 VPC 通告默认路由 (0.0.0.0/0)。

```
# show status bgp neighbor {{169.254.255.1}} advertised-routes 
```

```
Total routes: 1
*: valid route
  Network            Next Hop        Metric LocPrf Path
* default            0.0.0.0              0        IGP
```

另外，确保您正在从虚拟私有网关接收对应于您的 VPC 的前缀。

```
# show ip route
```

```
Destination         Gateway          Interface       Kind  Additional Info.
default             ***.***.***.***   LAN3(DHCP)    static  
10.0.0.0/16         169.254.255.1    TUNNEL[1]       BGP  path=10124
```