问题的具体现象:linux上控制台 ifconfig显示只有inet 127.0.0.1,而没有自己物理机上的192开头的地址:
https://blog.csdn.net/qq_40141862/article/details/86657408
结合这个帖子
1、sudo -i切换为root用户
2、输入dhclient -v
再输入ifconfig就可以看到多了一个ip地址
3、最后exit退出root
4、Ubuntu的话重启shh服务:
// 重启ssh 服务
sudo service ssh --full-restart
// 自动启动
sudo systemctl enable ssh
5、把known_host(windows下everyt搜一搜就能找到)里面的内容删除掉。
这时候在连接会提示:Are you sure you want to continue connecting (yes/no/[fingerprint])?
输入 yes 即可。
解决!
如果不行就重启一下VScode和虚拟机多尝试几次。