

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

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

排查客户网关设备故障时，请务必采用结构化方法。本节的前两个主题提供了通用流程图，分别用于排查在使用配置为动态路由的设备（启用 BGP）和配置为静态路由的设备（未启用 BGP）时出现的问题。这些主题之后是针对 Cisco、Juniper 和 Yamaha 客户网关设备的特定设备故障排除指南。

除了本节中的主题外，启用 [AWS Site-to-Site VPN 日志](monitoring-logs.md)对于排查和解决 VPN 连接问题也非常有用。有关一般测试说明，另请参阅[测试 AWS Site-to-Site VPN 连接](HowToTestEndToEnd_Linux.md)。



**Topics**
+ [使用 BGP 的设备](Generic_Troubleshooting.md)
+ [不使用 BGP 的设备](Generic_Troubleshooting_noBGP.md)
+ [Cisco ASA](Cisco_ASA_Troubleshooting.md)
+ [Cisco IOS](Cisco_Troubleshooting.md)
+ [不使用 BGP 的 Cisco IOS](Cisco_Troubleshooting_NoBGP.md)
+ [Juniper JunOS](Juniper_Troubleshooting.md)
+ [Juniper ScreenOS](Juniper_ScreenOs_Troubleshooting.md)
+ [Yamaha](Yamaha_Troubleshooting.md)

**其他资源**
+ [Amazon VPC 论坛](https://repost.aws/tags/TATGuEiYydTVCPMhSnXFN6gA/amazon-vpc)

# 使用边界网关协议时排除 AWS Site-to-Site VPN 连接故障
<a name="Generic_Troubleshooting"></a>

以下示意图和表提供了有关排查使用边界网关协议 (BGP) 的客户网关设备的问题的一般指导。此外，建议您启用设备的调试特征。详情请咨询您的网关设备供应商。

![\[排查通用客户网关设备问题的流程图\]](http://docs.aws.amazon.com/zh_cn/vpn/latest/s2svpn/images/troubleshooting-cgw-flow-diagram.png)



|  |  | 
| --- |--- |
| IKE |  确定 IKE 安全关联是否存在。 交换用于建立安全关联的密钥需要 IKE IPsec 安全关联。 如果 IKE 安全关联不存在，请核查您的 IKE 配置设置。您必须按配置文件中所列内容来配置加密、身份验证、完全向前保密和模式参数。 如果存在 IKE 安全关联，请转到 “IPsec”。  | 
| IPsec |  确定是否存在 IPsec 安全关联 (SA)。 S IPsec A 就是隧道本身。查询您的客户网关设备以确定 S IPsec A 是否处于活动状态。确保您按配置文件中所列内容来配置加密、身份验证、完全向前保密和模式参数。 如果不存在 IPsec SA，请检查您的 IPsec 配置。 如果 S IPsec A 存在，请前往 “隧道”。  | 
| 隧道 |  确认所需的防火墙规则是否已设置（如需规则列表，请参见 [AWS Site-to-Site VPN 客户网关设备的防火墙规则](FirewallRules.md)）。如果存在，请继续配置。 确定是否存在通过该隧道的 IP 连通性。 隧道每一端均有如配置文件指定的 IP 地址。虚拟专用网关地址用作 BGP 邻系统的地址。从您的客户网关设备向该地址发出 ping，以确定 IP 流量是否正确加密和解密。 如果 ping 不成功，请核查您的隧道接口配置以确保配置了正确的 IP 地址。 如果 ping 成功，请继续配置“BGP”。  | 
| BGP |  确定 BGP 对等会话是否活动。 对于每条隧道，请执行以下操作： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/vpn/latest/s2svpn/Generic_Troubleshooting.html) 若隧道不处于此状态，请核查您的 BGP 配置。 如果 BGP 对等已建立，并且您正在接收和通告前缀，您的隧道即已正确配置。请确保两条隧道均处于该状态。  | 

# 在没有边界网关协议的情况下排除 AWS Site-to-Site VPN 连接故障
<a name="Generic_Troubleshooting_noBGP"></a>

以下示意图和表提供了有关排除不使用边界网关协议 (BGP) 的客户网关设备的一般指导。此外，建议您启用设备的调试特征。详情请咨询您的网关设备供应商。

![\[排除通用客户网关问题的流程图\]](http://docs.aws.amazon.com/zh_cn/vpn/latest/s2svpn/images/troubleshooting-cgw-flow-nobgp-diagram.png)



|  |  | 
| --- |--- |
| IKE |  确定 IKE 安全关联是否存在。 交换用于建立安全关联的密钥需要 IKE IPsec 安全关联。 如果 IKE 安全关联不存在，请核查您的 IKE 配置设置。您必须按配置文件中所列内容来配置加密、身份验证、完全向前保密和模式参数。 如果存在 IKE 安全关联，请转到 “IPsec”。  | 
| IPsec |  确定是否存在 IPsec 安全关联 (SA)。 S IPsec A 就是隧道本身。查询您的客户网关设备以确定 S IPsec A 是否处于活动状态。确保您按配置文件中所列内容来配置加密、身份验证、完全向前保密和模式参数。 如果不存在 IPsec SA，请检查您的 IPsec 配置。 如果 S IPsec A 存在，请前往 “隧道”。  | 
| 隧道 |  确认所需的防火墙规则是否已设置（如需规则列表，请参见 [AWS Site-to-Site VPN 客户网关设备的防火墙规则](FirewallRules.md)）。如果存在，请继续配置。 确定是否存在通过该隧道的 IP 连通性。 隧道每一端均有如配置文件指定的 IP 地址。虚拟专用网关地址用作 BGP 邻系统的地址。从您的客户网关设备向该地址发出 ping，以确定 IP 流量是否正确加密和解密。 如果 ping 不成功，请核查您的隧道接口配置以确保配置了正确的 IP 地址。 如果 ping 成功，请继续配置“静态路由”。  | 
|  静态路由  |  对于每条隧道，请执行以下操作： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/vpn/latest/s2svpn/Generic_Troubleshooting_noBGP.html) 如果隧道不处于该状态，请核查您的设备配置。 确保两条隧道均处于该状态，然后您就完成了。  | 

# 排除与 Cisco ASA 客户网关设备的 AWS Site-to-Site VPN 连接故障
<a name="Cisco_ASA_Troubleshooting"></a>

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

**重要**  
某些 Cisco ASAs 仅支持 Active/Standby 模式。使用这些 Cisco 时 ASAs，一次只能有一个活动隧道。仅在第一个隧道不可用的情况下，其他备用隧道才可用。备用隧道可能在您的日志文件中生成以下错误，您可以忽略该错误：`Rejecting IPSec tunnel: no matching crypto map entry for remote proxy 0.0.0.0/0.0.0.0/0/0 local proxy 0.0.0.0/0.0.0.0/0/0 on interface outside`。

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

使用以下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
ciscoasa# show crypto isakmp sa
```

```
   Active SA: 2
   Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 2

1   IKE Peer: AWS_ENDPOINT_1
    Type    : L2L             Role    : initiator
    Rekey   : no              State   : MM_ACTIVE
```

您应该可以看到包含隧道中所指定远程网关的 `src` 值的一行或多行。`state` 值应为 `MM_ACTIVE`，`status` 应为 `ACTIVE`。任何项的缺乏或任何项处于其他状态均表示 IKE 未正确配置。

如需进一步排除故障，请运行下面的命令以启用可提供诊断信息的日志消息。

```
router# term mon
router# debug crypto isakmp
```

要禁用调试，请使用下面的命令。

```
router# no debug crypto isakmp
```

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

使用以下命令。响应显示 IPsec配置正确的客户网关设备。

```
ciscoasa# show crypto ipsec sa
```

```
interface: outside
    Crypto map tag: VPN_crypto_map_name, seq num: 2, local addr: 172.25.50.101

      access-list integ-ppe-loopback extended permit ip any vpc_subnet subnet_mask
      local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
      remote ident (addr/mask/prot/port): (vpc_subnet/subnet_mask/0/0)
      current_peer: integ-ppe1

      #pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0
      #pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
      #pkts compressed: 0, #pkts decompressed: 0
      #pkts not compressed: 0, #pkts comp failed: 0, #pkts decomp failed: 0
      #pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
      #PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
      #send errors: 0, #recv errors: 0

      local crypto endpt.: 172.25.50.101, remote crypto endpt.: AWS_ENDPOINT_1

      path mtu 1500, ipsec overhead 74, media mtu 1500
      current outbound spi: 6D9F8D3B
      current inbound spi : 48B456A6

    inbound esp sas:
      spi: 0x48B456A6 (1219778214)
         transform: esp-aes esp-sha-hmac no compression
         in use settings ={L2L, Tunnel, PFS Group 2, }
         slot: 0, conn_id: 4710400, crypto-map: VPN_cry_map_1
         sa timing: remaining key lifetime (kB/sec): (4374000/3593)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
          0x00000000 0x00000001
    outbound esp sas:
      spi: 0x6D9F8D3B (1839172923)
         transform: esp-aes esp-sha-hmac no compression
         in use settings ={L2L, Tunnel, PFS Group 2, }
         slot: 0, conn_id: 4710400, crypto-map: VPN_cry_map_1
         sa timing: remaining key lifetime (kB/sec): (4374000/3593)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
         0x00000000 0x00000001
```

对于每个隧道接口，您应该可以看到 `inbound esp sas` 和 `outbound esp sas`。这假设已列出一个 SA（例如`spi: 0x48B456A6`），并且配置 IPsec 正确。

在 Cisco ASA 中， IPsec 只有在发送相关流量（应加密的流量）之后才会出现。为了始终保持 IPsec 活动状态，我们建议配置 SLA 监视器。SLA 监控器继续发送感兴趣的流量，使流量保持 IPsec活动状态。

你也可以使用以下 ping 命令强制你 IPsec 开始协商并继续协商。

```
ping ec2_instance_ip_address
```

```
Pinging ec2_instance_ip_address with 32 bytes of data:

Reply from ec2_instance_ip_address: bytes=32 time<1ms TTL=128
Reply from ec2_instance_ip_address: bytes=32 time<1ms TTL=128
Reply from ec2_instance_ip_address: bytes=32 time<1ms TTL=128

Ping statistics for 10.0.0.4:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),

Approximate round trip times in milliseconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
```

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

```
router# debug crypto ipsec
```

要禁用调试，请使用下面的命令。

```
router# no debug crypto ipsec
```

## 路由
<a name="ASA_Tunnel"></a>

向隧道的另一端发出 ping。如果这行得通，那么你 IPsec 应该被确定下来。如果这不起作用，请检查您的访问列表，并参考上一 IPsec 节。

如果您无法访问实例，请核查以下信息。

1. 验证是否已将访问列表配置为允许与保密图关联的流量。

   您可以使用下面的命令进行这项操作。

   ```
   ciscoasa# show run crypto
   ```

   ```
   crypto ipsec transform-set transform-amzn esp-aes esp-sha-hmac
   crypto map VPN_crypto_map_name 1 match address access-list-name
   crypto map VPN_crypto_map_name 1 set pfs
   crypto map VPN_crypto_map_name 1 set peer AWS_ENDPOINT_1 AWS_ENDPOINT_2
   crypto map VPN_crypto_map_name 1 set transform-set transform-amzn
   crypto map VPN_crypto_map_name 1 set security-association lifetime seconds 3600
   ```

1. 使用以下命令检查访问列表。

   ```
   ciscoasa# show run access-list access-list-name
   ```

   ```
   access-list access-list-name extended permit ip any vpc_subnet subnet_mask
   ```

1. 验证访问列表是否正确。以下示例访问列表允许所有流向 VPC 子网 10.0.0.0/16 的内部流量。

   ```
   access-list access-list-name extended permit ip any 10.0.0.0 255.255.0.0
   ```

1. 从 Cisco ASA 设备运行 traceroute，看看它是否到达了 Amazon 路由器（例如，*AWS\$1ENDPOINT\$11*/）。*AWS\$1ENDPOINT\$12*

   如果能访问 Amazon 路由器，则检查您在 Amazon VPC 控制台中添加的静态路由，同时检查特定实例的安全组。

1. 如需进一步排查问题，请核查配置。

## 反弹隧道接口
<a name="ASA_Tunnel-bounce"></a>

如果隧道显示正常但流量未正常传输，则反弹（禁用和重新启用）隧道接口通常可以解决连接问题。要反弹 Cisco ASA 上的隧道接口，请执行以下操作：

1. 运行以下命令：

   ```
   ciscoasa# conf t
   ciscoasa(config)# interface tunnel X  (where X is your tunnel ID)
   ciscoasa(config-if)# shutdown
   ciscoasa(config-if)# no shutdown
   ciscoasa(config-if)# end
   ```

   或者，您可以使用一行命令：

   ```
   ciscoasa# conf t ; interface tunnel X ; shutdown ; no shutdown ; end
   ```

1. 反弹接口后，检查 VPN 连接是否已重新建立，以及流量是否已正常传输。

# 排除与 Cisco IOS 客户网关设备的 AWS Site-to-Site VPN 连接故障
<a name="Cisco_Troubleshooting"></a>

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

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

使用以下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
router# show crypto isakmp sa
```

```
IPv4 Crypto ISAKMP SA
dst             src             state          conn-id slot status
192.168.37.160  72.21.209.193   QM_IDLE           2001    0 ACTIVE
192.168.37.160  72.21.209.225   QM_IDLE           2002    0 ACTIVE
```

您应该可以看到包含隧道中所指定远程网关的 `src` 值的一行或多行。`state` 应为 `QM_IDLE`，`status` 应为 `ACTIVE`。任何项的缺乏或任何项处于其他状态均表示 IKE 未正确配置。

如需进一步排除故障，请运行下面的命令以启用可提供诊断信息的日志消息。

```
router# term mon
router# debug crypto isakmp
```

要禁用调试，请使用下面的命令。

```
router# no debug crypto isakmp
```

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

使用以下命令。响应显示 IPsec配置正确的客户网关设备。

```
router# show crypto ipsec sa
```

```
interface: Tunnel1
    Crypto map tag: Tunnel1-head-0, local addr 192.168.37.160

    protected vrf: (none)
    local  ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
    remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
    current_peer 72.21.209.225 port 500
     PERMIT, flags={origin_is_acl,}
     #pkts encaps: 149, #pkts encrypt: 149, #pkts digest: 149
     #pkts decaps: 146, #pkts decrypt: 146, #pkts verify: 146
     #pkts compressed: 0, #pkts decompressed: 0
     #pkts not compressed: 0, #pkts compr. failed: 0
     #pkts not decompressed: 0, #pkts decompress failed: 0
     #send errors 0, #recv errors 0

     local crypto endpt.: 174.78.144.73, remote crypto endpt.: 72.21.209.225
     path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0
     current outbound spi: 0xB8357C22(3090512930)

     inbound esp sas:
      spi: 0x6ADB173(112046451)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 1, flow_id: Motorola SEC 2.0:1, crypto map: Tunnel1-head-0
       sa timing: remaining key lifetime (k/sec): (4467148/3189)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     inbound ah sas:

     inbound pcp sas:

     outbound esp sas:
      spi: 0xB8357C22(3090512930)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 2, flow_id: Motorola SEC 2.0:2, crypto map: Tunnel1-head-0
       sa timing: remaining key lifetime (k/sec): (4467148/3189)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     outbound ah sas:

     outbound pcp sas:

interface: Tunnel2
     Crypto map tag: Tunnel2-head-0, local addr 174.78.144.73

     protected vrf: (none)
     local  ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
     remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
     current_peer 72.21.209.193 port 500
      PERMIT, flags={origin_is_acl,}
     #pkts encaps: 26, #pkts encrypt: 26, #pkts digest: 26
     #pkts decaps: 24, #pkts decrypt: 24, #pkts verify: 24
     #pkts compressed: 0, #pkts decompressed: 0
     #pkts not compressed: 0, #pkts compr. failed: 0
     #pkts not decompressed: 0, #pkts decompress failed: 0
     #send errors 0, #recv errors 0

     local crypto endpt.: 174.78.144.73, remote crypto endpt.: 72.21.209.193
     path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0
     current outbound spi: 0xF59A3FF6(4120526838)

     inbound esp sas:
      spi: 0xB6720137(3060924727)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 3, flow_id: Motorola SEC 2.0:3, crypto map: Tunnel2-head-0
       sa timing: remaining key lifetime (k/sec): (4387273/3492)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     inbound ah sas:

     inbound pcp sas:

     outbound esp sas:
      spi: 0xF59A3FF6(4120526838)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 4, flow_id: Motorola SEC 2.0:4, crypto map: Tunnel2-head-0
       sa timing: remaining key lifetime (k/sec): (4387273/3492)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     outbound ah sas:

     outbound pcp sas:
```

对于每个隧道接口，您应该可以看到 `inbound esp sas` 和 `outbound esp sas`。假设 SA 已列出（`spi: 0xF95D2F3C`例如）`ACTIVE`，`Status`并且配置 IPsec 正确。

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

```
router# debug crypto ipsec
```

使用下面的命令禁用调试。

```
router# no debug crypto ipsec
```

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

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

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

```
router# show interfaces tun1
```

```
Tunnel1 is up, line protocol is up 
  Hardware is Tunnel
  Internet address is 169.254.255.2/30
  MTU 17867 bytes, BW 100 Kbit/sec, DLY 50000 usec, 
    reliability 255/255, txload 2/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel source 174.78.144.73, destination 72.21.209.225
  Tunnel protocol/transport IPSEC/IP
  Tunnel TTL 255
  Tunnel transport MTU 1427 bytes
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Tunnel protection via IPSec (profile "ipsec-vpn-92df3bfb-0")
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 1 packets/sec
  5 minute output rate 1000 bits/sec, 1 packets/sec
    407 packets input, 30010 bytes, 0 no buffer
    Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
```

确保 `line protocol` 已运行。检查隧道源 IP 地址、源接口和目的地分别匹配客户网关设备外部 IP 地址、接口和虚拟私有网关外部 IP 地址的隧道配置。确保 `Tunnel protection via IPSec` 已存在。在两个隧道接口上运行命令。要解决任何问题，请查看配置并检查与客户网关设备的物理连接。

另外请使用下面的命令，将 `169.254.255.1` 替换为您的虚拟专用网关的内部 IP 地址。

```
router# ping 169.254.255.1 df-bit size 1410
```

```
Type escape sequence to abort.
Sending 5, 1410-byte ICMP Echos to 169.254.255.1, timeout is 2 seconds:
Packet sent with the DF bit set
!!!!!
```

您应该可以看到五个感叹号。

如需进一步排查问题，请核查配置。

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

使用以下命令。

```
router# show ip bgp summary
```

```
BGP router identifier 192.168.37.160, local AS number 65000
BGP table version is 8, main routing table version 8
2 network entries using 312 bytes of memory
2 path entries using 136 bytes of memory
3/1 BGP path/bestpath attribute entries using 444 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory
BGP using 948 total bytes of memory
BGP activity 4/1 prefixes, 4/1 paths, scan interval 15 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
169.254.255.1   4  7224     363     323        8    0    0 00:54:21        1
169.254.255.5   4  7224     364     323        8    0    0 00:00:24        1
```

两个邻系统均已列出。对于每个系统，您应看到 `State/PfxRcd` 值为 `1`。

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

```
router# show bgp all neighbors 169.254.255.1 advertised-routes
```

```
For address family: IPv4 Unicast
BGP table version is 3, local router ID is 174.78.144.73
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
     r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Originating default network 0.0.0.0

Network             Next Hop            Metric   LocPrf Weight Path
*> 10.120.0.0/16    169.254.255.1          100        0   7224    i

Total number of prefixes 1
```

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

```
router# show ip route bgp
```

```
	10.0.0.0/16 is subnetted, 1 subnets
B       10.255.0.0 [20/0] via 169.254.255.1, 00:00:20
```

如需进一步排查问题，请核查配置。

# 排除与不使用边界网关协议的 Cisco IOS 客户网关设备的 AWS Site-to-Site VPN 连接故障
<a name="Cisco_Troubleshooting_NoBGP"></a>

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

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

使用以下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
router# show crypto isakmp sa
```

```
IPv4 Crypto ISAKMP SA
dst             src             state          conn-id slot status
174.78.144.73 205.251.233.121 QM_IDLE           2001    0 ACTIVE
174.78.144.73 205.251.233.122 QM_IDLE           2002    0 ACTIVE
```

您应该可以看到包含隧道中所指定远程网关的 `src` 值的一行或多行。`state` 应为 `QM_IDLE`，`status` 应为 `ACTIVE`。任何项的缺乏或任何项处于其他状态均表示 IKE 未正确配置。

如需进一步排除故障，请运行下面的命令以启用可提供诊断信息的日志消息。

```
router# term mon
router# debug crypto isakmp
```

要禁用调试，请使用下面的命令。

```
router# no debug crypto isakmp
```

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

使用以下命令。响应显示 IPsec配置正确的客户网关设备。

```
router# show crypto ipsec sa
```

```
interface: Tunnel1
    Crypto map tag: Tunnel1-head-0, local addr 174.78.144.73

    protected vrf: (none)
    local  ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
    remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
    current_peer 72.21.209.225 port 500
     PERMIT, flags={origin_is_acl,}
     #pkts encaps: 149, #pkts encrypt: 149, #pkts digest: 149
     #pkts decaps: 146, #pkts decrypt: 146, #pkts verify: 146
     #pkts compressed: 0, #pkts decompressed: 0
     #pkts not compressed: 0, #pkts compr. failed: 0
     #pkts not decompressed: 0, #pkts decompress failed: 0
     #send errors 0, #recv errors 0

     local crypto endpt.: 174.78.144.73, remote crypto endpt.:205.251.233.121
     path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0
     current outbound spi: 0xB8357C22(3090512930)

     inbound esp sas:
      spi: 0x6ADB173(112046451)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 1, flow_id: Motorola SEC 2.0:1, crypto map: Tunnel1-head-0
       sa timing: remaining key lifetime (k/sec): (4467148/3189)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     inbound ah sas:

     inbound pcp sas:

     outbound esp sas:
      spi: 0xB8357C22(3090512930)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 2, flow_id: Motorola SEC 2.0:2, crypto map: Tunnel1-head-0
       sa timing: remaining key lifetime (k/sec): (4467148/3189)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     outbound ah sas:

     outbound pcp sas:

interface: Tunnel2
     Crypto map tag: Tunnel2-head-0, local addr 205.251.233.122

     protected vrf: (none)
     local  ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
     remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
     current_peer 72.21.209.193 port 500
      PERMIT, flags={origin_is_acl,}
     #pkts encaps: 26, #pkts encrypt: 26, #pkts digest: 26
     #pkts decaps: 24, #pkts decrypt: 24, #pkts verify: 24
     #pkts compressed: 0, #pkts decompressed: 0
     #pkts not compressed: 0, #pkts compr. failed: 0
     #pkts not decompressed: 0, #pkts decompress failed: 0
     #send errors 0, #recv errors 0

     local crypto endpt.: 174.78.144.73, remote crypto endpt.:205.251.233.122
     path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0
     current outbound spi: 0xF59A3FF6(4120526838)

     inbound esp sas:
      spi: 0xB6720137(3060924727)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 3, flow_id: Motorola SEC 2.0:3, crypto map: Tunnel2-head-0
       sa timing: remaining key lifetime (k/sec): (4387273/3492)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     inbound ah sas:

     inbound pcp sas:

     outbound esp sas:
      spi: 0xF59A3FF6(4120526838)
       transform: esp-aes esp-sha-hmac ,
       in use settings ={Tunnel, }
       conn id: 4, flow_id: Motorola SEC 2.0:4, crypto map: Tunnel2-head-0
       sa timing: remaining key lifetime (k/sec): (4387273/3492)
       IV size: 16 bytes
       replay detection support: Y  replay window size: 128
       Status: ACTIVE

     outbound ah sas:

     outbound pcp sas:
```

对于每个隧道接口，您均应看到传入 `esp sas` 和传出 `esp sas`。这假设 SA 已列出（例如`spi: 0x48B456A6`），状态为`ACTIVE`，并且配置 IPsec 正确。

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

```
router# debug crypto ipsec
```

要禁用调试，请使用下面的命令。

```
router# no debug crypto ipsec
```

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

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

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

```
router# show interfaces tun1
```

```
Tunnel1 is up, line protocol is up 
  Hardware is Tunnel
  Internet address is 169.254.249.18/30
  MTU 17867 bytes, BW 100 Kbit/sec, DLY 50000 usec, 
    reliability 255/255, txload 2/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel source 174.78.144.73, destination 205.251.233.121
  Tunnel protocol/transport IPSEC/IP
  Tunnel TTL 255
  Tunnel transport MTU 1427 bytes
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Tunnel protection via IPSec (profile "ipsec-vpn-92df3bfb-0")
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 1 packets/sec
  5 minute output rate 1000 bits/sec, 1 packets/sec
    407 packets input, 30010 bytes, 0 no buffer
    Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
```

确保 line protocol 已运行。检查隧道源 IP 地址、源接口和目的地分别匹配客户网关设备外部 IP 地址、接口和虚拟私有网关外部 IP 地址的隧道配置。确保 `Tunnel protection through IPSec` 已存在。在两个隧道接口上运行命令。要解决任何问题，请查看配置并检查与客户网关设备的物理连接。

您也可以使用下面的命令，将 `169.254.249.18` 替换为您的虚拟专用网关的内部 IP 地址。

```
router# ping 169.254.249.18 df-bit size 1410
```

```
Type escape sequence to abort.
Sending 5, 1410-byte ICMP Echos to 169.254.249.18, timeout is 2 seconds:
Packet sent with the DF bit set
!!!!!
```

您应该可以看到五个感叹号。

### 路由
<a name="IOS_NoBGP_routing"></a>

要查看您的静态路由表，请使用下面的命令。

```
router# sh ip route static
```

```
     1.0.0.0/8 is variably subnetted
S       10.0.0.0/16 is directly connected, Tunnel1
is directly connected, Tunnel2
```

您应该可以看到通过两个隧道的 VPC CIDR 静态路由存在。如果它不存在，请添加静态路由，如下所示。

```
router# ip route 10.0.0.0 255.255.0.0 Tunnel1 track 100 
router# ip route 10.0.0.0 255.255.0.0 Tunnel2 track 200
```

### 检查 SLA 监视器
<a name="IOS_NoBGP_sla"></a>

```
router# show ip sla statistics 100
```

```
IPSLAs Latest Operation Statistics

IPSLA operation id: 100
        Latest RTT: 128 milliseconds
Latest operation start time: *18:08:02.155 UTC Wed Jul  15 2012
Latest operation return code: OK
Number of successes: 3
Number of failures: 0
Operation time to live: Forever
```

```
router# show ip sla statistics 200
```

```
IPSLAs Latest Operation Statistics

IPSLA operation id: 200
        Latest RTT: 128 milliseconds
Latest operation start time: *18:08:02.155 UTC Wed Jul  15 2012
Latest operation return code: OK
Number of successes: 3
Number of failures: 0
Operation time to live: Forever
```

`Number of successes` 的值指示 SLA 监视器是否已成功设置。

如需进一步排查问题，请核查配置。

# 使用瞻博网络 JunoS 客户网关设备进行 AWS Site-to-Site VPN 连接故障排除
<a name="Juniper_Troubleshooting"></a>

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

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

使用以下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
user@router> show security ike security-associations
```

```
Index   Remote Address  State  Initiator cookie  Responder cookie  Mode
4       72.21.209.225   UP     c4cd953602568b74  0d6d194993328b02  Main
3       72.21.209.193   UP     b8c8fb7dc68d9173  ca7cb0abaedeb4bb  Main
```

您应该可以看到包含隧道中所指定远程网关的远程地址的一行或多行。`State` 应为 `UP`。任何项的缺失或任何项处于其他状态（例如 `DOWN`）均表示 IKE 未正确配置。

如需进一步进行问题排查，请启用 IKE 跟踪选项，如示例配置信息中所推荐。然后运行下面的命令，将各种调试信息打印到屏幕上。

```
user@router> monitor start kmd
```

从外部主机上，您可以使用下面的命令检索整个日志文件。

```
scp username@router.hostname:/var/log/kmd
```

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

使用以下命令。响应显示 IPsec配置正确的客户网关设备。

```
user@router> show security ipsec security-associations
```

```
Total active tunnels: 2
ID      Gateway        Port  Algorithm        SPI      Life:sec/kb Mon vsys
<131073 72.21.209.225  500   ESP:aes-128/sha1 df27aae4 326/ unlim   -   0
>131073 72.21.209.225  500   ESP:aes-128/sha1 5de29aa1 326/ unlim   -   0
<131074 72.21.209.193  500   ESP:aes-128/sha1 dd16c453 300/ unlim   -   0
>131074 72.21.209.193  500   ESP:aes-128/sha1 c1e0eb29 300/ unlim   -   0
```

具体来说，每个网关地址您至少应该看到两行（对应远程网关）。每行开头的插入符号 (< >) 表示特定项的流量方向。在输出内容中，入站流量（“<”，从虚拟私有网关到此客户网关设备的流量）和出站流量（“>”）分别占据单独的行。

如需进一步排查问题，请启用 IKE 跟踪选项 (如需更多信息请参阅前面有关 IKE 的部分)。

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

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

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

```
user@router> show interfaces st0.1
```

```
 Logical interface st0.1 (Index 70) (SNMP ifIndex 126)
    Flags: Point-To-Point SNMP-Traps Encapsulation: Secure-Tunnel
    Input packets : 8719
    Output packets: 41841
    Security: Zone: Trust
    Allowed host-inbound traffic : bgp ping ssh traceroute
    Protocol inet, MTU: 9192
      Flags: None
      Addresses, Flags: Is-Preferred Is-Primary
      Destination: 169.254.255.0/30, Local: 169.254.255.2
```

确保 `Security: Zone` 正确，并且 `Local` 地址匹配客户网关设备隧道的内部地址。

下一步，请使用下面的命令，将 `169.254.255.1` 替换为您的虚拟专用网关的内部 IP 地址。您得到的结果看上去应该如此处所示。

```
user@router> ping 169.254.255.1 size 1382 do-not-fragment
```

```
PING 169.254.255.1 (169.254.255.1): 1410 data bytes
64 bytes from 169.254.255.1: icmp_seq=0 ttl=64 time=71.080 ms
64 bytes from 169.254.255.1: icmp_seq=1 ttl=64 time=70.585 ms
```

如需进一步排查问题，请核查配置。

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

运行如下命令。

```
user@router> show bgp summary
```

```
Groups: 1 Peers: 2 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 2          1          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
169.254.255.1          7224          9         10       0       0        1:00 1/1/1/0              0/0/0/0
169.254.255.5          7224          8          9       0       0          56 0/1/1/0              0/0/0/0
```

如需进一步排查问题，请使用下面的命令，将 `169.254.255.1` 替换为您的虚拟专用网关的内部 IP 地址。

```
user@router> show bgp neighbor 169.254.255.1
```

```
Peer: 169.254.255.1+179 AS 7224 Local: 169.254.255.2+57175 AS 65000
  Type: External    State: Established    Flags: <ImportEval Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ EXPORT-DEFAULT ] 
  Options: <Preference HoldTime PeerAS LocalAS Refresh>
  Holdtime: 30 Preference: 170 Local AS: 65000 Local System AS: 0
  Number of flaps: 0
  Peer ID: 169.254.255.1    Local ID: 10.50.0.10       Active Holdtime: 30
  Keepalive Interval: 10         Peer index: 0   
  BFD: disabled, down
  Local Interface: st0.1                            
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Restart time configured on the peer: 120
  Stale routes from peer are kept for: 300
  Restart time requested by this peer: 120
  NLRI that peer supports restart for: inet-unicast
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer supports 4 byte AS extension (peer-as 7224)
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              1
    Received prefixes:            1
    Accepted prefixes:            1
    Suppressed due to damping:    0
    Advertised prefixes:          1
Last traffic (seconds): Received 4    Sent 8    Checked 4   
Input messages:  Total 24     Updates 2       Refreshes 0     Octets 505
Output messages: Total 26     Updates 1       Refreshes 0     Octets 582
Output Queue[0]: 0
```

在此处，您应看到 `Received prefixes` 和 `Advertised prefixes` 逐个列出。上述内容应该在 `Table inet.0` 部分中。

如果 `State` 不是 `Established`，请检查 `Last State` 和 `Last Error`，了解纠正问题所需的详细信息。

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

```
user@router> show route advertising-protocol bgp 169.254.255.1
```

```
inet.0: 10 destinations, 11 routes (10 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 0.0.0.0/0               Self                                    I
```

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

```
user@router> show route receive-protocol bgp 169.254.255.1
```

```
inet.0: 10 destinations, 11 routes (10 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 10.110.0.0/16           169.254.255.1        100                7224 I
```

# 使用瞻博网络 ScreenOS 客户网关设备进行 AWS Site-to-Site VPN 连接故障排除
<a name="Juniper_ScreenOs_Troubleshooting"></a>

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

## IKE 和 IPsec
<a name="IKEIPsec"></a>

使用以下命令。响应显示带正确配置的 IKE 的客户网关设备。

```
ssg5-serial-> get sa
```

```
total configured sa: 2
HEX ID    Gateway         Port Algorithm     SPI      Life:sec kb Sta   PID vsys
00000002<   72.21.209.225  500 esp:a128/sha1 80041ca4  3385 unlim A/-    -1 0
00000002>   72.21.209.225  500 esp:a128/sha1 8cdd274a  3385 unlim A/-    -1 0
00000001<   72.21.209.193  500 esp:a128/sha1 ecf0bec7  3580 unlim A/-    -1 0
00000001>   72.21.209.193  500 esp:a128/sha1 14bf7894  3580 unlim A/-    -1 0
```

您应该可以看到包含隧道中所指定远程网关的远程地址的一行或多行。`Sta` 值应为 `A/-`，而 `SPI` 应为 `00000000` 以外的十六进制数。处于其他状态的项表示 IKE 未正确配置。

如需进一步进行问题排查，请启用 IKE 跟踪选项（如示例配置文件中所推荐）。

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

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

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

```
ssg5-serial-> get interface tunnel.1
```

```
  Interface tunnel.1:
  description tunnel.1
  number 20, if_info 1768, if_index 1, mode route
  link ready
  vsys Root, zone Trust, vr trust-vr
  admin mtu 1500, operating mtu 1500, default mtu 1500
  *ip 169.254.255.2/30
  *manage ip 169.254.255.2
  route-deny disable
  bound vpn:
    IPSEC-1

  Next-Hop Tunnel Binding table
  Flag Status Next-Hop(IP)    tunnel-id  VPN

  pmtu-v4 disabled
  ping disabled, telnet disabled, SSH disabled, SNMP disabled
  web disabled, ident-reset disabled, SSL disabled

  OSPF disabled  BGP enabled  RIP disabled  RIPng disabled  mtrace disabled
  PIM: not configured  IGMP not configured
  NHRP disabled
  bandwidth: physical 0kbps, configured egress [gbw 0kbps mbw 0kbps]
             configured ingress mbw 0kbps, current bw 0kbps
             total allocated gbw 0kbps
```

确保您可以看到 `link:ready`，并且 `IP` 地址匹配客户网关设备隧道的内部地址。

下一步，请使用下面的命令，将 `169.254.255.1` 替换为您的虚拟专用网关的内部 IP 地址。您得到的结果看上去应该如此处所示。

```
ssg5-serial-> ping 169.254.255.1
```

```
Type escape sequence to abort

Sending 5, 100-byte ICMP Echos to 169.254.255.1, timeout is 1 seconds
!!!!!
Success Rate is 100 percent (5/5), round-trip time min/avg/max=32/32/33 ms
```

如需进一步排查问题，请核查配置。

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

运行如下命令。

```
ssg5-serial-> get vrouter trust-vr protocol bgp neighbor
```

```
Peer AS Remote IP       Local IP          Wt Status   State     ConnID Up/Down
--------------------------------------------------------------------------------
   7224 169.254.255.1   169.254.255.2    100 Enabled  ESTABLISH     10 00:01:01
   7224 169.254.255.5   169.254.255.6    100 Enabled  ESTABLISH     11 00:00:59
```

两个 BGP 对等体的状态均为 `ESTABLISH`，这表示与虚拟私有网关的 BGP 连接是活动的。

如需进一步排查问题，请使用下面的命令，将 `169.254.255.1` 替换为您的虚拟专用网关的内部 IP 地址。

```
ssg5-serial-> get vr trust-vr prot bgp neigh 169.254.255.1
```

```
peer: 169.254.255.1,  remote AS: 7224, admin status: enable
type: EBGP, multihop: 0(disable), MED: node default(0)
connection state: ESTABLISH, connection id: 18 retry interval: node default(120s), cur retry time 15s
configured hold time: node default(90s), configured keepalive: node default(30s)
configured adv-interval: default(30s)
designated local IP: n/a
local IP address/port: 169.254.255.2/13946, remote IP address/port: 169.254.255.1/179
router ID of peer: 169.254.255.1, remote AS: 7224
negotiated hold time: 30s, negotiated keepalive interval: 10s
route map in name: , route map out name:
weight: 100 (default)
self as next hop: disable
send default route to peer: disable
ignore default route from peer: disable
send community path attribute: no
reflector client: no
Neighbor Capabilities:
  Route refresh: advertised and received
  Address family IPv4 Unicast:  advertised and received
force reconnect is disable
total messages to peer: 106, from peer: 106
update messages to peer: 6, from peer: 4
Tx queue length 0, Tx queue HWM: 1
route-refresh messages to peer: 0, from peer: 0
last reset 00:05:33 ago, due to BGP send Notification(Hold Timer Expired)(code 4 : subcode 0)
number of total successful connections: 4
connected: 2 minutes 6 seconds
Elapsed time since last update: 2 minutes 6 seconds
```

如果 BGP 对等体已运行，请验证您的客户网关设备正在向 VPC 通告默认路由 (0.0.0.0/0)。该命令适用于 ScreenOS 6.2.0 和更高版本。

```
ssg5-serial-> get vr trust-vr protocol bgp  rib neighbor 169.254.255.1 advertised
```

```
i: IBGP route, e: EBGP route, >: best route, *: valid route
               Prefix         Nexthop    Wt  Pref   Med Orig    AS-Path
--------------------------------------------------------------------------------------
>i          0.0.0.0/0         0.0.0.0 32768   100     0  IGP
Total IPv4 routes advertised: 1
```

另外，确保您正在从虚拟私有网关接收对应于您的 VPC 的前缀。该命令适用于 ScreenOS 6.2.0 和更高版本。

```
ssg5-serial-> get vr trust-vr protocol bgp  rib neighbor 169.254.255.1 received
```

```
i: IBGP route, e: EBGP route, >: best route, *: valid route
               Prefix         Nexthop    Wt  Pref   Med Orig    AS-Path
--------------------------------------------------------------------------------------
>e*     10.0.0.0/16   169.254.255.1   100   100   100  IGP   7224
Total IPv4 routes received: 1
```

# 对 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
```