Enoch Bryant
Enoch Bryant

Reputation: 1

External IPs not assigned within VM

I have a couple of Centos 6 VMs that I am trying to setup. I assigned static IPs to them but when running ifconfig, I do not see the external IPs, just the internal IPs. Does Google not allow this capability?

Upvotes: 0

Views: 1039

Answers (2)

Adrián
Adrián

Reputation: 2880

In addition to what Anderson said, this is the command to query for the external IP from the instance itself:

curl "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" -H "Metadata-Flavor: Google"

Upvotes: 1

E. Anderson
E. Anderson

Reputation: 3493

DHCP only supports requesting a single address. Google Compute Engine returns the internal IP address via DHCP, and maps the external assigned IP addresses to the VM using NAT.

If you want to fetch the assigned IP address from inside the VM, you could query the metadata server for that information.

Upvotes: 0

Related Questions