Saturday, May 17, 2008

SMTP - How To Run SMTP On A Different Or Additional Port In Linux With Plesk

For one reason or another some people like to run their SMTP service on a port other than the standard TCP port 25. Whether it's to bypass their ISP's firewall, provide a second instance of SMTP, or maybe just to be different.

This article will show you a simple way to do this on a Linux server running the Plesk control panel.

In '/etc/xinetd.d/' there is a file called smtp_psa, you will need to copy this file to another filename (in this example I'll use smtp2_psa).

In this new file, you will want to change the line:
'service smtp' to 'service smtp2'

Once this is complete, you will need to modify your /etc/services file, and add the smtp2 service: Simply copy/paste the existing smtp line and change the name and port (we'll use port 26 in this example).

smtp2 26/tcp mail smtp2 26/udp mail
Restart xinetd. # /etc/init.d/xinetd restart

Check to make sure the new port is now listening # netstat -plunt |grep :26

That should return something similar to

tcp 0 0 0.0.0.0:26 0.0.0.0:* LISTEN 2345/xinetd
You can test this connection from the outside by trying to telnet to port 26 on the server. From a linux shell or Windows command prompt enter

# telnet 123.123.123.123 26

(be sure to replace 123.123.123.123 with your server's real IP address) If it's successful it should return something similar to

Trying 123.123.123.123... Connected to hostname.domain (123.123.123.123). Escape character is '^]'. 220 hostname.domain.tld ESMTP
Enter 'quit' to quit the telnet session.

Travis is a freelance server administrator and computer consultant at Serverjuice
For more howtos and guides visit Howto Monster

You will also need to modify the port in your mail client to use the new SMTP port.

White 2 X 6 And 2 X 2 Handrailing

No comments: