How to enable, disable, and allow specific ports of the iptables firewall
Source: Internet
Author: User
I have mentioned that the newly purchased server of the company uses CentOS5.5. after deploying Tomcat, I found that I entered 114. 80. *. *: 8080 (ip: 8080), but the default Tomcat homepage cannot be displayed. Because it was previously deployed in the WinServer VPS and only used localhost during Linux development, it was a little too big. Okay, G. The Internet said it was a Firewall problem. I have mentioned before that the newly purchased server of the company uses CentOS5.5. after deploying Tomcat, I found that I entered 114. 80. *. *: 8080 (ip: 8080), but the default Tomcat homepage cannot be displayed. Because it was previously deployed in the WinServer VPS and only used localhost during Linux development, it was a little too big.
Okay, G. I have a firewall problem on the Internet.
/Etc/init. d/
IptablesStop
After it is disabled, check 114. 80. *. *: 8080 (ip: 8080) again. However, it seems that security risks are greatly increased ...... Use
/Etc/init. d/iptables status
View the firewall information and view the opened port. It is feasible to open the port to be used. the command is as follows:
/Sbin/iptables-I INPUT-p tcp -- dport 8080-j ACCEPT #8080 indicates the specified port
/Etc/init. d/iptables restart # restart the firewall to make the change take effect. of course, you can restart the system if you do not feel the trouble (Command: reboot)
/Etc/rc. d/init. d/iptables save # save the changes
Of course, another line is added directly to/etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT-m state? State NEW-m tcp-p tcp? Dport8080-j ACCEPT
Permanently disable the firewall
Chkconfig? Level 35 iptables off # this method originated from the network and has not been tested. Therefore, you are not allowed to use this method for security reasons.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service