How to allow any TCP port via Firewall?
Introduction:
Opening port TCP on CentOS 7 is a common task when you want to allow network traffic to reach a specific service or application running on your server. Port TCP is often used for web applications and web servers, including alternative HTTP ports or application-specific services. In this guide, we’ll walk you through the steps to open port TCP on CentOS 7 using the firewalld
firewall management tool.
Step1:
Before opening port TCP, it’s a good practice to check your server’s current firewall configuration to ensure you don’t disrupt existing rules.
$ sudo firewall-cmd –list-all |
Step2:
Use the firewall-cmd
command to open port TCP. You will specify the zone where you want to add the rule (e.g., public
for the default public zone) and use the --add-port
option to specify the port and protocol (TCP in this case).
$sudo firewall-cmd –zone=public –add-port=8475/tcp –permanent |
Step3:
Reload the firewall with the below command.
$sudo firewall-cmd –reload |
Step4:
Verify that the new rule for port 8475 is now active.
$sudo firewall-cmd –list-all |
Conclusion:
Successfully opened port TCP on your CentOS 7 server. This allows incoming network traffic on port TCP, which can be used for various purposes, such as hosting web applications or services. Ensure that you configure any applications or services listening on port TCP to handle incoming traffic appropriately and securely.