Configuring Postfix as a Null Client
This howto assumes that the relay server’s IP address is 192.168.1.22 and is running RHEL/CentOS 7. Only mail from the 192.168.1.0/24 network should be accepted and relayed.
Install Postfix
[root@rhce-server ~]# yum install postfix
Configure Systemd
[root@rhce-server ~]# systemctl enable postfix
[root@rhce-server ~]# ^enable^start
Configure the Firewall
[root@rhce-server ~]# firewall-cmd –add-service=smtp
success
[root@rhce-server ~]# firewall-cmd –add-service=smtp –permanent
success
Configure Postfix
Postfix’s main configuration file is located at /etc/postfix/main.cf.
Configure Postfix to listen on the correct interface.
inet_interfaces = all
Configure the trusted network.
mynetworks = 192.168.1.0/24
Configure the list of domains that this Postfix service should consider itself the final destination for. In my case the server is named rhce-server.
mydestination = rhce-server, localhost.localdomain, localhost
Configure all mail not destined for this server to be relayed to another SMTP server. The brackets tell Postfix to turn off MX lookups.
relayhost = [smtp-server.rmohan.com]
Restart Postfix
[root@rhce-server postfix]# systemctl restart postfix
Send a Test Email
[root@rhce-server postfix]# mail -s “rhce-server test” josh@example.com
testing our null postfix configuration
.
EOT
With any luck we should be all set. You can verify the mail was successfully relayed in /var/log/maillog.
Recent Comments