执行“systemctl start firewalld” 时,ssh连接怎么断开了?
正常情况下,firewalld是默认开启ssh服务的,当我们开启firewalld的时候,不会影响ssh连接。这个我们可以通过查看firewall配置文件确认。
命令如下
cat /etc/firewalld/zones/public.xml
但其实,防火墙开放服务时,会开放服务的默认端口。可以检查ssh端口是否是默认端口22.
[root@localhost services]# cat /etc/ssh/sshd_config |grep Port
Port 2666
#GatewayPorts no
[root@localhost services]#
端口并不是22. 。可以在public.xml文件中添加2666端口,就不会断开ssh连接了。
[root@localhost /]# cat /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="ssh"/>
<service name="dhcpv6-client"/>
<port protocol="tcp" port="2666"/>
</zone>
[root@localhost /]#