查看防火墙状态
systemctl status firewalld
开启防火墙
systemctl start firewalld
关闭防火墙
systemctl stop firewalld
开启防火墙
service firewalld start
若遇到无法开启
先用:systemctl unmask firewalld.service
然后:systemctl start firewalld.service
查看端口是否已开:
firewall-cmd --query-port=6379/tcp
添加指定需要开放的端口:
firewall-cmd --add-port=123/tcp --permanent
重载入添加的端口:
firewall-cmd --reload
移除指定端口:
firewall-cmd --permanent --remove-port=123/tcp
修改ssh端口
vi /etc/ssh/sshd_config
systemctl restart sshd
网友评论