转载 postfix为一台服务器中的多个IP都启动一个:25端口

postfix为一台服务器中的多个IP都启动一个:25端口

<script></script>
<script></script>
1)修改main.cf中的inet_interfaces为 (此处为关键)
   inet_interfaces = $myhostname, localhost
   #inet_interfaces = all         #监听 0.0.0.0:25 这样无法再启动绑定的IP的25了,否则报25端口已经被使用
   #inet_interfaces = localhost   #只监听 127.0.0.1:25 这样外网无法访问到25, 只能本机访问
   #inet_interfaces = 192.168.1.6 #指定单个IP,则只监听这个IP的:25, 同样无法实现 多IP都启用:25

2)在master.cf最后添加多个IP的:25端口配置
   192.168.1.6:25 inet  n    -    n    -    -    smtpd -o content_filter=
   192.168.1.7:25 inet  n    -    n    -    -    smtpd -o content_filter=
   192.168.1.8:25 inet  n    -    n    -    -    smtpd -o content_filter=

3)为服务器绑定多个IP
  [root@ http://www.cnscn.org postfix]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
   TYPE=Ethernet
   DEVICE=eth0
   HWADDR=00:21:85:07:ef:3d
   BOOTPROTO=none
   ONBOOT=yes
   USERCTL=no
   IPV6INIT=no
   PEERDNS=yes
   IPADDR=192.168.1.6
   NETMASK=255.255.255.0
   GATEWAY=192.168.1.1

  [root@ http://www.cnscn.org postfix]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
   TYPE=Ethernet
   DEVICE=eth0:1
   HWADDR=00:21:85:07:ef:3d
   BOOTPROTO=none
   ONBOOT=yes
   USERCTL=no
   IPV6INIT=no
   PEERDNS=yes
   IPADDR=192.168.1.7
   NETMASK=255.255.255.0
   GATEWAY=192.168.1.1

  [root@ http://www.cnscn.org postfix]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:2
   TYPE=Ethernet
   DEVICE=eth0:2
   HWADDR=00:21:85:07:ef:3d
   BOOTPROTO=none
   ONBOOT=yes
   USERCTL=no
   IPV6INIT=no
   PEERDNS=yes
   IPADDR=192.168.1.8
   NETMASK=255.255.255.0
   GATEWAY=192.168.1.1

4)重新启动postfix
  service postfix restart
 
5)查看当前的监听情况
  [root@ http://www.cnscn.org postfix]# netstat -tnlp
   tcp  0  0 127.0.0.1:25      0.0.0.0:*  LISTEN 7008/master
   tcp  0  0 192.168.1.6:25    0.0.0.0:*  LISTEN 7008/master        
   tcp  0  0 192.168.1.7.28:25 0.0.0.0:*  LISTEN 7008/master        
   tcp  0  0 192.168.1.8:25    0.0.0.0:*  LISTEN 7008/master 

猜你喜欢

转载自liushuai-238.iteye.com/blog/668392