In this article we will see how to check all the Linux ports that are opened in Centos / 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.
This task should be a known task by any sysadmins, and is the base for understanding the security rules around your system.# vim /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 12345 -j ACCEPT
# /etc/init.d/iptables restart
# netstat -tulpn | less
# iptables -L -n