Check and open ports in CentOS / Fedora / Redhat

 

If you want to open or close a port for a Linux firewall you have to edit the rules in the iptables configuration. By default iptables firewall stores its configuration at /etc/sysconfig/iptables file. You need to edit this file and add rules to open port.

Here are the steps to open the port XY using the default visual editor vi:

Open port XY

Open flle /etc/sysconfig/iptables:

# vi /etc/sysconfig/iptables

Append rule as follows:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport XY -j ACCEPT

 

Save and close the file. Restart iptables:

# /etc/init.d/iptables restart

Verify that port is open

Run following command:

# netstat -tulpn | less

Make sure iptables is allowing port connections:

# iptables -L -n

 

  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

A-Z Index of the Linux BASH command line

An A-Z Index of the Linux BASH command line alias Create an aliasapropos Search Help manual...

Changing The SSH Port

While there are many ways to make sure your server is as secure as possible there are some basic...

Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any...

Create email accounts using ssh

/scripts/addpop user_id@yourdomains.com user_password Do below mentioned steps for configuration...

Editing users cronjob through ssh

To List cronjob of a cpanel user through sshcrontab -u username -lUser's cron jobs reside in...