I am trying to turn on IP Forwarding for an interface of an instance hosted in Google Cloud.

  1. I have a f1 micro VM instance on Google Compute Engine.
  2. I've created an IP forwarding rule with gcloud succesfuly here.
    Command compute forwarding-rules describe myrulenamehere gives out description of the rule.
  3. When I open VM instance details page IP forwarding is marked as OFF and I can't change it via EDIT button.

How to turn on IP Forwarding for interface if forwarding rule was already created?


You cannot change this value since it is a read-only value for already created instances. From the official Google documentation that you can check here:

You can only set the canIpForward field at instance creation time. After an instance is created, the field becomes read-only.

Therefore I think that the only option you have now is to create again the virtual machine, the target instance and the forwarding rule. You can enable ip-forwarding at creation time with the flag --can-ip-forward, for example:

gcloud compute instances create instance-name --can-ip-forward

You can enabling it as well from the Console, in the Network interface menu, at the creation of the instance.

You can as well keep the very same forwarding rule and update the target instance only running:

gcloud compute forwarding-rules set-target ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.