ssh登录错误ECDSA host key for ip has changed和Offending key for IP in /root/.ssh/known_hosts:1

首先我跟大家说一下我的遇到的问题,我这边有一台虚拟机服务器的ip地址有人改动了,之前服务器的地址为172.18.2.248,不知道怎么回事,ip地址变为172.18.2.237首先要改动ip,改动的操作如下:

首先使用ifconfig的命令看一下,目前你使用的那个网络配置:
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.2.237 netmask 255.255.255.0  broadcast 172.18.2.255
        inet6 fe80::20c:29ff:fe3a:6b1  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:3a:06:b1  txqueuelen 1000  (Ethernet)
        RX packets 174770  bytes 16314429 (15.5 MiB)
        RX errors 0  dropped 580  overruns 0  frame 0
        TX packets 18457  bytes 2849217 (2.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  这时候需要改动/etc/sysconfig/network-scripts目录下的
  ifcfg-eno16777736文件中的IPADDR=172.18.2.237的内容,改成172.18.2.248
  然后进行 /etc/init.d/network restart的操作

network启动成功后使用ssh 172.18.2.248节点的是后出现以下报错:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for node03 has changed,
and the key for the corresponding IP address 172.18.2.248
has a different value. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /root/.ssh/known_hosts:1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
f2:aa:b7:f8:15:94:80:e6:e9:b2:36:69:92:24:e8:8b.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:9
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

主要原因是因为之前本地访问过172.18.2.248的服务器,会把服务器(172.18.2.248登录标识证书记录下来,下次登录时会去比对之前的记录,由于修改了ip导致不能继续登录。
解决操作:

172.18.2.248执行
mv  /root/.ssh/known_hosts /root/.ssh/known_hosts.bak

随后在其他节点切换到172.18.2.248的时候报:

Warning: the ECDSA host key for 'node03' differs from the key for the IP address '172.18.2.248'
Offending key for IP in /root/.ssh/known_hosts:1
Matching host key in /root/.ssh/known_hosts:16
Last login: Tue Oct 29 20:07:12 2019 from node02

这时候对node02节点操作,操作步骤如下:

根据报错的信息:
对节点node02的/root/.ssh/known_hosts的第1行和16行进行删除,随后再执行
ssh-copy-id node03
在node02节点上切换到node03就不会报任何错误

参考链接:https://www.cnblogs.com/cap-rq/p/10155098.html
https://blog.csdn.net/qq_34901049/article/details/99828967

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值