作者:tacy lee
今天在配置confluence郵件功能的時(shí)候,啟動(dòng)sendmail竟然需要很長(zhǎng)時(shí)間,網(wǎng)上查了查,有很多人碰到類似問題,但是一般都是關(guān)掉sendmail服務(wù)或者關(guān)掉dns了事,咱們現(xiàn)在要用它,自然不能關(guān)掉了事,dns也不能關(guān),關(guān)了服務(wù)器沒法解析域名
毫無疑問,sendmail去做dns lookup,并且無法lookup到域名,在等待解析超時(shí)!
resolv里面也指定了nameserver,應(yīng)該能正常做dns解析了,既然他無法解析域名,自然這是個(gè)本地域名,難道是hosts里面的問題,查看了一下hosts文件:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.28 rdosrv
好像也沒發(fā)現(xiàn)啥不對(duì)的,他在解析啥呢,看看log去,找到/var/log/maillog(也可能在messages),看到如下內(nèi)容:
Dec 11 14:25:01 rdosrv sendmail[22710]: starting daemon (8.13.8): SMTP+queueing@01:00:00
Dec 11 14:25:01 rdosrv sm-msp-queue[22717]: My unqualified host name (rdosrv) unknown; sleeping for retry
Dec 11 14:28:08 rdosrv sendmail[22803]: My unqualified host name (rdosrv) unknown; sleeping for retry
Dec 11 14:35:23 rdosrv sendmail[22944]: My unqualified host name (rdosrv) unknown; sleeping for retry
Dec 11 14:35:57 rdosrv sendmail[22962]: My unqualified host name (rdosrv) unknown; sleeping for retry
Dec 11 14:36:54 rdosrv sendmail[22979]: My unqualified host name (rdosrv) unknown; sleeping for retry
竟然是無法解析rdosrv,有點(diǎn)意思,直接去ping rdosrv自然是沒問題,突然想到好像FQDN里面規(guī)定域名必須用"."結(jié)尾,難道是hosts里面少了一個(gè)".",嘗試修改hosts文件:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.28 rdosrv. rdosrv
啟動(dòng)sendmail,刷一下就啟動(dòng)了,呵呵
回頭想想,問題其實(shí)很簡(jiǎn)單,但是在網(wǎng)上卻沒找到什么好的方案,說明都挺懶得,能繞都繞過去了.