CentOS 6.5 system under iptables Firewall open 80 3306 22 ports

Source: Internet
Author: User
Tags iptables firewall

Recently in the construction of lamp environment, configure a variety of environments need to open the port, always in Baidu too troublesome, record

Original address: http://m.blog.csdn.net/sherwin/article/details/49562667

-------------------------------------------------------------------------

#/sbin/iptables-i input-p TCP--dport 80-j ACCEPT

#/sbin/iptables-i input-p TCP--dport 22-j ACCEPT
#/sbin/iptables-i input-p TCP--dport 3306-j ACCEPT
And then Save:
#/etc/rc.d/init.d/iptables Save

To view open ports:

#/etc/init.d/iptables Status

-------------------------------------------------------Additional notes:

#关闭防火墙

/etc/init.d/iptables stop service iptables stop services

#查看防火墙信息

/etc/init.d/iptables status

#开放端口: 8080

/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT

#重启防火墙以便改动生效:(or directly reboot the system)

/etc/init.d/iptables restart

#将更改进行保存

/etc/rc.d/init.d/iptables Save

In addition, add a line directly to the/etc/sysconfig/iptables:-A rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 8080-j ACCEPT

#永久关闭防火墙
Chkconfig–level iptables off #此方法源自网络, not tested, security considerations refuse to use this method

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.