Q. How do I bind Postfix MTA to specific IP address such as 127.0.0.1 or 184.108.40.206?
A. Postfix allows you to listen on a particular IP address. By default MTA will list on all network interfaces and loopback. You need to setup inet_interfaces parameter. You need Postfix version 2.2 and later to use this feature. The parameter also controls delivery of mail to user@[ip.address].
Postfix IP address bind configuration
Open /etc/postfix/main.cf file:
# vi /etc/postfix/main.cf
Append / modify line as follows to bind to localhost (127.0.0.1) only:
inet_interfaces = 127.0.0.1
If you need to bind to 127.0.0.1 and 220.127.116.11, enter:
inet_interfaces = 18.104.22.168,127.0.0.1
Save and close the file. You need to stop and start Postfix when this parameter changes. So type the following to restart Postfix:
# /etc/init.d/postfix restart
Verify that everything is working fine:
# netstat -tulpn | grep 25
# tail -f /var/log/maillog