Reproduced from: https://www.cnblogs.com/jtestroad/p/8031850.html
Important things to say three times, strongly recommend the use of the second method! second!;
Ways to open ports:
Method One: Command line mode
1. Open port command:/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT
2. Saving:/etc/rc.d/init.d/iptables Save
3. Restart Service:/etc/init.d/iptables restart
4. See if the port is open:/sbin/iptables-l-N
Method Two: Directly edit/etc/sysconfig/iptables file
1. Edit/etc/sysconfig/iptables File: Vi/etc/sysconfig/iptables
Add content and Save:-a rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 8080-j ACCEPT
2. Restart Service:/etc/init.d/iptables restart
3. See if the port is open:/sbin/iptables-l-N
But I have to use the method one has not been saved, check the Internet found that directly modify the file does not need to iptables save, reboot under the iptables reload configuration. Iptables save is to write the current iptables to the/etc/sysconfig/iptables. I do not save direct restart also can not, so still method two bar
Query port has process daemon using the following command grep corresponding port, such as 80 for port number
Example: Netstat-nalp|grep 80