March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Configuring Postfix as a Null Client

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.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>