Multiple IP addresses on a single Google Compute Engine instance

I am also need 2 static ips for one compute engine instance but google's quota is not allow this.

You can see your quotas from https://console.cloud.google.com/iam-admin/quotas

enter image description here


You can get multiple external IPs for one VM instance with forwarding rules.

  1. By default, VM will be assigned with an ephemeral external IP, you can promote it to static external IP, which will remain unchanged after stop and restart.
  2. Extra external IPs have to be attached to forwarding rules which point to the VM. You can use (or promote to) static IPs as well.

The command you may want to use:

  1. Create a TargetInstance for your VM instance:

    gcloud compute target-instances create <target-instance-name> --instance <instance-name> --zone=<zone>
    
  2. Create a ForwardingRule pointing to the TargetInstance:

    gcloud compute forwarding-rules create <forwarding-rule-name> --target-instance=<target-instance-name> --ip-protocol=TCP --ports=<ports>
    

See Protocol Forwarding.