不一致的域名从主机名-f和域名

我正在设置一个Postfix邮件服务器,主机名“字母”,来处理域“example.net”的邮件。 我试图设置字母的域名到example.net使用nis,但我得到不一致的输出从主机名-f('letters.stuff.comcast.net')和域名('example.net')我如何设置域名so hostname -f命令来报告“example.net”? 这对于正确的Postfix函数有多重要?

主机信件正在运行Ubuntu,并通过有线调制解调器通过openwrt路由器连接到互联网Comcast。 域example.net的名称服务器位于远程Debian计算机上,该计算机尚未configuration为创build主机或字母的别名。

我假设主机名输出中的域名反映了由框的dhcp客户端从comcast服务器获得的域名,并且反映了该框是该networking上的客户端的想法。 解决scheme是在example.net的名称服务器上创build“字母”主机? 这是否需要将名称服务器添加到字母resolv.conf文件中列出的名称服务器?

确保你的/etc/hosts (或者NIS)条目是正确的。

我试图解释它,但是手册更好地讲述了这个故事:

 THE FQDN You can't change the FQDN (as returned by hostname --fqdn) or the DNS domain name (as returned by dnsdomainname) with this command. The FQDN of the system is the name that the resolver(3) returns for the host name. [..] Therefore it depends on the configuration (usually in /etc/host.conf) how you can change it. Usually (if the hosts file is parsed before DNS or NIS) you can change it in /etc/hosts. 

我昨天遇到这个问题,而在其他人开始的服务器刷新工作…主机名-f输出从来没有正确的结局域(缺less.org)。

 # hostname foobar.example.org # hostname -f foobar.example # # cat /etc/hosts 10.20.11.244 foobar.example foobar 

解决scheme:

主机名-f的域部分似乎来自该主机的/ etc / hosts项。 在我修改了/ etc / hosts中的主机名之后,hostname -f返回了正确的域:

 # hostname foobar # hostname foobar # hostname -f foobar.example.org 

因人而异。

如果你的IP不是静态的,那么/etc/hosts不会为你工作(或者只会暂时工作,直到你得到一个新的IP)。 我不确定这是否会奏效,但这里有一些可以尝试的地方:

  1. configuration您的DHCP客户端不要求从DHCP服务器的域名。 或者只是告诉它不要触及resolv.conf,如果你有自定义的名称服务器,你可能已经完成了。
  2. /etc/resolv.conf中将您的域名设置为example.net
  3. 确保你的域名服务器可以parsingletters.example.net ,我想你将需要使用某种dynamicDNS服务,因为这个解决scheme是用于非静态的IP。

这可能意味着我对你的问题的回答只是“是”。

这是“域名”常被误解的问题。 以下是我的Mac OS X系统上手册页的顶部,但是您的类似:

 DOMAINNAME(1) BSD General Commands Manual DOMAINNAME(1) NAME domainname -- set or print the name of the current NIS domain 

此命令不用于DNSconfiguration!