iptables Firewall
1, basic operation # View firewall status service iptables status # Stop Firewall service iptables Stop # Start Firewall service iptables start # Reboot Firewall Service iptables Restart # permanently shut down firewall chkconfig iptables off # After permanent shutdown chkconfig iptables on
2, view the firewall status, the firewall is turned on and only 22 ports open
3. Open 80 ports
Vim/etc/sysconfig/iptables
# Add the following code, than the two gourd painting scoop:)
-A input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT
Reboot firewall after save exit
Service Iptables Restart
Firewall Firewall
1. View Firewall Service Status
Systemctl Status Firewalld
2, view the status of firewall
Firewall-cmd--state
3, open, restart, close, Firewalld.service service
# Open Service
firewalld start
# Restart
service firewalld Restart
# close
service Firewalld stop
4. View Firewall rules
5, query, open, close the port
# Query Port open
firewall-cmd--query-port=8080/tcp
# Open 80 port
firewall-cmd--permanent--add-port=80/tcp
# Remove Port
firewall-cmd--permanent--remove-port=8080/tcp
#重启防火墙 (reboot firewall after modifying configuration)
firewall-cmd--reload
# parameter explanation
1, Firwall-cmd: is a tool for Linux to operate firewall;
2,- -permanent: Indicates set to persistent;
3 、--Add-port: Identifies the added port;