为什么hostname -f只有域名在/ etc / hostname时给我子域名?

在我的/ etc / hostname(Ubuntu 14.04)文件中我有:

pavel@subdomain:~$ cat /etc/hostname example.ru 

但是当我运行:

 hostname -f 

表明:

 pavel@subdomain:~$ hostname -f subdomain.example.ru 

它可能(100%)影响我的后缀configuration,当我试图将其configuration为只发送SMTP服务器,并发送邮件“[email protected]”发件人地址。

在我的情况下如何以及在哪里避免子域名? 谢谢!

主机名应该包含服务器的名称,例如athena.zertux.net是我的子域,在我将把athena的主机名。

/etc/hosts文件可以包含IP地址到域/子域的映射。

在你的情况下:

 127.0.0.1 localhost 127.0.0.1 example.ru 

如果您的域名需要特定的IP,则可以更改127.0.0.1

hostname -fhostname -f名给出的名称parsing为IP,然后在该地址上进行反向查找,以便将名称返回给您。

在您的具体情况下,您的DNS(或/etc/hosts )将example.ru转换为IP地址,然后反转回subdomain.example.ru ,这就是名称的来源。