NetworkInterface

A network interface resource attached to an instance.

JSON representation
{
  "kind": string,
  "network": string,
  "subnetwork": string,
  "networkIP": string,
  "ipv6Address": string,
  "internalIpv6PrefixLength": integer,
  "name": string,
  "accessConfigs": [
    {
      object (AccessConfig)
    }
  ],
  "ipv6AccessConfigs": [
    {
      object (AccessConfig)
    }
  ],
  "aliasIpRanges": [
    {
      object (AliasIpRange)
    }
  ],
  "fingerprint": string,
  "stackType": enum (StackType),
  "ipv6AccessType": enum (Ipv6AccessType),
  "queueCount": integer,
  "nicType": enum (NicType),
  "networkAttachment": string
}
Fields
kind

string

[Output Only] Type of the resource. Always

compute#networkInterface

for network interfaces.

network

string

URL of the VPC network resource for this instance. When creating an instance, if neither the network nor the subnetwork is specified, the default network

global/networks/default

is used. If the selected project doesn't have the default network, you must specify a network or subnet. If the network is not specified but the subnetwork is specified, the network is inferred.

If you specify this property, you can specify the network as a full or partial URL. For example, the following are all valid URLs:

subnetwork

string

The URL of the Subnetwork resource for this instance. If the network resource is in legacy mode, do not specify this field. If the network is in auto subnet mode, specifying the subnetwork is optional. If the network is in custom subnet mode, specifying the subnetwork is required. If you specify this field, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs:

networkIP

string

An IPv4 internal IP address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system.

ipv6Address

string

An IPv6 internal network address for this network interface. To use a static internal IP address, it must be unused and in the same region as the instance's zone. If not specified, Google Cloud will automatically assign an internal IPv6 address from the instance's subnetwork.

internalIpv6PrefixLength

integer

The prefix length of the primary internal IPv6 range.

name

string

[Output Only] The name of the network interface, which is generated by the server. For a VM, the network interface uses the

nicN

naming format. Where

N

is a value between

0

and

7

. The default interface value is

nic0

.

accessConfigs[]

object (AccessConfig)

An array of configurations for this interface. Currently, only one access config,

ONE_TO_ONE_NAT

, is supported. If there are no

accessConfigs

specified, then this instance will have no external internet access.

ipv6AccessConfigs[]

object (AccessConfig)

An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config,

DIRECT_IPV6

, is supported. If there is no

ipv6AccessConfig

specified, then this instance will have no external IPv6 Internet access.

aliasIpRanges[]

object (AliasIpRange)

An array of alias IP ranges for this network interface. You can only specify this field for network interfaces in VPC networks.

fingerprint

string (bytes format)

Fingerprint hash of contents stored in this network interface. This field will be ignored when inserting an

Instance

or adding a

NetworkInterface

. An up-to-date fingerprint must be provided in order to update the

NetworkInterface

. The request will fail with error

400 Bad Request

if the fingerprint is not provided, or

412 Precondition Failed

if the fingerprint is out of date.

A base64-encoded string.

stackType

enum (StackType)

The stack type for this network interface. To assign only IPv4 addresses, use IPV4_ONLY. To assign both IPv4 and IPv6 addresses, use

IPV4_IPV6

. If not specified,

IPV4_ONLY

is used.

This field can be both set at instance creation and update network interface operations.

ipv6AccessType

enum (Ipv6AccessType)

[Output Only] One of EXTERNAL, INTERNAL to indicate whether the IP can be accessed from the Internet. This field is always inherited from its subnetwork.

Valid only if

stackType

is

IPV4_IPV6

.

queueCount

integer

The networking queue count that's specified by users for the network interface. Both Rx and Tx queues will be set to this number. It'll be empty if not specified by the users.

nicType

enum (NicType)

The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet.

networkAttachment

string

The URL of the network attachment that this interface should connect to in the following format: projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}.

AccessConfig

An access configuration attached to an instance's network interface. Only one access config per instance is supported.

JSON representation
{
  "kind": string,
  "type": enum (AccessType),
  "name": string,
  "natIP": string,
  "externalIpv6": string,
  "externalIpv6PrefixLength": integer,
  "setPublicPtr": boolean,
  "publicPtrDomainName": string,
  "networkTier": enum (NetworkTier),
  "securityPolicy": string
}
Fields
kind

string

[Output Only] Type of the resource. Always

compute#accessConfig

for access configs.

type

enum (AccessType)

The type of configuration. In

accessConfigs

(IPv4), the default and only option is

ONE_TO_ONE_NAT

. In

ipv6AccessConfigs

, the default and only option is

DIRECT_IPV6

.

name

string

The name of this access configuration. In

accessConfigs

(IPv4), the default and recommended name is

External NAT

, but you can use any arbitrary string, such as

My external IP

or

Network Access

. In

ipv6AccessConfigs

, the recommend name is

External IPv6

.

natIP

string

Applies to

accessConfigs

(IPv4) only. An external IP address associated with this instance. Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance.

externalIpv6

string

Applies to

ipv6AccessConfigs

only. The first IPv6 address of the external IPv6 range associated with this instance, prefix length is stored in

externalIpv6PrefixLength

in

ipv6AccessConfig

. To use a static external IP address, it must be unused and in the same region as the instance's zone. If not specified, Google Cloud will automatically assign an external IPv6 address from the instance's subnetwork.

externalIpv6PrefixLength

integer

Applies to

ipv6AccessConfigs

only. The prefix length of the external IPv6 range.

setPublicPtr

boolean

Specifies whether a public DNS 'PTR' record should be created to map the external IP address of the instance to a DNS domain name.

This field is not used in

ipv6AccessConfig

. A default PTR record will be created if the VM has external IPv6 range associated.

publicPtrDomainName

string

The DNS domain name for the public PTR record.

You can set this field only if the setPublicPtr field is enabled in

accessConfig

. If this field is unspecified in

ipv6AccessConfig

, a default PTR record will be created for first IP in associated external IPv6 range.

networkTier

enum (NetworkTier)

This signifies the networking tier used for configuring this access configuration and can only take the following values:

PREMIUM

,

STANDARD

.

If an AccessConfig is specified without a valid external IP address, an ephemeral IP will be created with this networkTier.

If an AccessConfig with a valid external IP address is specified, it must match that of the networkTier associated with the Address resource owning that IP.

securityPolicy

string

[Output Only] The resource URL for the security policy associated with this access config.

AccessType

Enums
ONE_TO_ONE_NAT
DIRECT_IPV6

AliasIpRange

An alias IP range attached to an instance's network interface.

JSON representation
{
  "ipCidrRange": string,
  "subnetworkRangeName": string
}
Fields
ipCidrRange

string

The IP alias ranges to allocate for this interface. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. This range may be a single IP address (such as

10.2.3.4

), a netmask (such as

/24

) or a CIDR-formatted string (such as

10.1.2.0/24

).

subnetworkRangeName

string

The name of a subnetwork secondary IP range from which to allocate an IP alias range. If not specified, the primary range of the subnetwork is used.

StackType

Enums
IPV4_ONLY The network interface will only be assigned IPv4 addresses.
IPV4_IPV6 The network interface can have both IPv4 and IPv6 addresses.
IPV6_ONLY The network interface will only be assigned IPv6 addresses.

Ipv6AccessType

Enums
INTERNAL This network interface can have internal IPv6.
EXTERNAL This network interface can have external IPv6.