CENTOS7, configure the firewall, open the port

Source: Internet
Author: User
Tags iptables

The 1.CENTOS7 version strengthens the firewall, no longer uses the original iptables, enables the firewall

1. View open ports (no ports are open by default)
Firewall-cmd--list-ports
2. Open 80 port
firewall-cmd--zone=public (scope)--add-port= 80/TCP (port and Access type)--permanent (permanently Effective)
3. Reboot firewall
firewall-cmd--reload
4. Stop firewall
systemctl stops Firewalld.service
5. Disable firewall boot
systemctl disable Firewalld.service
6. Delete
firewall-cmd--zone= Public--remove-port=80/tcp--permanent

2.centos7 the following version

1. Open 80,22,8080 port
/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 8080-j ACCEPT
2. Saving
/etc/rc.d/init.d/iptables
Save 3. View the open port
/etc/init.d/iptables status
4. Turn off firewall 
1 permanent and will not be restored after reboot
: Chkconfig iptables
on Close: Chkconfig iptables off
2) immediate effect, reboot after restart
: Service iptables start
shutdown: Service iptables stop

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.