Question

Can't Open Port 25

Posted April 1, 2014 9.3k views
I've been trying to open port 25 for postfix, and I can't figure out what I'm doing wrong. I can't telnet to the server with port 25, while I can telnet to other, like TeamSpeak3s port (30033). This is what my iptables looks like. # Generated by iptables-save v1.4.7 on Tue Apr 1 15:24:14 2014 *filter :INPUT ACCEPT [1326:1570360] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [841:176823] -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT COMMIT # Completed on Tue Apr 1 15:24:14 2014

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
5 answers
Is there anything running on port 25?
sudo netstat -plutn | grep 25
sudo netstat -plutn | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 28291/master
tcp 0 0 ::1:25 :::* LISTEN 28291/master
I am trying to open the port for posfix, but the server can't receive any emails. After a while I get this response on gmail, trying to send an email:

Technical details of temporary failure:
The recipient server did not accept our requests to connect. Learn more at http://support.google.com/mail/bin/answer.py?answer=7720
[(0) mydomain.com. [xxx.xxx.xxx.xxx]:25: Connection refused]
Postfix is listening on the loopback interface. You have to configure it to listen on 0.0.0.0. See http://www.cyberciti.biz/faq/postfix-receive-mail-on-specific-network-interfaces/.

Hello all,

You can use UFW in order to allow connections on ports 25, 465 and 587

UFW, or Uncomplicated Firewall, is a simplified firewall management interface that hides the complexity of lower-level packet filtering technologies such as iptables and nftables

To allow connections on ports 25, 465, 587 execute the following commands:

sudo ufw allow 25/tcp

sudo ufw allow 465/tcp

sudo ufw allow 587/tcp

You can check our existing tutorial on how to setup a Firewall with UFW here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04

If you’re still unable to send emails I will recommend you to try using alternative ports as 587 and 465, because a lot of providers will block connections/emails sent without authentication on port 25 as well.

Hope that this helps!
Regards,
Alex

by Brian Boucheron
This tutorial will show you how to set up a firewall with UFW on Ubuntu 20.04.