Linux How To

How To Check & Open Ports In CENTOS / FEDORA / REDHAT

Hi, In this section am going to discuss about How To Check & 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 . By default, iptables firewall stores its configuration at location /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

Its a very simple step, soo try it and make it.

Get more stuff
in your inbox

Subscribe to our newsletter and get interesting stuff and updates to your email inbox.

Bibith K Mathew (born on 29 July 1998) is an Indian Internet entrepreneur. He is best known as the CEO and Managing Director of TalkBate Digital Partners.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.