To allow outbound traffic through a custom port, you need to set up a firewall rule.
For example, the following steps set up a rule that allows outbound traffic on port 2525.
Replace port 2525 with the custom port of your choice.
-
In the Google Cloud Platform Console, go to the Create a firewall rule page.
-
Choose a name for the firewall rule.
-
Under Network, select the network that is hosting the VM instance that you intend to send email messages from.
-
Under Direction of traffic, select Egress.
-
Under Targets, choose the appropriate target for this rule. For example, you might choose Specified target tags if you want the rule to apply to instances that have a specific tag.
-
Under Destination filter, set 0.0.0.0/0 if you want to allow egress traffic from the VM instance to any destination. If you want to limit the destination, enter another IP range here.
-
Under Protocols and ports, select Specified protocols and ports, select tcp, and enter 2525.
-
Click Create to save your changes.