现在一安装firewalld 所有端口就关闭了 服务器都上不去
wuzhi-dev opened this issue · 2 comments
wuzhi-dev commented
现在一安装firewalld 所有端口就关闭了 服务器都上不去
wuzhi-dev commented
请试试以下执行,将22端口提前到到防火墙
firewalld 停止后执行:
-
离线模式打开22端口
firewall-offline-cmd --direct --add-rule ipv4 filter INPUT 0 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -
延迟5分钟重启系统,避免防火墙不让连ssh时自动重启系统
shutdown -r +5 "Enabling firewall. If access is lost, server will restart in 2 minutes."
3.启动防火墙
systemctl start firewalld
-
测试是否可以连接ssh
-
第4步没有问题的话,取消第二步的系统重启
shutdown -c -
配置自启动防火墙,并将firewall-offline-cmd策略刷到持久策略中
systemctl enable firewalld
firewall-cmd --runtime-to-permanent
L-69 commented
研究了一下 系统自带的ufw防火墙先关闭了 就不会这样了