|
Apr
15
|
Due to the increase in the number of ISP’s blocking port 25 for third party mailservers I decided to setup my mailserver to answer SMTP request on multiple ports. While this can be accomplished in many ways, such as port forwarding or multiple instances of qmail-smtpd, my situation required setting up a second instance or qmail-smtpd.
The setup process is fairly straight forward. Here are the steps I took to accomplish my goal:
First you will need to stop qmail and make a copy of your qmail-smtpd directory located in /var/qmail/supervise/smtp. I called my new copy /var/qmail/supervise/smtp2. Once the copy had been completed I then needed to edit the run file located in the smtp2 directory. This was a simple change to add the port number I wished to have qmail-smtpd run on. Here is an example:
from:
/usr/local/bin/tcpserver -H -v -R -l “$LOCAL” -x /etc/tcp.smtp.cdb -c “$MAXSMTPD” -u “$QMAILDUID” -g “$NOFILESGID” 0 smtp \
to:
/usr/local/bin/tcpserver -H -v -R -l “$LOCAL” -x /etc/tcp.smtp.cdb -c “$MAXSMTPD” -u “$QMAILDUID” -g “$NOFILESGID” 0 2525 \
Notice the 2525 which is the second port I will be running. Please be aware that this line may be different depending on your installation of QMail. My installation was based on the Life with Qmail instructions and also the addition of SpamAssassin, SpamHaus RBL, relay-ctrl-chk and ClamAV.
With this change complete I needed to update the run file located in the /var/qmail/supervise/smtp2/log directory. I just changed the logging path to log to a second log named smtp2.
Start qmail.
verify: “netstat -natp|grep tcpserver” and you should see:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 31692/tcpserver
tcp 0 0 0.0.0.0:2525 0.0.0.0:* LISTEN 31735/tcpserver
December 6th, 2009 at 11:52 pm
Or, to spare resources you could use port translation. To make your box full RFC compliant:
iptables -t nat -A PREROUTING -p tcp -m tcp –dport 465 -j REDIRECT –to-ports 25
iptables -t nat -A PREROUTING -p tcp -m tcp –dport 587 -j REDIRECT –to-ports 25
iptables -t nat -A OUTPUT -p tcp -m tcp –dport 465 -j REDIRECT –to-ports 25
iptables -t nat -A OUTPUT -p tcp -m tcp –dport 587 -j REDIRECT –to-ports 25
December 7th, 2009 at 12:18 am
Yes.. But if you use NAT you may have problems with conntrack table. I only load module iptables_nat when is strictly necessary.
December 20th, 2009 at 2:03 am
he used the same technique in the end and it worked
September 25th, 2010 at 12:17 am
Hey,
I tried this and for some reason when I start qmail back up, it doesn’t find my second smtp server. I tried running the run file, but that just says it’s listening if I do a netstat. If I try to connect to port 2525, I get no response. Let me know if you have any ideas!
Thanks!
September 25th, 2010 at 9:06 am
Missy : maybe you are doing something wrong.
September 30th, 2010 at 2:39 pm
Have you checked, that you port is open in your firewall?
February 9th, 2011 at 4:27 pm
Hello,
I have a question: what are all qmail ports? except 25 and 2525
July 15th, 2011 at 8:51 am
Your a bloody star!