linux防火墙常用命令
以下的*号,表示你要开启或者关闭的端口号
安装Firewall命令:
yum install firewalld firewalld-config
Firewall对外开启永久端口号命令:
firewall-cmd --zone=public–add-port=*/tcp --permanent
Firewall关闭常见端口命令:
firewall-cmd --zone=public–remove-port=*/tcp --permanent
批量添加区间端口
firewall-cmd --zone=public–add-port=-/udp --permanent
firewall-cmd --zone=public–add-port=-/tcp --permanent
开启防火墙命令:
systemctl start firewalld.service
重启防火墙命令:
firewall-cmd --reload 或者 service firewalld restart
查看端口列表:
firewall-cmd --permanent --list-port
禁用防火墙
systemctl stop firewalld
设置开机启动
systemctl enable firewalld
停止并禁用开机启动
sytemctl disable firewalld
查看防火墙状态
systemctl status firewalld或者firewall-cmd --state
#/etc/init.d/iptables status
关闭防火墙服务:
#/etc/init.d/iptables stop
查看端口号的状态
ps -ef | grep *
nginx的开启和关闭命令
./nginx -s stop
./nginx
./nginx -s reload