Client VPN
A managed OpenVPN endpoint that puts a single user's laptop onto your private network in AWS — and, from there, anywhere the VPC can reach. It is the mirror of Site-to-Site VPN: that joins networks, this joins one machine.
Một endpoint OpenVPN được quản lý, đưa laptop của một người dùng vào mạng riêng của bạn trong AWS — và từ đó, tới bất cứ đâu VPC với tới được. Nó là bản đối chiếu của Site-to-Site VPN: cái kia nối mạng với mạng, cái này nối một máy.
The whole trick: the endpoint drops ENIs into a subnet, and once traffic is on that ENI it routes like any other VPC traffic. So the interesting questions are all about reach — peered VPCs, on-prem over the VPN, other VPCs via Transit Gateway, and the internet.
Toàn bộ mấu chốt: endpoint thả ENI vào một subnet, và khi traffic đã nằm trên ENI đó thì nó định tuyến như mọi traffic khác trong VPC. Nên câu hỏi thú vị đều xoay quanh chuyện với tới đâu — VPC đã peer, on-prem qua VPN, VPC khác qua Transit Gateway, và internet.
Client VPN is the right answer when… / reach for something else when…Khi nào chọn Client VPN… / khi nào dùng thứ khác…
Use Client VPNDùng Client VPN
- Individual people on laptops — staff, contractors — need to reach private resources in a VPC.Từng người trên laptop — nhân viên, contractor — cần với tới tài nguyên private trong VPC.
- You want to retire a self-managed OpenVPN server for a managed, highly available endpoint.Muốn bỏ một server OpenVPN tự quản để dùng một endpoint được quản lý, có sẵn tính sẵn sàng cao.
- Users must also reach on-premises or other VPCs through AWS, not just the one VPC.Người dùng còn phải với tới on-premises hoặc VPC khác qua AWS, chứ không chỉ một VPC.
- You need per-group access control — this team gets these subnets, that contractor gets one.Cần phân quyền theo nhóm — nhóm này được các subnet này, contractor kia chỉ được một cái.
Reach for something elseChuyển sang thứ khác
- Connecting a whole site / data centre network → Site-to-Site VPN.Nối cả một site / data center → Site-to-Site VPN.
- Joining two VPCs to each other → peering or Transit Gateway, not a client VPN.Nối hai VPC với nhau → peering hoặc Transit Gateway, không phải client VPN.
- Exposing one service to consumers → PrivateLink.Mở một service cho bên tiêu dùng → PrivateLink.
- Admin shell into a private instance with no VPN at all → Session Manager (Systems Manager).Cần shell quản trị vào một instance private mà không cần VPN → Session Manager (Systems Manager).
The shape — an endpoint that puts an ENI in your subnetHình dạng — một endpoint thả ENI vào subnet của bạn
The user runs an OpenVPN client, connects to the Client VPN Endpoint, and is handed a private IP. AWS terminates that at a Client VPN ENI inside a subnet you chose. After that hop, the packet is just VPC traffic from a private address — everything else on this page is about where that traffic is then allowed to go. Người dùng chạy client OpenVPN, kết nối tới Client VPN Endpoint, và được cấp một IP private. AWS kết thúc nó tại một Client VPN ENI nằm trong subnet bạn chọn. Sau chặng đó, gói tin chỉ là traffic VPC xuất phát từ một địa chỉ private — phần còn lại của trang này nói về chuyện traffic đó được phép đi tới đâu.
Once you see the ENI, the service stops being mysterious: everything past it is ordinary VPC routing. The endpoint is the only managed piece; the reach is just route tables plus authorization rules.
Khi đã thấy cái ENI thì service hết bí ẩn: mọi thứ sau nó là định tuyến VPC bình thường. Endpoint là mảnh duy nhất được quản lý; còn với tới đâu chỉ là route table cộng authorization rule.
0.0.0.0/0 for the internet — you add a route yourself: destination CIDR → the associated subnet (the target). No route on the endpoint, and those packets have nowhere to go.
Tách biệt với route table của VPC, Client VPN Endpoint có route table riêng. Gắn một subnet vào là AWS tự thêm một route — chính dải CIDR của VPC chứa subnet đó. Muốn tới bất cứ thứ gì khác — một VPC đã peer, on-premises, VPC khác qua Transit Gateway, hay 0.0.0.0/0 để ra internet — bạn phải tự thêm route: destination CIDR → subnet đã gắn (target). Thiếu route trên endpoint thì gói tin không biết đi đâu.
Reaching beyond the VPC — peering & on-premisesVới ra ngoài VPC — peering & on-premises
Because the ENI's traffic is ordinary VPC traffic, Client VPN is compatible with VPC peering and can ride the VPC's Site-to-Site VPN (or Direct Connect) to on-premises. One endpoint in one VPC, and the user reaches a peered VPC and the corporate data centre from the same session. Vì traffic của ENI là traffic VPC bình thường, Client VPN tương thích với VPC peering và đi ké được Site-to-Site VPN (hoặc Direct Connect) của VPC để tới on-premises. Một endpoint trong một VPC, người dùng với tới cả VPC đã peer lẫn data center công ty trong cùng một phiên.
The two links leaving VPC-A are exactly the machinery from the peering and Site-to-Site pages — Client VPN adds nothing new there, it just gets to use them. Which also means their limits apply: peering is not transitive, so a second peered VPC hanging off VPC-B is not reachable this way.
Hai đường rời VPC-A chính là bộ máy trong trang peering và Site-to-Site — Client VPN không thêm gì mới ở đó, nó chỉ được dùng chúng. Điều đó cũng nghĩa là giới hạn của chúng vẫn áp: peering không bắc cầu, nên một VPC peer thứ hai treo sau VPC-B thì kiểu này không tới được.
Internet access — the exit is the VPC's, not the laptop'sTruy cập internet — cửa ra là của VPC, không phải của laptop
To send the client's internet traffic through AWS (full-tunnel), the endpoint's ENI subnet must have a way out: a route to an Internet Gateway if the ENI sits in a public subnet, or to a NAT Gateway if it sits in a private one. Either way the traffic leaves from the VPC's egress. Để đẩy traffic internet của client xuyên qua AWS (full-tunnel), subnet của ENI phải có đường ra: route tới Internet Gateway nếu ENI nằm ở public subnet, hoặc tới NAT Gateway nếu nằm ở private subnet. Kiểu nào thì traffic cũng ra từ cửa của VPC.
Note the contrast with Site-to-Site VPN: there, a NAT Gateway refused the traffic because it arrived from on-prem via the VGW. Here it is fine, because the client's traffic originates inside the VPC at the Client VPN ENI — which is exactly what a NAT Gateway serves.
Để ý điểm khác với Site-to-Site VPN: ở đó NAT Gateway từ chối traffic vì nó đến từ on-prem qua VGW. Ở đây thì ổn, vì traffic của client khởi phát bên trong VPC tại Client VPN ENI — đúng loại traffic mà NAT Gateway phục vụ.
Client VPN + Transit Gateway — one endpoint, many VPCsClient VPN + Transit Gateway — một endpoint, nhiều VPC
Attach VPC-A to a Transit Gateway and the single Client VPN Endpoint suddenly reaches every VPC on the TGW, and on-premises through the TGW's Direct Connect or VPN attachment. A VPC that is only peered to VPC-A is still reachable directly — you do not have to route everything through the hub. Gắn VPC-A vào một Transit Gateway là endpoint Client VPN duy nhất bỗng với tới mọi VPC trên TGW, và tới on-premises qua attachment Direct Connect hoặc VPN của TGW. Một VPC chỉ peer với VPC-A thì vẫn tới thẳng được — không bắt buộc phải đi vòng qua hub.
This is the pattern to remember for "remote users must reach a fleet of VPCs and the data centre": Client VPN for the people, Transit Gateway for the fan-out. Peering to VPC-D is drawn to make the point that the two can coexist — not everything has to route through the TGW.
Đây là mô hình cần nhớ cho đề "người dùng từ xa phải với tới cả loạt VPC và data center": Client VPN cho con người, Transit Gateway để toả ra. Peering tới VPC-D vẽ vào để nói rõ hai thứ sống chung được — không phải cái gì cũng bắt buộc đi qua TGW.
Things that catch you outNhững chỗ dễ sập bẫy
- Connected, but a subnet is unreachable. The authorization rule is missing, or there is no route on the endpoint for that network. Both are required, per destination network. Kết nối được mà không tới được một subnet. Thiếu authorization rule, hoặc endpoint chưa có route tới mạng đó. Cả hai đều bắt buộc, cho từng mạng đích.
- Reaching a peered VPC still needs a route. "Compatible with peering" does not mean automatic — you add a route on the Client VPN Endpoint and the VPC route tables must carry the peer, as always. Tới VPC đã peer vẫn cần route. "Tương thích peering" không có nghĩa là tự động — bạn phải thêm route trên Client VPN Endpoint và route table của VPC vẫn phải có peer như thường lệ.
-
No internet just because you're connected. Full-tunnel internet needs the ENI's subnet to route to an IGW or NAT Gateway, plus a
0.0.0.0/0route and authorization rule on the endpoint. Kết nối rồi không tự có internet. Internet kiểu full-tunnel cần subnet của ENI có route tới IGW hoặc NAT Gateway, kèm route0.0.0.0/0và authorization rule trên endpoint. - Single-AZ association = single point of failure. Associate the endpoint with a subnet in two AZs so an AZ outage doesn't drop everyone. Chỉ gắn một AZ = một điểm chết. Gắn endpoint với subnet ở hai AZ để một AZ hỏng không làm rớt tất cả.
- It is Client VPN, not Site-to-Site. If the scenario connects a network/site, this is the wrong service; Client VPN is for individual clients. Đây là Client VPN, không phải Site-to-Site. Nếu đề nối một mạng/site thì đây là sai service; Client VPN dành cho từng client lẻ.
Exam reflexesPhản xạ khi thi
| The question says…Đề nói… | AnswerĐáp án |
|---|---|
| "Remote employees on laptops need private access to a VPC""Nhân viên từ xa dùng laptop cần truy cập private vào VPC" | AWS Client VPN (managed OpenVPN endpoint)AWS Client VPN (endpoint OpenVPN được quản lý) |
| "Connected users must also reach on-premises / a peered VPC""Người dùng đã kết nối còn phải với tới on-premises / VPC đã peer" | Client VPN rides the Site-to-Site VPN / peering — add route + authorization ruleClient VPN đi ké Site-to-Site VPN / peering — thêm route + authorization rule |
| "Remote users must reach many VPCs and the data centre""Người dùng từ xa phải với tới nhiều VPC và data center" | Client VPN + Transit GatewayClient VPN + Transit Gateway |
| "Give a contractor group access to one subnet only""Cho nhóm contractor truy cập đúng một subnet" | Authorization rules scoped to that group / networkAuthorization rule giới hạn theo nhóm / mạng đó |
| "Connect a whole branch office network to AWS""Nối cả một mạng chi nhánh vào AWS" | Site-to-Site VPN — not Client VPNSite-to-Site VPN — không phải Client VPN |
| "Highly available client access, no single AZ risk""Truy cập client sẵn sàng cao, không rủi ro một AZ" | Associate the endpoint with a subnet in two or more AZsGắn endpoint với subnet ở hai AZ trở lên |