Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Cloud DNS sử dụng quy trình sau để trả lời các truy vấn từ các thực thể máy ảo (VM) Compute Engine và các nút Google Kubernetes Engine (GKE).
Đối với các máy ảo Compute Engine không phải là nút GKE, Cloud DNS tuân theo thứ tự phân giải mạng VPC để xử lý các truy vấn mà nó nhận được. Bạn phải định cấu hình mỗi máy ảo để sử dụng địa chỉ IP của máy chủ siêu dữ liệu (169.254.169.254) làm máy chủ định danh.
Chính sách phản hồi ở phạm vi cụm và vùng riêng tư
Khớp bằng các quy tắc trong chính sách phản hồi ở phạm vi cụm GKE. Cloud DNS quét tất cả các chính sách phản hồi trong phạm vi cụm GKE hiện hành để tìm một quy tắc trong đó thuộc tính tên DNS khớp với nhiều truy vấn nhất có thể. Cloud DNS sử dụng tính năng so khớp hậu tố dài nhất để quét các chính sách phản hồi ở phạm vi cụm.
Nếu Cloud DNS tìm thấy một quy tắc chính sách phản hồi phù hợp và quy tắc đó phân phát dữ liệu cục bộ, thì Cloud DNS sẽ trả về dữ liệu cục bộ dưới dạng phản hồi, hoàn tất quá trình phân giải tên.
Nếu Cloud DNS tìm thấy một quy tắc chính sách phản hồi phù hợp và hành vi của quy tắc đó bỏ qua chính sách phản hồi, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
Nếu Cloud DNS không tìm thấy chính sách phản hồi phù hợp hoặc nếu không có chính sách phản hồi trong phạm vi cụm áp dụng cho nút, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
Bản ghi so khớp trong các vùng riêng tư ở phạm vi cụm. Cloud DNS quét tất cả các vùng riêng tư được quản lý trong phạm vi cụm để tìm một bản ghi khớp với nhiều truy vấn nhất có thể. Cloud DNS sử dụng kiểu so khớp hậu tố dài nhất để tìm các bản ghi trong các vùng riêng ở phạm vi cụm.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên vùng của một vùng riêng tư ở phạm vi cụm, thì Cloud DNS sẽ sử dụng dữ liệu bản ghi của vùng đó để phân giải yêu cầu.
Nếu vùng chứa một bản ghi khớp chính xác với truy vấn, thì Cloud DNS sẽ trả về dữ liệu của bản ghi đó.
Nếu vùng không chứa bản ghi khớp, Cloud DNS sẽ trả về NXDOMAIN.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên vùng của vùng chuyển tiếp ở phạm vi cụm, thì Cloud DNS sẽ chuyển tiếp truy vấn đến một trong các mục tiêu chuyển tiếp của vùng chuyển tiếp để hoàn tất quy trình phân giải tên. Cloud DNS sẽ trả về một trong các phản hồi sau.
Phản hồi nhận được từ mục tiêu chuyển tiếp.
Phản hồi SERVFAIL, nếu mục tiêu chuyển tiếp không phản hồi với Cloud DNS.
Nếu truy vấn không khớp với bất kỳ vùng riêng tư nào trong phạm vi cụm, thì Cloud DNS sẽ tiếp tục thứ tự phân giải mạng VPC.
Thứ tự phân giải mạng VPC
So khớp bằng máy chủ định danh thay thế của mạng VPC. Nếu mạng VPC có chính sách máy chủ gửi đi, thìGoogle Cloud sẽ chuyển tiếp truy vấn đến một trong các máy chủ tên thay thế được xác định trong chính sách đó để hoàn tất quy trình phân giải tên.
Nếu có hai hoặc nhiều máy chủ định danh thay thế trong chính sách máy chủ gửi, thì Cloud DNS sẽ xếp hạng các máy chủ định danh thay thế bằng cách sử dụng một thuật toán nội bộ. Bắt đầu với các thứ hạng bằng nhau, máy chủ tên thay thế sẽ tăng thứ hạng dựa trên tỷ lệ phản hồi thành công cao hơn (bao gồm cả phản hồi NXDOMAIN) và dựa trên thời gian thực hiện hành trình ngắn nhất (độ trễ phản hồi thấp nhất).
Cloud DNS gửi truy vấn đến các máy chủ định danh thay thế và trả về phản hồi bằng quy trình sau.
Nếu có hai hoặc nhiều máy chủ định danh thay thế trong chính sách máy chủ gửi, trước tiên, Cloud DNS sẽ gửi truy vấn đến máy chủ định danh thay thế có thứ hạng cao nhất, sau đó gửi đến máy chủ định danh thay thế có thứ hạng tiếp theo nếu Cloud DNS không nhận được bất kỳ phản hồi nào từ máy chủ định danh thay thế có thứ hạng cao nhất. Nếu không nhận được phản hồi nào từ máy chủ định danh thay thế có thứ hạng tiếp theo, Cloud DNS sẽ tiếp tục truy vấn các máy chủ định danh thay thế theo thứ hạng giảm dần cho đến khi hết danh sách máy chủ định danh thay thế.
Nếu nhận được phản hồi từ một máy chủ định danh thay thế, Cloud DNS sẽ trả về phản hồi đó. Phản hồi bao gồm phản hồi NXDOMAIN.
Nếu Cloud DNS không nhận được phản hồi từ tất cả máy chủ tên thay thế trong chính sách máy chủ gửi đi, thì Cloud DNS sẽ tổng hợp phản hồi SERVFAIL. Để khắc phục sự cố về kết nối máy chủ định danh thay thế, hãy xem phần Yêu cầu về mạng của máy chủ định danh thay thế.
Nếu mạng VPC không có chính sách máy chủ gửi đi, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
So khớp bằng cách sử dụng các quy tắc trong chính sách phản hồi ở phạm vi mạng VPC. Cloud DNS quét tất cả chính sách phản hồi mạng VPC hiện hành để tìm một quy tắc mà thuộc tính tên DNS khớp với nhiều truy vấn nhất có thể. Cloud DNS sử dụng tính năng so khớp hậu tố dài nhất để quét các chính sách phản hồi trong phạm vi mạng VPC.
Nếu Cloud DNS tìm thấy một quy tắc chính sách phản hồi phù hợp và quy tắc đó phân phát dữ liệu cục bộ, thì Cloud DNS sẽ trả về dữ liệu cục bộ dưới dạng phản hồi, hoàn tất quá trình phân giải tên.
Nếu Cloud DNS tìm thấy một quy tắc chính sách phản hồi phù hợp và hành vi của quy tắc đó bỏ qua chính sách phản hồi, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
Nếu Cloud DNS không tìm thấy chính sách phản hồi phù hợp hoặc nếu không có chính sách phản hồi trong phạm vi mạng VPC hiện hành cho máy ảo hoặc nút, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
So khớp bản ghi trong các vùng riêng tư được quản lý trong phạm vi mạng VPC.
Cloud DNS quét tất cả các vùng riêng tư được quản lý được uỷ quyền cho mạng VPC để tìm một bản ghi khớp với nhiều truy vấn nhất có thể. Cloud DNS sử dụng kiểu so khớp hậu tố dài nhất để tìm bản ghi.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên vùng của một vùng riêng tư trong phạm vi mạng VPC, thì Cloud DNS sẽ sử dụng dữ liệu bản ghi của vùng đó để phân giải yêu cầu.
Nếu vùng chứa một bản ghi khớp chính xác với truy vấn, thì Cloud DNS sẽ trả về dữ liệu của bản ghi đó.
Nếu vùng không chứa bản ghi khớp, Cloud DNS sẽ trả về NXDOMAIN.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên vùng của vùng chuyển tiếp trong phạm vi mạng VPC, thì Cloud DNS sẽ chuyển tiếp truy vấn đến một trong các mục tiêu chuyển tiếp của vùng chuyển tiếp để hoàn tất quá trình phân giải tên. Cloud DNS sẽ trả về một trong các phản hồi sau.
Phản hồi nhận được từ mục tiêu chuyển tiếp.
Phản hồi SERVFAIL, nếu mục tiêu chuyển tiếp không phản hồi với Cloud DNS.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên của một vùng liên kết trong phạm vi mạng VPC, thì Cloud DNS sẽ dừng quy trình phân giải tên hiện tại và bắt đầu một quy trình phân giải tên mới từ quan điểm của mạng VPC mục tiêu của vùng liên kết.
Nếu truy vấn không khớp với vùng riêng tư, vùng chuyển tiếp hoặc vùng liên kết ngang hàng, thì Cloud DNS sẽ tiếp tục bước tiếp theo.
So khớp bản ghi trong các vùng nội bộ của Compute Engine.
Cloud DNS quét tất cả vùng DNS nội bộ của Compute Engine hiện có để tìm một bản ghi khớp với nhiều nội dung truy vấn nhất có thể. Cloud DNS sử dụng kiểu so khớp hậu tố dài nhất để tìm bản ghi.
Nếu kết quả khớp cụ thể nhất cho truy vấn là tên DNS nội bộ của Compute Engine, thì Cloud DNS sẽ trả về địa chỉ IP nội bộ của giao diện mạng của máy ảo hoặc con trỏ tra cứu ngược làm phản hồi, hoàn tất quá trình phân giải tên.
So khớp bản ghi bằng truy vấn DNS công khai. Google Cloud tuân theo bản ghi bắt đầu quyền (SOA) để truy vấn các vùng có sẵn công khai, bao gồm cả các vùng công khai của DNS trên đám mây. Cloud DNS sẽ trả về một trong các phản hồi sau.
Phản hồi nhận được từ một máy chủ tên có thẩm quyền.
Phản hồi NXDOMAIN nếu bản ghi không tồn tại.
Ví dụ
Giả sử bạn có hai mạng VPC, vpc-a và vpc-b, cùng với một cụm GKE, cluster-a, cùng với các tài nguyên có phạm vi sau:
vpc-a được uỷ quyền truy vấn các vùng riêng tư sau. Lưu ý dấu chấm ở cuối mỗi mục nhập:
static.example.com.
10.internal.
peer.com. là một vùng peering có thể truy vấn thứ tự phân giải tên VPC của vpc-b.
vpc-a không liên kết với bất kỳ máy chủ gửi đi hoặc chính sách phản hồi nào.
cluster-a được uỷ quyền để truy vấn một vùng riêng tư có tên là example.com.
cluster-a cũng không liên kết với bất kỳ máy chủ gửi đi hoặc chính sách phản hồi nào.
Máy ảo trong cluster-a có thể truy vấn:
example.com và các phần tử con (bao gồm cả static.example.com) được trả lời bởi vùng riêng tư có tên là example.com, được uỷ quyền cho cluster-a.
10.internal vào vpc-a.
peer.com bằng cách sử dụng vùng liên kết.
Một máy ảo không nằm trong cluster-a có thể truy vấn:
static.example.com và các phần tử con, được trả lời bởi vùng riêng tư có tên là static.example.com được uỷ quyền cho vpc-a. Truy vấn cho example.com trả về phản hồi trên Internet.
10.internal vào vpc-a.
peer.com bằng cách sử dụng vùng liên kết.
Bước tiếp theo
Để tìm giải pháp cho các vấn đề thường gặp mà bạn có thể gặp phải khi sử dụng Cloud DNS, hãy xem phần Khắc phục sự cố.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Khó hiểu","hardToUnderstand","thumb-down"],["Thông tin hoặc mã mẫu không chính xác","incorrectInformationOrSampleCode","thumb-down"],["Thiếu thông tin/mẫu tôi cần","missingTheInformationSamplesINeed","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-06-27 UTC."],[[["\u003cp\u003eCloud DNS handles queries from Compute Engine VMs by following the VPC network resolution order, with each VM needing to use the metadata server IP address (169.254.169.254) as its name server.\u003c/p\u003e\n"],["\u003cp\u003eFor GKE nodes, Cloud DNS first attempts to match queries using cluster-scoped response policies and private zones before proceeding to the VPC network resolution order.\u003c/p\u003e\n"],["\u003cp\u003eThe VPC network resolution order involves matching queries against alternative name servers, VPC network-scoped response policies, managed private zones, Compute Engine internal zones, and finally, public DNS queries.\u003c/p\u003e\n"],["\u003cp\u003eLongest-suffix matching is utilized by Cloud DNS to scan cluster-scoped and VPC network-scoped resources for records or rules that match queries.\u003c/p\u003e\n"],["\u003cp\u003eOutbound server policies help reroute queries through alternative name servers, which are ranked based on response success rates and latency, for a faster resolution.\u003c/p\u003e\n"]]],[],null,["# Name resolution order\n\nCloud DNS uses the following procedure to answer queries from\nCompute Engine virtual machine (VM) instances and\nGoogle Kubernetes Engine (GKE) nodes.\n\nFor Compute Engine VMs other than GKE nodes,\nCloud DNS follows the [VPC network resolution\norder](#vpc_steps) to process queries it receives. Each VM must be configured to\nuse the metadata server IP address (`169.254.169.254`) as its name server.\n\nFor GKE nodes:\n\n1. Cloud DNS first attempts to match a query using [cluster-scoped\n response policies and private zones](#gke_steps).\n\n2. Cloud DNS continues by following the [VPC network\n resolution order](#vpc_steps).\n\nCluster-scoped response policies and private zones\n--------------------------------------------------\n\n1. **Match using rules in GKE cluster-scoped response\n policies**. Cloud DNS scans all applicable GKE\n cluster-scoped response policies for a rule where the DNS name attribute\n matches as much of the query as possible. Cloud DNS uses\n longest-suffix matching to scan cluster-scoped response policies.\n\n 1. If Cloud DNS finds a matching response policy rule *and* the\n rule serves local data, then Cloud DNS returns the local\n data as its response, completing the name resolution process.\n\n 2. If Cloud DNS finds a matching response policy rule *and* the\n rule's behavior bypasses the response policy, then Cloud DNS\n continues to the next step.\n\n 3. If Cloud DNS fails to find a matching response policy *or* if\n there isn't an applicable cluster-scoped response policy for the node,\n then Cloud DNS continues to the next step.\n\n2. **Match records in cluster-scoped private zones**. Cloud DNS scans\n all cluster-scoped managed private zones for a record that matches as much of\n the query as possible. Cloud DNS uses longest-suffix matching to\n find records in cluster-scoped private zones.\n\n 1. If the most specific match for the query is the zone name of a\n cluster-scoped private zone, Cloud DNS uses that zone's record\n data to resolve the request.\n\n - If the zone contains a record that exactly matches the query, Cloud DNS returns that record's data.\n - If the zone doesn't contain a matching record, Cloud DNS returns `NXDOMAIN`.\n 2. If the most specific match for the query is the zone name of a\n cluster-scoped forwarding zone, then Cloud DNS forwards the\n query to one of the forwarding zone's forwarding targets to complete the\n name resolution process. Cloud DNS returns one of the following\n responses.\n\n - The response received from the forwarding target.\n - A `SERVFAIL` response, if the forwarding target doesn't respond to Cloud DNS.\n 3. If the query doesn't match any cluster-scoped private zone,\n Cloud DNS continues to the [VPC network\n resolution order](#vpc_steps).\n\nVPC network resolution order\n----------------------------\n\n1. **Match using VPC network alternative name server** . If the\n VPC network has an [outbound server\n policy](/dns/docs/server-policies-overview#dns-server-policy-out),\n Google Cloud forwards the query to one of the [alternative name\n servers](/dns/docs/server-policies-overview#altns-targets) defined in that\n policy to complete the name resolution process.\n\n If two or more alternative name servers exist in the outbound server\n policy, Cloud DNS ranks the alternative name servers using an\n internal algorithm. Beginning with equal ranks, alternative name servers\n increase in rank based on higher rates of successful responses (including\n `NXDOMAIN` responses) *and* based on the shortest round-trip time (the lowest\n response latency).\n\n Cloud DNS sends queries to alternative name servers and returns\n responses using the following process.\n - If two or more alternative name servers exist in the outbound server\n policy, Cloud DNS first sends the query to the highest-ranked\n alternative name server, then to the next-ranked alternative name\n server if Cloud DNS does *not* receive *any* response from the\n highest-ranked alternative name server. If Cloud DNS doesn't\n receive any response from the next-ranked alternative name server,\n Cloud DNS continues to query alternative name servers by\n descending rank until it exhausts the list of alternative name servers.\n\n - If Cloud DNS receives a response from an alternative name\n server, Cloud DNS returns that response. Responses include\n `NXDOMAIN` responses.\n\n - If Cloud DNS does *not* receive a response from *all*\n alternative name servers in the outbound server policy,\n Cloud DNS synthesizes a `SERVFAIL` response. To troubleshoot\n alternative name server connectivity, see [Alternative name server\n network requirements](/dns/docs/server-policies-overview#altns-net-req).\n\n If the VPC network does *not* have an outbound server policy,\n Cloud DNS continues to the next step.\n2. **Match using rules in VPC network-scoped response\n policies**. Cloud DNS scans all applicable VPC\n network response policies for a rule where the DNS name attribute matches\n as much of the query as possible. Cloud DNS uses longest-suffix\n matching to scan VPC network-scoped response policies.\n\n 1. If Cloud DNS finds a matching response policy rule *and* the\n rule serves local data, then Cloud DNS returns the local data\n as its response, completing the name resolution process.\n\n 2. If Cloud DNS finds a matching response policy rule *and* the\n rule's behavior bypasses the response policy, then Cloud DNS\n continues to the next step.\n\n 3. If Cloud DNS fails to find a matching response policy *or* if\n there isn't an applicable VPC network-scoped response\n policy for the VM or node, then Cloud DNS continues to the next\n step.\n\n3. **Match records in VPC network-scoped managed private zones**.\n Cloud DNS scans all managed private zones authorized for the\n VPC network for a record that matches as much of the query as\n possible. Cloud DNS uses longest-suffix matching to find records.\n\n 1. If the most specific match for the query is the zone name of a\n VPC network-scoped private zone, Cloud DNS uses that\n zone's record data to resolve the request.\n\n - If the zone contains a record that exactly matches the query, Cloud DNS returns the record's data.\n - If the zone doesn't contain a matching record, Cloud DNS returns `NXDOMAIN`.\n 2. If the most specific match for the query is the zone name of a\n VPC network-scoped forwarding zone, then Cloud DNS\n forwards the query to one of the forwarding zone's forwarding targets to\n complete the name resolution process. Cloud DNS returns one of\n the following responses.\n\n - The response received from the forwarding target.\n - A `SERVFAIL` response, if the forwarding target doesn't respond to Cloud DNS.\n 3. If the most specific match for the query is the name of a VPC\n network-scoped peering zone, Cloud DNS stops the current name\n resolution process and begins a new name resolution process from the\n perspective of the peering zone's target VPC network.\n\n If the query doesn't match a private zone, forwarding zone, or peering zone,\n Cloud DNS continues to the next step.\n4. **Match records in Compute Engine internal zones** .\n Cloud DNS scans all applicable [Compute Engine\n internal DNS zones](/compute/docs/internal-dns) for a record that matches as\n much of the query as possible. Cloud DNS uses longest-suffix\n matching to find records.\n\n 1. If the most specific match for the query is a Compute Engine internal DNS name, Cloud DNS returns the internal IP address of the VM's network interface or its reverse lookup pointer as its response, completing the name resolution process.\n5. **Match record using public DNS query**. Google Cloud follows the\n start of authority (SOA) record to query publicly available zones, including\n Cloud DNS public zones. Cloud DNS returns one of the\n following responses.\n\n - The response received from an authoritative name server.\n - An `NXDOMAIN` response, if the record doesn't exist.\n\nExample\n-------\n\nSuppose that you have two VPC networks, `vpc-a` and `vpc-b`, and\na GKE cluster, `cluster-a`, along with the following scoped\nresources:\n\n1. `vpc-a` is authorized to query the following private zones. Note the trailing\n dot in each entry:\n\n - `static.example.com.`\n - `10.internal.`\n2. `peer.com.` is a peering zone that can query the VPC\n name resolution order of `vpc-b`.\n\n3. `vpc-a` is not associated with any outbound server or response policies.\n\n4. `cluster-a` is authorized to query a private zone called `example.com`.\n `cluster-a` is also not associated with any outbound server or response\n policies.\n\n5. A VM in `cluster-a` can query:\n\n - `example.com` and children (including `static.example.com`), answered by the private zone called `example.com`, authorized to `cluster-a`.\n - `10.internal` on `vpc-a`.\n - `peer.com` by using the peering zone.\n6. A VM that is *not* in `cluster-a` can query:\n\n - `static.example.com` and children, answered by the private zone called `static.example.com` authorized to `vpc-a`. Queries for `example.com` return internet responses.\n - `10.internal` on `vpc-a`.\n - `peer.com` by using the peering zone.\n\nWhat's next\n-----------\n\n- To find solutions for common issues that you might encounter when using Cloud DNS, see [Troubleshooting](/dns/docs/troubleshooting).\n- To get an overview of Cloud DNS, see [Cloud DNS overview](/dns/docs/overview).\n- To learn how to configure response policies, see [Manage response policies\n and rules](/dns/docs/zones/manage-response-policies)."]]