CentOS connect:fail, reason: connect server 22 port fail
分析原因:
连接端口22 失败
(1) 端口原因:明显对外开放的端口并没有打开
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
(2) 服务原因:端口对应的服务sshd没有启动,
/usr/sbin/sshd
(3) 路由设置原因:设置了路由转发导致的连接失败,
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -p FORWARD -j ACCEPT
(4) 网络的原因: 通过远程xshell连接失败,
ifconfig
systemctl status network
systemctl restart network
(5) IP原因:配置的IP根本不是使用xshell连接的IP
ifconfig
cd /etc/sysconfig/network-scripts/
ls
(6) 登录用户的权限原因
(7) 根本就没有配置openssh
rpm -qa | grep ssh
yum install openssh* -y
(8) 未设置开机自启动
chkconfig – level 3 sshd on