Important thing to say three times, it is strongly recommended to use the second Method! Second Method!;
Ways to open ports:
Method One: Command line mode
1. Open port command:/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT
2. Save:/etc/rc.d/init.d/iptables Save
3. Restart Service:/etc/init.d/iptables restart
4. Check if the port is open:/sbin/iptables-l-N
Method Two: Directly edit the/etc/sysconfig/iptables file
1. Edit the/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. Check if the port is open:/sbin/iptables-l-N
But I use method one has been saved, check the online discovery directly modify the file does not need iptables save, restart under Iptables reload under configuration. Iptables save is writing the current iptables to/etc/sysconfig/iptables. I do not save direct restart also not, so the method of two bar
Query port whether there is a process daemon with the following command grep corresponding port, such as 80 for port number
Example: Netstat-nalp|grep 80
Two ways to open a Linux port to a specified port