我读了这个Google's documentation 。这部分让我很困惑。
Each firewall rule applies to incoming (ingress) or outgoing (egress) connection, not both.
接下来的段落
VPC firewall rules are stateful.
When a connection is allowed through the firewall in either direction, return traffic matching this connection is also allowed. You cannot configure a firewall rule to deny associated response traffic.
根据上述内容,我认为连接和流量方向不是指同一件事,对吗?
在 GCP 中,默认为入口方向。如果我们不指定方向,则应用于实例的防火墙规则将仅应用于入口方向。那么,当返回流量仅在一个方向应用时,如何匹配防火墙规则呢?
最佳答案
在现代防火墙中,您只需定义哪个部分可以启动连接。当连接被授权通过防火墙时,响应也被授权。防火墙规则的返回方式是隐式的。
通常,默认情况下,在 GCP 上,您的所有虚拟机都可以启动传出连接(允许所有出站流量),但所有外部 IP 无法启动与您的虚拟机的连接(拒绝所有入口流量)
关于google-cloud-platform - GCP 防火墙规则是单向应用还是双向应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67242420/