在 Linux 中将 IP 映射到主机名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4398300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 00:15:06  来源:igfitidea点击:

Map IP to hostname in linux

linux

提问by SPB

Is there any file in linux where IP can be mapped to hostname.Please tell me the path

linux中是否有IP可以映射到主机名的文件。请告诉我路径

As we have in windows: By changing in host file we can map a static ip to a host name.

正如我们在 Windows 中所做的那样:通过更改主机文件,我们可以将静态 ip 映射到主机名。

采纳答案by Joel

Do you mean the /etc/hosts file?

你是说/etc/hosts 文件吗?

/etc/hosts

Typical entries might look like:

典型的条目可能如下所示:

127.0.0.1   localhost
127.0.0.1 sagan
192.168.1.87 bohr