To create the global forwarding rule "fr-elb" for a load balancer, run:
gdcloud compute forwarding-rules create fr-elb \
--backend-service=network-lb-backend-service \
--cidr=my-cidr \
--ip-protocol-port=tcp:8080,udp:443 \
--global
To create the zonal forwarding rule "fr-ilb" for a load balancer, run:
gdcloud compute forwarding-rules create fr-elb \
--backend-service=network-lb-backend-service \
--cidr=my-cidr \
--ip-protocol-port=tcp:8080,udp:443 \
--load-balancing-scheme=INTERNAL
REQUIRED FLAGS
--ip-protocol-port strings IP protocol that the rule serves. Note that the protocol must be either TCP or UDP. The L4 port for which packets are forwarded to the backend are configured with this forwarding rule. Protocol defaults to TCP if not specified.
OPTIONAL FLAGS
--backend-service string Target backend service that receives the traffic. It has to reference a backend service in the same namespace as this forwarding rule.
--cidr string CIDR to use for this forwarding rule. It has to be an object in the same namespace as this forwarding rule. If not specified, an IPv4/32 CIDR will be auto-reserved from the IP address pool.
--global If set, the global forwarding rule is created.
--load-balancing-scheme string Load balancing scheme of the forwarding rule. Available values are INTERNAL or EXTERNAL. (default "EXTERNAL")
--zone string Zone to use for this invocation. To preset the zone flag for all commands that require it, run: "gdcloud config set core/zone ZONE". The zone flag is available only in multi-zone environments.
GDCLOUD WIDE FLAGS
These flags are available to all commands: --configuration, --format, --help, --project, --quiet.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egdcloud compute forwarding-rules create\u003c/code\u003e command is used to create forwarding rules for load balancers, either globally or within a specific zone.\u003c/p\u003e\n"],["\u003cp\u003eYou must specify the IP protocol and port using the \u003ccode\u003e--ip-protocol-port\u003c/code\u003e flag, with options limited to TCP or UDP, and you can specify multiple ports with a comma.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e--backend-service\u003c/code\u003e flag designates the target backend service that will receive traffic, ensuring it exists in the same namespace as the forwarding rule.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e--cidr\u003c/code\u003e flag specifies the CIDR used by the forwarding rule, otherwise it will autogenerate an IPv4/32 CIDR.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e--global\u003c/code\u003e flag creates a global forwarding rule and \u003ccode\u003e--load-balancing-scheme\u003c/code\u003e sets the scheme to either INTERNAL or EXTERNAL, with the default being EXTERNAL.\u003c/p\u003e\n"]]],[],null,["# gdcloud compute forwarding-rules create\n\nNAME\n----\n\ngdcloud compute forwarding-rules create - Create forwarding rules for a load balancer.\n\nSYNOPSIS\n--------\n\n gdcloud compute forwarding-rules create FORWARDING_RULE_NAME [flags]\n\n### EXAMPLES\n\n To create the global forwarding rule \"fr-elb\" for a load balancer, run:\n\n gdcloud compute forwarding-rules create fr-elb \\\n --backend-service=network-lb-backend-service \\\n --cidr=my-cidr \\\n --ip-protocol-port=tcp:8080,udp:443 \\\n --global\n\n To create the zonal forwarding rule \"fr-ilb\" for a load balancer, run:\n\n gdcloud compute forwarding-rules create fr-elb \\\n --backend-service=network-lb-backend-service \\\n --cidr=my-cidr \\\n --ip-protocol-port=tcp:8080,udp:443 \\\n --load-balancing-scheme=INTERNAL\n\n### REQUIRED FLAGS\n\n --ip-protocol-port strings IP protocol that the rule serves. Note that the protocol must be either TCP or UDP. The L4 port for which packets are forwarded to the backend are configured with this forwarding rule. Protocol defaults to TCP if not specified.\n\n### OPTIONAL FLAGS\n\n --backend-service string Target backend service that receives the traffic. It has to reference a backend service in the same namespace as this forwarding rule.\n --cidr string CIDR to use for this forwarding rule. It has to be an object in the same namespace as this forwarding rule. If not specified, an IPv4/32 CIDR will be auto-reserved from the IP address pool.\n --global If set, the global forwarding rule is created.\n --load-balancing-scheme string Load balancing scheme of the forwarding rule. Available values are INTERNAL or EXTERNAL. (default \"EXTERNAL\")\n --zone string Zone to use for this invocation. To preset the zone flag for all commands that require it, run: \"gdcloud config set core/zone ZONE\". The zone flag is available only in multi-zone environments.\n\n### GDCLOUD WIDE FLAGS\n\nThese flags are available to all commands: `--configuration`, `--format`, `--help`, `--project`, `--quiet`.\n\nFor more information, see the [gdcloud CLI reference overview](/distributed-cloud/hosted/docs/latest/gdch/resources/gdcloud-reference/gdcloud) page."]]