歡迎您光臨本站 註冊首頁

如何讓sendmail 只監聽 某1個 IP 的 25 埠

←手機掃碼閱讀     火星人 @ 2014-03-05 , reply:0

如何讓sendmail 只監聽 某1個 IP 的 25 埠

我們公司由於DNS server出現故障,將DNS的功能移到了 mail server上

由於在DMZ,不想修改 Firewall rule ,就臨時在mail server上幫定了2個IP

我的問題是如何讓sendmail 只監聽 某1個 IP 的 25 埠, 而不是監聽整個Interface?

#netstat -an
TCP: IPv4
   Local Address        Remote Address    Swind Send-Q Rwind Recv-Q  State
-------------------- -------------------- ----- ------ ----- ------ -------
      *.*                  *.*                0      0 24576      0 IDLE
      *.22                 *.*                0      0 24576      0 LISTEN
          *.111                *.*                0      0 24576      0 LISTEN
      *.*                  *.*                0      0 24576      0 IDLE
            *.25                 *.*                0      0 24576      0 LISTEN
《解決方案》

tcpdump -i eth0 |grep 192.168.1.31
《解決方案》

回復 2樓 hai0088 的帖子

我是想在sendmail 啟動時只在特定的IP 上開啟25 port,比如192.168.1.31 ,127.0.0.1,因為是1個網卡綁2個IP

用netstat看時

不是顯示
            *.25                 *.*                0      0 24576      0 LISTEN

而是顯示
       192.168.1.31 .25                 *.*                0      0 24576      0 LISTEN

            127.0.01 .25                 *.*                0      0 24576      0 LISTEN


也就是只在1 個IP上打開25 埠
《解決方案》

lsof -i:25

lsof -i:25
《解決方案》

其實我倒是覺得沒有必要這樣.
不過也可以監聽所有,在iptables做個限制不就罷了么!
《解決方案》

我們的OS 是Solaris 9 ,由於是在DMZ的關鍵伺服器,不可能裝netfilter之類的東西

只能在Sendmail 啟動是想辦法

也就是在設置Sendmail cf文件, 在啟動時只監聽特定IP 的25 port ,比如192.168.1.1 , 127.0.0.1
《解決方案》

找點 sendmail 中關於 DaemonPortOptions 的用法
《解決方案》

DAEMON_OPTIONS(`Port=smtp,Addr=192.168.1.1, Name=MTA')dnl
DAEMON_OPTIONS(`Port=25, Name=MSA, M=Ea')dnl
《解決方案》

謝謝 abel 和 marion 2位大俠,按照你們的方法搞定了

thanks a lot

[火星人 ] 如何讓sendmail 只監聽 某1個 IP 的 25 埠已經有292次圍觀

http://coctec.com/docs/service/show-post-44233.html