MilesWeb Hosting Forum

Web Hosting Technical Support => How To's => Topic started by: Dipak Bhoi on September 17, 2014, 05:49:06 PM

Title: How to Open Ports In Your Firewall ?
Post by: Dipak Bhoi on September 17, 2014, 05:49:06 PM
Hell Guys,

Usually its depends on the Firewall is installed on your server, I have covered the several ways to do this.

APF :-

APF can only be configured by accessing the server over ssh, as the root user. Open the following file in your favorite text editor. Here I am using vi editor.

Quote#vi /etc/apf/conf.apf

Find the following line.

Quote# Common inbound (ingress) TCP ports
IG_TCP_CPORTS="20,21,22,25,53,80,110,143,443,465,993,995"

After adding port, save and close your text editor, you will need to restart APF. Fire below command.

Quote#apf -r


CSF :-

CSF can be configured in Web Host Manager (WHM) as well as over ssh, as the root user.

Open up the following file and and add the port you need to open.

Quote#vi /etc/csf/csf.conf

Quote# Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,26"
# Allow outgoing TCP ports
TCP_OUT = "20,21,22,25,37,43,53,80,110,113,443,587,873"

You can also open UDP and ICMP port as well.

Then you need to restart the CSF for change to take effect.

Quote# csf -r

From WHM :-

In WHM go to Home >> Plugins >> ConfigServer Security&Firewall. On that page, click on the Firewall Configuration button.

Find for the same Field TCP_IN and TCP_OUT and the IP address into it. tTen click Changeat the bottom of the page to save your changes.

You will need to restart csf. Next screen you will see a button Restart csf+lfd. Click on this button.

That's all, hope this post will help you.

Note :- To add the port range you use the colon : to specify the port range in between from and to. E.g 1000:2000

Enjoy !!