設置與 Amazon VPC 的 VPN 連接 - 路由
我在辦公室和 AWS VPC 之間設置 VPN 時遇到了一些實際問題。“隧道”似乎已啟動,但我不知道它們是否配置正確。
我使用的設備是 Netgear VPN 防火牆 - FVS336GV2
如果您在從 VPC 下載的附加配置中看到(#3 隧道介面配置),它會為我提供一些隧道的“內部”地址。設置 IPsec 隧道時,我是使用內部隧道 IP(例如 169.254.254.2/30)還是使用內部網路子網(10.1.1.0/24)
我都試過了,當我嘗試本地網路(10.1.1.x)時,tracert在路由器處停止。當我嘗試使用“內部”ips 時,亞馬遜 VPC (10.0.0.x) 的跟踪器通過網際網路發出。
這一切都讓我想到了下一個問題,對於這個路由器,我如何設置第 4 階段,即靜態下一跳?
這些看似隨機的“內部”地址是什麼?亞馬遜從哪裡生成它們?169.254.254.x 看起來很奇怪?
使用這樣的設備,VPN 是否在防火牆後面?
我已經調整了下面的任何 IP 地址,使它們不是“真實的”。我完全清楚,這可能措辭不當。如果有任何進一步的資訊/螢幕截圖會有所幫助,請告訴我。
Amazon Web Services Virtual Private Cloud IPSec Tunnel #1 ================================================================================ #1: Internet Key Exchange Configuration Configure the IKE SA as follows - Authentication Method : Pre-Shared Key - Pre-Shared Key : --- - Authentication Algorithm : sha1 - Encryption Algorithm : aes-128-cbc - Lifetime : 28800 seconds - Phase 1 Negotiation Mode : main - Perfect Forward Secrecy : Diffie-Hellman Group 2 #2: IPSec Configuration Configure the IPSec SA as follows: - Protocol : esp - Authentication Algorithm : hmac-sha1-96 - Encryption Algorithm : aes-128-cbc - Lifetime : 3600 seconds - Mode : tunnel - Perfect Forward Secrecy : Diffie-Hellman Group 2 IPSec Dead Peer Detection (DPD) will be enabled on the AWS Endpoint. We recommend configuring DPD on your endpoint as follows: - DPD Interval : 10 - DPD Retries : 3 IPSec ESP (Encapsulating Security Payload) inserts additional headers to transmit packets. These headers require additional space, which reduces the amount of space available to transmit application data. To limit the impact of this behavior, we recommend the following configuration on your Customer Gateway: - TCP MSS Adjustment : 1387 bytes - Clear Don't Fragment Bit : enabled - Fragmentation : Before encryption #3: Tunnel Interface Configuration Your Customer Gateway must be configured with a tunnel interface that is associated with the IPSec tunnel. All traffic transmitted to the tunnel interface is encrypted and transmitted to the Virtual Private Gateway. The Customer Gateway and Virtual Private Gateway each have two addresses that relate to this IPSec tunnel. Each contains an outside address, upon which encrypted traffic is exchanged. Each also contain an inside address associated with the tunnel interface. The Customer Gateway outside IP address was provided when the Customer Gateway was created. Changing the IP address requires the creation of a new Customer Gateway. The Customer Gateway inside IP address should be configured on your tunnel interface. Outside IP Addresses: - Customer Gateway : 217.33.22.33 - Virtual Private Gateway : 87.222.33.42 Inside IP Addresses - Customer Gateway : 169.254.254.2/30 - Virtual Private Gateway : 169.254.254.1/30 Configure your tunnel to fragment at the optimal size: - Tunnel interface MTU : 1436 bytes #4: Static Routing Configuration: To route traffic between your internal network and your VPC, you will need a static route added to your router. Static Route Configuration Options: - Next hop : 169.254.254.1 You should add static routes towards your internal network on the VGW. The VGW will then send traffic towards your internal network over the tunnels. IPSec Tunnel #2 ================================================================================ #1: Internet Key Exchange Configuration Configure the IKE SA as follows - Authentication Method : Pre-Shared Key - Pre-Shared Key : --- - Authentication Algorithm : sha1 - Encryption Algorithm : aes-128-cbc - Lifetime : 28800 seconds - Phase 1 Negotiation Mode : main - Perfect Forward Secrecy : Diffie-Hellman Group 2 #2: IPSec Configuration Configure the IPSec SA as follows: - Protocol : esp - Authentication Algorithm : hmac-sha1-96 - Encryption Algorithm : aes-128-cbc - Lifetime : 3600 seconds - Mode : tunnel - Perfect Forward Secrecy : Diffie-Hellman Group 2 IPSec Dead Peer Detection (DPD) will be enabled on the AWS Endpoint. We recommend configuring DPD on your endpoint as follows: - DPD Interval : 10 - DPD Retries : 3 IPSec ESP (Encapsulating Security Payload) inserts additional headers to transmit packets. These headers require additional space, which reduces the amount of space available to transmit application data. To limit the impact of this behavior, we recommend the following configuration on your Customer Gateway: - TCP MSS Adjustment : 1387 bytes - Clear Don't Fragment Bit : enabled - Fragmentation : Before encryption #3: Tunnel Interface Configuration Outside IP Addresses: - Customer Gateway : 217.33.22.33 - Virtual Private Gateway : 87.222.33.46 Inside IP Addresses - Customer Gateway : 169.254.254.6/30 - Virtual Private Gateway : 169.254.254.5/30 Configure your tunnel to fragment at the optimal size: - Tunnel interface MTU : 1436 bytes #4: Static Routing Configuration: Static Route Configuration Options: - Next hop : 169.254.254.5 You should add static routes towards your internal network on the VGW. The VGW will then send traffic towards your internal network over the tunnels.
編輯#1
寫完這篇文章後,我繼續擺弄,有些東西開始起作用了,只是不太可靠。在設置我的網路子網的隧道時使用的本地 IP。這進一步讓我對這些“內部”IP 地址的用途感到困惑。
問題是,結果並不一致。我可以“有時” ping,我可以“有時”使用 VPN 的 RDP。有時,隧道 1 或隧道 2 可以向上或向下。
今天回來工作的時候,Tunnel 1 壞了,所以我把它刪了,然後從頭開始重新創建。現在我無法 ping 任何東西,但亞馬遜和路由器告訴我隧道 1/2 很好。
我猜我剛剛的路由器/vpn硬體不能勝任這項工作…..
編輯#2
現在隧道 1 已啟動,隧道 2 已關閉(我沒有更改任何設置),我可以再次 ping/rdp。
編輯#3
路由器建立的路由表截圖。目前狀態(隧道 1 仍在執行且正在執行,2 仍處於關閉狀態且不會重新連接)
我不確定,但我認為你不能用這個設備做到這一點。AWS VPC 網路指南要求為您的客戶網關配置與 IPSec 隧道關聯的隧道介面,我在Netgear 的手冊中沒有看到該選項。
編輯:您可以嘗試以下設置:(VPN / IPSec VPN / VPN 嚮導)
Gateway, ConnectionName, <preshared_key> Remote WAN: 87.222.33.42 Local WAN: 217.33.22.33 Remote LAN: 10.0.0.0 Remote Subnet mask: 255.255.252.0
我認為一次只有一個隧道工作不是問題。這是設計使然;AWS 保持一條隧道關閉,並且僅在另一條隧道出現故障時才連接它。請參閱 AWS 上的 Windows 文件中的此文本。
“我們建議您將兩條隧道都配置為 VPN 連接的一部分。每條隧道都連接到 VPN 連接亞馬遜端的單獨 VPN 集中器。**雖然一次只有一條隧道開通,但第二條隧道會自動建立,如果第一條隧道出現故障。**擁有冗餘隧道可確保在設備發生故障時持續可用。由於一次只有一個隧道可用,AWS 管理控制台會顯示一個黃色圖示,表示一個隧道已關閉。這是預期的行為,所以不需要你採取任何行動。”
我與您使用 Cisco/Linksys IPsec 路由器連接的情況相同。該路由器與它連接的其他幾個 IPsec 系統(如 Cisco ASA、Vyatta 和 StrongSwan)一起工作得很好,但亞馬遜 AWS VPN 有這個內部 IP 麻煩。對於“通用”設備,它告訴您使用此內部編號,但對於 Cisco 和 Windows 等其他平台,它沒有提及內部編號。只有當我忽略內部編號並配置我的子網和 VPC 子網時,它才有效。但是沒有辦法製作這條靜態路由,隧道只能從 AWS 到我,而不是另一個方向。
我通常發現在 t1.micro 上設置 StrongSwan 比使用 AWS VPN 更容易。