Virtual DNS is the reason caused this problem.
What is the meaning of "bogon"? "bogon" means the type of IP addresses that should not appear in a traceroute, like a reserved IP address. The DNS server can give your machine a host name, this function should be turned off for public DNS servers. Since the machine uses a router, so it has a IP like 192.168.0.x in LAN, this IP will be sent to the DNS server for a reverse lookup, and since it is a reserved IP address, the DNS server returns a hostname as, thus, changes the machine's hostname.
Solution:
1 sudo hostname your-desired-host-name
2 sudo scutil --set LocalHostName $(hostname)
3 sudo scutil --set HostName $(hostname)
本文解释了在网络路由中出现预留IP(如192.168.0.x)的原因,并详细说明了这些IP如何被错误地用于DNS逆向解析,进而导致主机名发生变化的问题。此外,还提供了具体的解决方案来修复该问题。

被折叠的 条评论
为什么被折叠?



