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