如何在 Google Compute Engine 中打开特定端口,例如 9090 [英] How to open a specific port such as 9090 in Google Compute Engine
问题描述
我有 2 个 Google Compute Engine 实例,我想在这两个实例中都打开端口 9090.我认为我们需要添加一些防火墙规则.
I have 2 Google Compute Engine instances and I want to open port 9090 in both the instances. I think we need to add some firewall rules.
你能告诉我该怎么做吗?
Can you tell me how can I do that?
推荐答案
您需要:
转到 cloud.google.com
Go to cloud.google.com
转到我的控制台
选择您的项目
选择网络>VPC网络
选择防火墙"
选择创建防火墙规则"
要应用规则来选择 VM 实例,请选择目标 >指定目标标签",进入目标标签"标签的名称.此标签将用于将新的防火墙规则应用于您想要的任何实例.然后,确保实例应用了网络标记.
To apply the rule to select VM instances, select Targets > "Specified target tags", and enter into "Target tags" the name of the tag. This tag will be used to apply the new firewall rule onto whichever instance you'd like. Then, make sure the instances have the network tag applied.
设置源 IP 范围以允许来自所有 IP 的流量:0.0.0.0/0
Set Source IP ranges to allow traffic from all IPs: 0.0.0.0/0
要允许传入 TCP 连接到端口 9090,在协议和端口"中,选中tcp"并输入 9090
To allow incoming TCP connections to port 9090, in "Protocols and Ports", check "tcp" and enter 9090
单击创建(或单击等效命令行"以显示 gcloud
命令以创建相同的规则)
Click Create (or click "Equivalent Command Line" to show the gcloud
command to create the same rule)
希望对你有帮助.
更新请参考docs进行自定义你的规则.
Update Please refer to docs to customize your rules.
这篇关于如何在 Google Compute Engine 中打开特定端口,例如 9090的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!