-1

I have google cloud instance with static IP assigned to it. However my /etc/network/interfaces contains only eth0 interface with auto dhcp ip assign.

I need to run some services that I need to bind to the public static IP, but I cannot do that since that IP is not defined on the interface.

I came up with something like:

auto eth0
iface eth0 inet dhcp


auto  eth0:0
iface eth0:0 inet static
  address   MyStaticIP
  netmask   ?????????
  gateway   ?????????

But this cant work without netmask and gateway but I have no idea what those should be since there is nothing about it in google documentation.

Can anyone help ?

Dakado
  • 1

1 Answers1

1

The internal IP address is going to be always different from the external IP address.

To communicate between instances on the same Virtual Private Cloud (VPC) network, you can use the internal IP address for the instance. To communicate with the internet, you must use the instance's external IP address unless you have configured a proxy of some kind. Similarly, you must use the instance's external IP address to connect to instances outside of the same VPC network unless the networks are connected in some way, like via Classic VPN. Both external and internal primary IP addresses can be either ephemeral or static.

From the way you've formed your question, I assume you've set up an external IP only. Go to the following page to learn how to reserve a static internal IP.

A forwarding rule is required for network, global, and internal load balancing. The forwarding rule must have an external or internal IP address, depending on the load balancer you are using. For network and global load balancing, you can create a regional or global forwarding rule and allocate a regional or global static external IP address, respectively. For internal load balancing, assign an internal IP address.