What is Port?
Port numbers are related to TCP/IP network connections. A port number is a way to recognize a definite process to which an Internet or other network message is to be rerouted when it arrives at a server. They enable various applications on the corresponding computer to share network resources together. Home network routers and computer software work with these ports and sometimes continue configuring port number settings.
How Does Port Numbers Work?
> Port numbers are associated with the network addresses. In TCP/IP networking, both TCP and UDP utilize their own set of ports that run together with IP addresses.
> In both TCP and UDP, port numbers start at 0 and go up to 65535. Numbers in the lower ranges are dedicated to common Internet protocols (like port 80 for HTTP and port 443 for HTTPS).
To open a port in Linux Firewall
This may be very beneficial, and also terrible, so be sure and understand what port you want to open up. Hackers can use these open ports to gain an illegal way to your Linux server.
1) Login SSH into your server as "root".
2) Get to the directory where the configuration file is for CSF.
cd /etc/csf
If done. Press enter.
3) Open the configuration file so that we can edit it. Something like "Vim" editor vim csf.conf
Find TCP_IN Line on the file csf.conf
Once you have the file open, you will see a "TCP_IN" and "TCP_OUT" section. It will look like this:
4) Allow incoming TCP ports
TCP_IN = "20,21,1122, 25, 26, 53, 80, 110, 143, 443, 465, 587, 993, 995, 2077, 2078, 2082, 2083, 2086, 2087, 2095, 2096, 8010"
5) Allow incoming TCP ports
TCP_IN = "20,21,1122, 25, 26, 53, 80, 110, 143, 443, 465, 587, 993, 995, 2077, 2078, 2082, 2083, 2086, 2087, 2095, 2096, 8010"
All those numbers there are ports that are currently "open". Yours may look different so don't panic! It all depends on your configuration.
6) Save and get out of this file (:wq!)p pRestart the firewall so that your changes take effect!p pcsf -rp
pStopping CSFp pcsf -xp