Postfix – Setting the bind IP

To set the bind address for postfix, do the following.

sudo vi /etc/postfix/main.cf

Locate the section that has the following

inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost

Add a “#” to all current lines, then add a new line which contains localhost and the ip of your server that you wish people to be able to connect to, separated by a comma. for example

#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost, 192.168.2.1

Then restart postfix

sudo service postfix restart

Then check netstat to ensure its now listening on that port.

[root@myserver ~]# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.2.1:smtp *:* LISTEN
tcp 0 0 localhost:smtp *:* LISTEN

You should now be able to connect to your server on port 25 on the ip address you added to the config file.

Enjoy

Postfix , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *