A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/networking/using-internal-dns below:

Access VMs using internal DNS | Compute Engine Documentation

Access VMs using internal DNS

Stay organized with collections Save and categorize content based on your preferences.

Linux Windows

VMs in the same Virtual Private Cloud network can access each other by using internal DNS names instead of IP addresses.

Before you begin Determine the internal DNS name for a VM

Use the following procedure to read the internal DNS name assigned to a VM instance. You can get the internal DNS name by querying the hostname metadata entry.

  1. Connect to the VM.
  2. Query the hostname metadata:

    Linux VMs
    curl "http://metadata.google.internal/computeMetadata/v1/instance/hostname" \
      -H "Metadata-Flavor: Google"
    
    Windows VMs
    Invoke-RestMethod `
      -Headers @{"Metadata-Flavor" = "Google"} `
      -Uri "http://metadata.google.internal/computeMetadata/v1/instance/hostname"
    

The metadata server returns the VM's hostname in one of the following formats, which shows the type of internal DNS name that the VM uses:

In the output:

Access VMs by internal DNS name

To access the VM, use the internal DNS name in place of the IP address.

The following example uses ping to contact a VM that uses zonal DNS. This method works, provided that you have created a firewall rule that allows incoming ICMP traffic to the instance.

$ ping VM_NAME.ZONE.c.PROJECT_ID.internal -c 1

PING VM_NAME.ZONE.c.PROJECT_ID.internal (10.240.0.17) 56(84) bytes of data.
64 bytes from VM_NAME.ZONE.c.PROJECT_ID.internal (10.240.0.17): icmp_seq=1 ttl=64 time=0.136 ms

Replace the following:

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["VMs within the same Virtual Private Cloud network can communicate using internal DNS names instead of IP addresses."],["To authenticate for Google Cloud services and APIs, you can use the Google Cloud console, gcloud CLI (requiring installation and initialization), or REST API (also using gcloud CLI credentials)."],["The internal DNS name of a VM can be obtained by querying the `hostname` metadata, available in zonal or global DNS formats."],["Access a VM using its internal DNS name by replacing the IP address, ensuring a firewall rule allows incoming traffic."],["The format of the internal DNS name are, for zonal: VM_NAME.ZONE.c.PROJECT_ID.internal and for global: VM_NAME.c.PROJECT_ID.internal."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4