查看防火墻狀態(tài)
systemctl status firewalld
開啟防火墻
systemctl start firewalld
關(guān)閉防火墻
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