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

 

For more information visit:

http://www.cyberciti.biz/faq/howto-rhel-linux-open-port-using-iptables/

 

  • 131 Users Found This Useful
Was this answer helpful?

Related Articles

Direct emailing

Direct email delivery is disabled on the network for server packaged ordered after 5/15/2012....

Get started with your Control Panel (Webmin/cPanel)

  Webmin: Webmin is disabled by default, you will have to enable it: - Access the server via...

Run File System Check in Linux

  # fsck fsck is used to check and optionally repair one or more Linux file systems....

How to restart Webmin

Here is a little helper if your Webmin does not respond. Just run this command from the...

Troubleshoot long respond times with Secure Shell communication

SSH taking too long to respond? Disable Group Support System (GSS) login, to do this follow...