systemctl
查看防火墙
systemctl status firewalld
停止使用防火墙
systemctl stop firewalld
service
查看防火墙状态
$ service iptables status
临时关闭防火墙
$ service iptables stop
查看系统所有的后台服务进程
$ service --status-all
查看指定的后台服务进程的状态
$ service nginx status
$ service sshd stop
$ service sshd start
$ service sshd restart
chkconfig
设置防火墙开机不启动
$ chkconfig iptables off
查看开机启动服务列表
$ chkconfig
设置服务开机自启/不自启
$ chkconfig 应用 on
$ chkconfig 应用 off
firewall-cmd
查看状态是否运行
firewall-cmd --state
查看运行列表
firewall-cmd --list-all
命令开启端口防火墙
firewall-cmd --add-port=20080/tcp --zone=public --permanent
查看服务器性能
curl -Lso- bench.sh | bash
curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast
常用命令
systemctl start firewalld.service
systemctl enable firewalld.service
systemctl stop firewalld.service
firewall-cmd --state
iptables -nL
firewall-cmd --reload
firewall-cmd --permanent --zone=public --add-port=81/tcp
firewall-cmd --permanent --zone=public --add-port=8080-8083/tcp
firewall-cmd --permanent --zone=public --remove-port=81/tcp
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="6379" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.233" accept"
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.51" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.0/16" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="9200" accept"
firewall-cmd --reload