Possible to run Qmail (SMTP) on port 25 and 26?

Bellsouth just decided to block port 25, but I want to use my server as a smarthost for my mail server on the DSL line. So can I setup an InterWorx box to listen on port 25 and 26 for SMTP connections?



The easiest route is to edit /etc/services and change the :

smtp            25/tcp          mail

line to read:

smtp            26/tcp          mail

The restart qmail:

service smtp restart

verify you’ve got a listener on port 26 by running ‘netstat -ln’


On this same note, is it possible to have Qmail forward incoming emails for a particualar domain to another SMTP server on a port other than port 25?

Beacause now my mail server on the DSL can’t receive incoming emails b/c of port 25 being blocked, but port 26 isn’t blocked :smiley:

Thanks for your help Chris, I know this isn’t really a direct InterWorx issue and I appretiate your guys help.

Is it possible to have a listener on port 25 and 26 at the same time?

Beacuase I still need my InterWorx box to listen on port 25 for all outside emails and 26 for the smart host for my exchange server.

Thanks again,

Actually, the above I suggested may do both for your entire server (in + out). If you just want to do inbound smtp then edit /service/smtp/run and change the “smtp” mention in the rather large command line to “26”.

I don’t think forcing outbound SMTP for a given vhost is (easily) doable. Server wide is possible, but without running multiple qmails I don’t believe you can easily do it.


I tried this for Qmail fowarding for a particualar domain according to the following page:

I added the following to my smtproutes in /var/qmail/control

So it will forward all email destine for mydomain.com to my other mail server at mail.otherdomain.us on port 26.

This kind of worked so far. I finally got the email from the server that send me the logs for the day. So I’m not sure if the smtproutes is only effect for emails that originate form the server itself. I sent an email from a yahoo.com account to an email @mydomain.com, but still haven’t gotten it yet. But since I just changed the MX record 10 mins ago, maybe it will work after some propogation time.

Thanks for you help,

I’ll post back here if the above works just for info for other people with similar problems.

Very cool Justin, learn something new every day :). Glad it’s working.


Ok, its working fully now.

The last problem was my domain that I wanted to do the relay for was not in the rcpthosts file. I added the domain and its working now.

Hope this helps.

I still haven’t been able to figure out how to run Qmail simultaneously on both port 25 and 26.

I tried:

smtp 25/tcp mail
smtp 25/udp mail
smtp 26/tcp mail
smtp 26/udp mail

But that only listens on port 25, its basically like the 26/tcp and 26/udp line are not even there. I’m going to keep googling around and see what else I can come up with. Any ideas are welcome :D.


By the way, changing the line from 25 to 26 by itself does make it listen on port 26, but then it doens’t listen on port 25 anymore.

You can’t have 2 TCP or 2 UDP lines in /etc/services with the same name, this is the prob. To run 2 qmails just do the following:

cd /service
cp -R smtp smtp2

Then edit /service/smtp2/run and change:

exec /usr/bin/softlimit -m 3800000 \
     /usr/bin/tcpserver -v -R -S -p -x $TCP_CDB -c "$MAXSMTPD" \
     -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \


exec /usr/bin/softlimit -m 3800000 \
     /usr/bin/tcpserver -v -R -S -p -x $TCP_CDB -c "$MAXSMTPD" \
     -u "$QMAILDUID" -g "$NOFILESGID" 0 26 \

That should give you 2 smtp daemons, one on port 25 and one on 26.


First off, Thanks for all your help. I finally got it all up and running exactly how I pictured it.

I did what you suggested. It worked, there were 2 SMTP servers (one on each port) but running netstat showed that port 25 was running as TCPSERVER and port 26 was running as XINETD. This didn’t work because it has to run as TCPSERVER so that Qmail will relay for my DSL static IP.

Not sure if what I did next was correct, but its working now. I went to the /etc/init.d directory and copied smtp to smtp2 to make a seperate service (Before it started both, but I couldn’t shut down port 26, if I did service smtp stop it would just stop port 25). I then put a smtp2 line into the /etc/services file.

smtp 25/tcp mail
smtp 25/udp mail
smtp2 26/tcp mail
smtp2 26/udp mail

When I did it like this now port 25 is running as XINETD and port 26 is running as TCPSERVER. Not sure how or why they swapped (I wish I knew why), but now it works b/c port 26 is the SMTP server I need to be able to relay with. I think the ideal would be to have both running as TCPSERVER.

Is there any negative effect by running port 25 as XINETD?

I guess I need better understanding of how the underlying linux system works. Thanks again for all your help, the workaround to the port blocking seems to be working great, so Bellsouth can take its Business class (not blocked) DSL and… :rolleyes:


same trouble

Hey - I appreciate this thread as well as I feel as though I’m on the correct path; however, I’m not there yet. I copied /service/smtp to /service/smtp2 (in my case /var/qmail/supervise/qmail-smtpd to /var/qmail/supervise/qmail-smtpd2) and edited the run file as you suggested, but when I restart qmail, the second smtp server doesn’t start. If I go in and execute the run file in /var/qmail/supervise/qmail-smtpd2, I see the port Listening in a netstat -a, but if I try to telnet in or send a message on that port, I get a timeout error. Any suggestions?

Thanks again!!


Actually the new NodeWorx has a built in smtp2 now, you just have to go to the mail settings in NodeWorx an enable it.