View the network configuration for an instance Stay organized with collections Save and categorize content based on your preferences.
Use the instructions on this page to view the network interfaces,networks, subnets, and IP addresses for a compute instance.
Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Required roles
To get the permissions that you need to view the network configuration for an instance, ask your administrator to grant you the Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) or Compute Network Admin (roles/compute.networkAdmin) IAM role on the project. For more information about granting roles, seeManage access to projects, folders, and organizations.
This predefined role contains the permissions required to view the network configuration for an instance. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to view the network configuration for an instance:
- View network configuration for an instance:
compute.instances.geton the instance - View IP addresses for an instance:
compute.instances.liston the project
You might also be able to get these permissions withcustom roles or otherpredefined roles.
View IP addresses
You can view the internal and external IP addresses for your instance. TheIP addresses can be either IPv4 or IPv6 addresses.
Console
In the Google Cloud console, go to theVM instances page.
Optional: Use theFilter box to restrict the number of instances shown.
If the instance has an external IP address, it appears undertheExternal IP column.
If theExternal IP column is empty, then there is no external IPaddress for the instance. If the instance doesn't have an external IPaddress, then you canassign one.

Depending on the column display options, you might see more columns orfewer columns than appear in the previous image.
gcloud
There are two commands you can use to view the IP addresses for an instance:
gcloud compute instances listshows all IP addresses used by a computeinstance, either static or ephemeral.gcloud compute addresses listshows all the reserved IP addresses thatare assigned to a compute instance.
This task shows how to view IP addresses usinggcloud compute instances commands.
To view the internal and external IP addresses for your instancesuse the
gcloud compute instances listcommand.gcloud compute instances list
You can append the
--filterclause to restrict the number of instancesreturned by the command, for example,--filter='zone:us-central1-c'.The output is similar to the following:
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUSwebapp1 us-central1-c c3-highmem-88 true 192.0.2.11 RUNNINGmy-instance us-central1-c n4-standard-2 192.0.2.126 203.0.113.6 RUNNINGmy-dual-stack us-central1-a e2-micro 192.0.2.54 203.0.113.7 RUNNING 2001:db8:2:2:2:2:2:2/96new-ipv6-only us-central1-a n4-standard-2 2001:db8:1:1:1:1:1:1/96 RUNNING
If the External IP address field is empty, then there is no defined IPaddress of that type for the instance; you canassign one.
To view the internal or external IP address for a specific instance,use the
gcloud compute instances describecommandwith a--formatflag to filter the output.Internal addresses
To view the internal IP address for a specific instance, use either of the following commands:
IPv4 addresses:
gcloud compute instances describeINSTANCE_NAME \ --zone=ZONE \ --format='get(networkInterfaces[0].networkIP)'
192.0.2.11
IPv6 addresses:
gcloud compute instances describeINSTANCE_NAME \ --zone=ZONE \ --format='get(networkInterfaces[0].ipv6Address)'
2001:db8:2:2:2:2:2:2
External addresses
To view the external IP address for a specific instance, use either of the following commands:
IPv4 addresses:
gcloud compute instances describeINSTANCE_NAME \ --zone=ZONE \ --format='get(networkInterfaces[0].accessConfigs[0].natIP)'
203.0.113.6
IPv6 addresses:
gcloud compute instances describeINSTANCE_NAME \ --zone=ZONE \ --format='get(networkInterfaces[0].ipv6AccessConfigs[0].externalIpv6)'
2001:db8:3:3:3:3:3:3
Replace the following:
INSTANCE_NAME: the name of theinstance whose internal or external IP you want to viewZONE: the name of the zone where the instanceis located
If the command doesn't return an IP address, then the instance doesn'thave an external IP address configured.
REST
Make aGET request to theinstances.get method. By appending a$fields query parameter to the request, you can restrict the output to just the fields of interest.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/INSTANCE_NAME$fields=name,networkInterfaces.networkIP,networkInterfaces.accessConfigs.natIP,networkInterfaces.ipv6AccessConfigs.externalIpv6
Replace the following:
PROJECT_NAME: the name of the project that contains the instanceZONE: the zone for the instance that you want toqueryINSTANCE_NAME: the name of the instance resourceto return
If any of the IP addresses are not configured, then that field doesn'tappear in the output. For a compute instance that uses a dual-stack networkwith an external IPv6 address, your response body resembles the following:
{ "name": "my-dual-stack-vm", "networkInterfaces": [ { "networkIP": "10.0.0.2", "accessConfigs": [ { "natIP": "104.155.21.204" } ], "ipv6AccessConfigs": [ { "externalIpv6": "2600:1900:4010:8b2:0:0:0:0" } ] } ]}The following fields contain the required information:
networkIP: the assigned internal IPv4 addressnatIP: the assigned external IPv4 addressexternalIpv6: the assigned external IPv6 address
Python
fromenumimportEnumfromtypingimportListfromgoogle.cloudimportcompute_v1defget_instance(project_id:str,zone:str,instance_name:str)->compute_v1.Instance:""" Get information about a VM instance in the given zone in the specified project. Args: project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone you want to use. For example: “us-west3-b” instance_name: name of the VM instance you want to query. Returns: An Instance object. """instance_client=compute_v1.InstancesClient()instance=instance_client.get(project=project_id,zone=zone,instance=instance_name)returninstanceclassIPType(Enum):INTERNAL="internal"EXTERNAL="external"IP_V6="ipv6"defget_instance_ip_address(instance:compute_v1.Instance,ip_type:IPType)->List[str]:""" Retrieves the specified type of IP address (ipv6, internal or external) of a specified Compute Engine instance. Args: instance (compute_v1.Instance): instance to get ip_type (IPType): The type of IP address to retrieve (ipv6, internal or external). Returns: List[str]: Requested type IP addresses of the instance. """ips=[]ifnotinstance.network_interfaces:returnipsforinterfaceininstance.network_interfaces:ifip_type==IPType.EXTERNAL:forconfigininterface.access_configs:ifconfig.type_=="ONE_TO_ONE_NAT":ips.append(config.nat_i_p)elifip_type==IPType.IP_V6:foripv6_configingetattr(interface,"ipv6_access_configs",[]):ifipv6_config.type_=="DIRECT_IPV6":ips.append(ipv6_config.external_ipv6)elifip_type==IPType.INTERNAL:# Internal IP is directly available in the network interfaceips.append(interface.network_i_p)returnipsJava
importcom.google.cloud.compute.v1.AccessConfig;importcom.google.cloud.compute.v1.AccessConfig.Type;importcom.google.cloud.compute.v1.GetInstanceRequest;importcom.google.cloud.compute.v1.Instance;importcom.google.cloud.compute.v1.InstancesClient;importcom.google.cloud.compute.v1.NetworkInterface;importjava.io.IOException;importjava.util.ArrayList;importjava.util.List;publicclassGetVmAddress{publicstaticvoidmain(String[]args)throwsIOException{// TODO(developer): Replace these variables before running the sample.// Project ID or project number of the Google Cloud project you want to use.StringprojectId="your-project-id";// Instance ID of the Google Cloud project you want to use.StringinstanceId="your-instance-id";// IPType you want to search.IpTypeipType=IpType.INTERNAL;getVmAddress(projectId,instanceId,ipType);}// Retrieves the specified type of IP address// (ipv6, internal or external) of a specified Compute Engine instance.publicstaticList<String>getVmAddress(StringprojectId,StringinstanceId,IpTypeipType)throwsIOException{List<String>result=newArrayList<>();Instanceinstance=getInstance(projectId,instanceId);for(NetworkInterfacenetworkInterface:instance.getNetworkInterfacesList()){if(ipType==IpType.EXTERNAL){for(AccessConfigaccessConfig:networkInterface.getAccessConfigsList()){if(accessConfig.getType().equals(Type.ONE_TO_ONE_NAT.name())){result.add(accessConfig.getNatIP());}}}elseif(ipType==IpType.IP_V6){for(AccessConfigaccessConfig:networkInterface.getAccessConfigsList()){if(accessConfig.hasExternalIpv6() &&accessConfig.getType().equals(Type.DIRECT_IPV6.name())){result.add(accessConfig.getExternalIpv6());}}}elseif(ipType==IpType.INTERNAL){result.add(networkInterface.getNetworkIP());}}returnresult;}privatestaticInstancegetInstance(StringprojectId,StringinstanceId)throwsIOException{// Initialize client that will be used to send requests. This client only needs to be created// once, and can be reused for multiple requests.try(InstancesClientinstancesClient=InstancesClient.create()){GetInstanceRequestrequest=GetInstanceRequest.newBuilder().setInstance(instanceId).setProject(projectId).setZone("us-central1-b").build();returninstancesClient.get(request);}}publicenumIpType{INTERNAL("internal"),EXTERNAL("external"),IP_V6("ipv6");privatefinalStringtype;IpType(Stringtype){this.type=type;}publicStringgetType(){returntype;}}}View network interfaces for an instance
Each compute instance has at least one virtual network interface (vNIC), andeach network interface uses a unique subnet in a VPC network. Youcan view the configured network interfaces, Dynamic Network Interfaces (NICs), andproperties of the network interfaces for an instance using the following ways.
Console
In the Google Cloud console, go to theVM instances page.
Optional: Use theFilter box to restrict the number of instances shown.
Click the name of the instance that you want to inspect.
In theNetworking section, underNetwork interfaces, you can seethe network interfaces (NICs) created for the instance, the network andsubnet associated with each NIC, and their assigned IP addresses.
You can click the name of a NIC to open theNetwork interface detailspage. On this page, you can see the firewalls and routes used by the NICand also perform a connectivity test for the NIC.
gcloud
To view the network interfaces (NICs) for a compute instance, use thegcloud compute instances describe command.You can append a--format option to the command to restrict the informationreturned to specific fields and change how it is displayed, for example:
gcloud compute instances describeINSTANCE_NAME --zone=ZONE \ --format="flattened(name,networkInterfaces[].name, networkInterfaces[].network.basename(), networkInterfaces[].stackType, networkInterfaces[].nicType)"
Replace the following:
INSTANCE_NAME: the name of the instance to viewZONE: the zone for the instance that you want toview
The output is similar to the following:
name: test-instancenetworkInterfaces[0].name: nic0networkInterfaces[0].network: defaultnetworkInterfaces[0].nicType: GVNICnetworkInterfaces[0].stackType: IPV4_ONLYnetworkInterfaces[1].name: nic1networkInterfaces[1].network: prod-ipv6networkInterfaces[1].nicType: GVNICnetworkInterfaces[1].stackType: IPV4_IPV6networkInterfaces[1].name: nic1.2networkInterfaces[1].network: alt-ipv6-netnetworkInterfaces[1].nicType: GVNICnetworkInterfaces[1].stackType: IPV4_IPV6networkInterfaces[1].parentNicName: nic1
REST
Construct aGET request to theinstances.get method.By appending a$fields query parameter to the request, you can restrictthe output to just thenetworkInterfaces property.
Before using any of the request data, make the following replacements:
PROJECT_ID: ID of the project that contains the instanceZONE: zone of the instanceINSTANCE_NAME: the name of the instance
HTTP method and URL:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/INSTANCE_NAME?$fields=networkInterfaces
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login , or by usingCloud Shell, which automatically logs you into thegcloud CLI . You can check the currently active account by runninggcloud auth list.Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://compute.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/INSTANCE_NAME?$fields=networkInterfaces"
PowerShell (Windows)
Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login . You can check the currently active account by runninggcloud auth list.Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://compute.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/INSTANCE_NAME?$fields=networkInterfaces" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "networkInterfaces": [ { "kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/my-project/global/networks/network-name-1", "subnetwork": "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/subnet-name-1", "networkIP": "10.128.0.15", "name": "nic0", "accessConfigs": [ { "kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "networkTier": "PREMIUM" } ], "fingerprint": "mBy9xvkWA9M=", "stackType": "IPV4_ONLY", "nicType": "GVNIC" }, { "kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/my-project/global/networks/network-name-2", "subnetwork": "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/subnet-name-2", "networkIP": "10.0.20.2", "name": "nic1", "accessConfigs": [ { "kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "networkTier": "PREMIUM" } ], "ipv6AccessConfigs": [ { "kind": "compute#accessConfig", "type": "DIRECT_IPV6", "name": "external-ipv6", "externalIpv6": "2600:1900:4000:8447:0:0:0:0", "externalIpv6PrefixLength": 96, "publicPtrDomainName": "", "networkTier": "PREMIUM" } ], "fingerprint": "rx6hfNA94f4=", "stackType": "IPV4_IPV6", "ipv6AccessType": "EXTERNAL", "nicType": "GVNIC", "parentNicName": "nic1" }, { "kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/my-project/global/networks/network-name-3", "subnetwork": "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/subnet-name-3", "networkIP": "10.0.26.2", "name": "nic1.1", "accessConfigs": [ { "kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "networkTier": "PREMIUM" } ], "ipv6AccessConfigs": [ { "kind": "compute#accessConfig", "type": "DIRECT_IPV6", "name": "external-ipv6", "externalIpv6": "2600:1900:4000:8450:0:0:0:0", "externalIpv6PrefixLength": 96, "publicPtrDomainName": "", "networkTier": "PREMIUM" } ], "fingerprint": "rx6hfNA94f4=", "stackType": "IPV4_IPV6", "ipv6AccessType": "EXTERNAL", "nicType": "GVNIC", "parentNicName": "nic1" } ]}View all compute instances within a network
Use one of the following methods to view all compute instances within acertain network.
Console
In the Google Cloud console, go to theVPC networks page.
Optional: Use theFilter box to restrict the number of networks shown.
Click the name of the network for which you want to list the computeinstances.
Select theInstances tab to view the instances within that network.
gcloud
To view the compute instances that use a specific network, use thegcloud compute instances list command.
Use a--filter flag to list only the instances that use a specific network.You can also use a--format flag to restrict and format the results,for example:
gcloud compute instances list \ --filter 'networkInterfaces[].network:NETWORK_NAME' \ --format="table(name:sort=1,machineType.basename(),zone.basename(),networkInterfaces[].subnetwork)"
The output is similar to the following:
NAME: c2-tier1-multinicMACHINE_TYPE: c2-standard-30ZONE: us-central1-cSUBNETWORK: ['https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/default', 'https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/webapps-external-subnet']
NAME: c3-with-lssdMACHINE_TYPE: c3-standard-4-lssdZONE: us-central1-aSUBNETWORK: ['https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/default']
NAME: example-instance3MACHINE_TYPE: n2-custom-2-163840-extZONE: us-central1-bSUBNETWORK: ['https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/default']
NAME: n4-test-windowsMACHINE_TYPE: n4-standard-2ZONE: us-central1-cSUBNETWORK: ['https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/default']
Determine if Tier_1 networking is enabled
Use one of the following methods to determine if per VM Tier_1 networking performance isenabled for an instance.
Console
In the Google Cloud console, go to theVM instances page.
Optional: Use theFilter box to restrict the number of instances shown.
Click the name of the instance that you want to inspect.
In theNetworking section, check the value forTotal egress bandwidth tier:
TIER_1: Tier_1 networking is enabled.-: Tier_1 networking is not enabled.
gcloud
To view thenetworkPerformanceConfig setting for an instance, use thegcloud compute instances describe command.You can append a--format option to the command to restrict the informationreturned to specific fields and change how it is displayed, for example:
gcloud compute instances describeINSTANCE_NAME \ --zone=ZONE \ --format="text(name, networkPerformanceConfig)"
If Tier_1 networking is not configured for the instance, then thenetworkPerformanceConfig field is not included in the output. IfTier_1 networking is enabled for an instance, then the output is similarto the following:
name: c2-tier1-multinicnetworkPerformanceConfig.totalEgressBandwidthTier: TIER_1
REST
Construct aGET request to theinstances.get method.By appending a$fields query parameter to the request, you can restrictthe output to just thename,networkPerformanceConfig, andnicType fields.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/INSTANCE_NAME?$fields=name,networkPerformanceConfig,networkInterfaces.nicType
Replace the following:
PROJECT_NAME: the name of the project thatcontains the instanceZONE: the zone for the instance that you want toqueryINSTANCE_NAME: the name of the instance resourceto return
If Tier_1 networking is not configured for the instance, then thenetworkPerformanceConfig field is not included in the output. IfTier_1 networking is enabled for an instance, then the output is similarto the following:
{ "name": "c2-tier1-multinic", "networkInterfaces": [ { "nicType": "GVNIC" }, { "nicType": "GVNIC" } ], "networkPerformanceConfig": { "totalEgressBandwidthTier": "TIER_1" }}What's next
- Learn about Compute Engine network interface and IP address concepts inNetworking overview for VMs
- Create VMs with multiple network interfaces
- Add Dynamic NICs to an instance
- Benchmark higher network bandwidth for VM instances
- Optimize application latency with load balancing
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.