Centos/redhat System:
Turn on the firewall
#systemctl Start Firewalld.service
Stop firewall
#systemctl Stop Firewalld.service
Disable firewall boot
#systemctl Disable Firewalld.service
View default firewall status (show not running after turn off, show running on when turned on)
#firewall-cmd--state
To configure iptables, you first need to install the Iptables service
#yum Install Iptables-services
Edit the firewall configuration file
#vim/etc/sysconfig/iptables
Add the following lines, 22 is the default
-A input-p tcp-m state--state new-m TCP--dport 80-jaccept
-A input-p tcp-m state--state new-m TCP--dport 8080-j ACCEPT
-A input-p tcp-m state--state new-m TCP--dport 443-j ACCEPT
Port 22 is for SSH access, the 80,8080 port is accessed by the HTTP service, later with HTTPS, you also need to open 443 port access rights.
Save, restart Iptables service
Finally reboot the firewall to make the configuration effective
#systemctl Restart Iptables.service
Setting up a firewall boot
#systemctl Enable Iptables.service
After reboot firewall is turned on again, so we want to set disable firewall boot from boot
Prohibit firewall boot from booting
Stop firewall
#systemctl Stop Firewalld.service
Disable firewall boot
#systemctl Disable Firewalld.service
Linux off firewall, open port