I need to open the 25 TCP port on my Raspberry Pi 3, I watched videos on the internet (iptables) nothing works, if you have a solution, using iptables or another method, that would be great.

If you want to know, I'm building an SMTP mail server and I have errors like "connection timed out" (with postfix) when I try to send a mail, (that's why I think port 25 is the problem, because it's closed)

  • Have you enabled any kind of firewalls? Raspbian doesn't have an active firewall by default, so anything that's getting blocked is likely due to something you did. – Jacobm001 Jul 3 '17 at 14:41
  • When you say try to send a mail do you mean from the RPi or another computer? – Jacobm001 Jul 3 '17 at 14:41
  • both questions = yup, the problem was in the config, and hostname resolved now – Mazeo Jul 3 '17 at 21:00
  • I send from RPI – Mazeo Jul 22 '17 at 3:34

You likely don't have issues with iptables, unless you installed and configured it as it is not running on a default Raspbian install. Also the default install will normally open and listen on the required ports. However, if you intend on running a mail server you should install and configure a firewall first, as your server will be a prime target for spammers etc. Properly securing a mail server involves considerably more than a firewall though.

As for port 25 It may be blocked by your ISP. I would suggest you implement SSL for your ingoing and outgoing mail which means that you will no longer be using port 25. The default configuration file should have automatically opened the port and be listening.

However, to answer your question you can see if the port is open and what process is listening with the following command:

sudo netstat -lptu

Additionally you can test your basic configuration using telnet as described in this post.

Depending on why you want an email server you may be better off just setting it up to forward all nonlocal mail through your Gmail account. I have not used it recently but this script makes that exceptionally easy.

  • It seem to work ! thanks, actually the problem was both with SSL, and also my fault for badly configuring hostname and domainname. You helped a lot, thanks. – Mazeo Jun 29 '17 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.