Enable the CentOS system to close the firewall and open specific ports

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/rc. d/init. d/iptables save # save the changes
/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)
Of course, another line is added directly to/etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT-m state Cstate NEW-m tcp-p tcpCdport 8080-j ACCEPT
View firewall information:
#/Etc/init. d/iptables status
Disable the firewall service:
#/Etc/init. d/iptables stop
Permanently disable the firewall
Chkconfig Clevel 35 iptables off # this method is originated from the network and has not been tested. Therefore, you are not allowed to use this method for security reasons.
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.