gcloud compute firewall-rules create
NAME
--allow
PROTOCOL
PORT
]]PROTOCOL
[:_PORT_[-PORT
]] …]--description
DESCRIPTION
]--format
FORMAT
]--help
]--network
NETWORK
; default="default"]--project
PROJECT_ID
]--quiet
, -q
]--source-ranges
CIDR_RANGE
[CIDR_RANGE
…]]--source-tags
TAG
[TAG
…]]--target-tags
TAG
[TAG
…]]-h
]gcloud compute firewall-rules create
is used to create firewall rules to allow incoming
traffic to a network.NAME
--allow
PROTOCOL
[:_PORT_[-PORT
]] [PROTOCOL
[:_PORT_[-PORT
]] …]
PROTOCOL
is the IP protocol whose traffic will be allowed.
PROTOCOL
can be either the name of a well-known protocol
(e.g., tcp
or icmp
) or the IP protocol number.
A list of IP protocols can be found at
http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.PROTOCOL
to
allow traffic through specific ports. If no port or port range
is specified, connections through all ranges are allowed. For
example, the following will create a rule that allows TCP traffic
through port 80 and allows ICMP traffic:$ gcloud compute firewall-rules create MY-RULE --allow tcp:80 icmp
--description
DESCRIPTION
--network
NETWORK
; default="default"
default
network.
--source-ranges
CIDR_RANGE
[CIDR_RANGE
…]
0.0.0.0/0
, allowing all sources. Multiple IP
address blocks can be specified if they are separated by spaces.
--source-tags
TAG
[TAG
…]
--target-tags
TAG
[TAG
…]
--format
FORMAT
json
, text
, yaml
.
--help
--project
PROJECT_ID
--quiet
, -q
-h
compute
component. See
installing components
if it is not installed.