Issue with default IP on VM with multiple network interfaces

15 views
Skip to first unread message

A Bazza

unread,
Sep 21, 2021, 12:07:58 PMSep 21
to gce-discussion
I am creating a VM wit gcloud that's being added to a second subnet. On the original subnet a static IP is defined. On the second subnet there is no private network IP. On launch my VM's IP defaults to a value chosen from the second network's CIDR range, not the static IP from the original subnet. How to ensure that my IP is the static IP 10.98.0.89?

Here's the gcloud command:

gcloud compute --project my-proj instances create inst1

--zone europe-west2-b --machine-type n1-standard-32

--network-interface subnet=projects/shared-vpc/regions/europe-west2/subnetworks/cinternal-vpc1-europe-west2,no-address,private-network-ip=10.98.0.89

--network-interface network=private-vpc,subnet=cinternal-vpc1-europe-west2-net1,no-address

--hostname=xxx

--scopes https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write

--image-family xxx-build

--image-project my-proj --boot-disk-size 200 --boot-disk-type pd-standard --boot-disk-device-name boot-disk

--boot-disk-kms-key projects/key-project/locations/europe-west2/keyRings/computeEngine/cryptoKeys/computeEngine

--disk=auto-delete=no,boot=no,device-name=app-disk,name=appdisk-xxx

--tags xxx

--metadata enable-oslogin=TRUE,serial-port-logging-enable=true,gcp_module=gcpsim,efx_fqdn=xxx,efx_env=uat,efx_region=europe-west2,app_env=uat

--service-account=xx

--metadata-from-file=ssh-keys=xxx

Reply all
Reply to author
Forward
0 new messages