我已经连接了一个raspberry pi 4运行的ubuntu 20.04到我的本地局域网通过wifi。
从我的笔记本电脑,我可以SSH和覆盆子
$ ssh ubuntu@192.168.0.47
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1022-raspi aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
...我不需要每次输入那个IP,而是希望能够使用主机名:rasp01对它进行SSH。我找到了这份指南:
https://thepihut.com/blogs/raspberry-pi-tutorials/19668676-renaming-your-raspberry-pi-the-hostname
我一直在跟踪的。在重新启动raspberry pi并登录到它之后,我有以下内容:
ubuntu@rasp01:~$ hostname
rasp01
ubuntu@rasp01:~$ cat /etc/hosts
rasp01 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
ubuntu@rasp01:~$ cat /etc/hostname
rasp01但是,当我尝试使用这个主机名时,当我在同一个LAN (也在运行ubuntu)上从我的笔记本上SSH到raspberry时,我得到:
$ ssh ubuntu@rasp01
ssh: Could not resolve hostname rasp01: Name or service not known
$ ssh ubuntu@rasp01.local
ssh: Could not resolve hostname rasp01.local: Name or service not known
$ ssh ubuntu@rasp01.local.
ssh: Could not resolve hostname rasp01.local.: Name or service not known我遗漏了什么?
发布于 2020-12-11 21:48:45
Stack的超级用户部分主要针对超级用户。这是一个很好的资源,SOHO网络问题,如您。这个网站是为网络工程专业人士,所以你的问题实际上不是主题在这里。
然而,有几种方法可以做你想做的事情,其中包括:
/etc/hosts添加一个条目,将rasp01映射到192.168.0.47~/.ssh/config文件,添加一个主机条目https://networkengineering.stackexchange.com/questions/71514
复制相似问题