0

I'm having a hard time setting up an email server. I decided to go with and E2C instance (specifically, with light-sail) running Ubuntu. On the server, I've put postfix on the server more or less following this guide to the letter. From postfix, I'm able to send an email (and receive it at Gmail). However, I'm not able to receive any mail when I send an email back to my server from my Gmail.

I slam my domain name for the server into mxtoolbox and it tells me "failed to connect"

So I thought to myself... either that port is closed (firewall somewhere) or there isn't a server listening on that port.

I made sure to...

sudo ufw allow Postfix

On the server I...

telnet 'mydomain' 25
Trying 'ip' ...
telnet: Unable to connect to remote host: Connection timed out

Just to see if the server is up and running...

telnet 'mydomain' 80
Trying 'ip' ...
Connected to 'mydomain'

So no new info. So I tried...

netstat -lntu
proto     Recv-Q    Send-Q    Local address    Foreign Address   State
tcp            0         0    0.0.0.0:25       0.0.0.0:*         LISTEN
tcp6           0         0    :::25            :::25             LISTEN
(other lines omitted)

So it would seem that something has opened that port and is listening to it, but... I can't figure out why no connection gets through.

Please give me some trouble shooting ideas on this. I'll add more information as it is asked for if its needed.

edit: more info & spelling

2 Answers2

0

sudo ufw allow Postfix

Should not work as there is no service named Postfix registered in /etc/services. man ufw

Use either the SMTP port:

 sudo ufw allow 25/tcp

or the correct service name:

 sudo ufw allow smtp 
HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • I entered in those commands, but it returned with "Skipping adding existing rule" So I think somewhere along the line of trying to fix this I had those rules in place already. Or have I misunderstood what I should do? – TheJakester42 Sep 11 '17 at 14:45
0

I figured it out! after some more digging...

I got

telnet localhost 25

to work. So the server is up and alive, that left only the networking and ports to be looked at.

The server wasn't blocking the port, so that left either the network or the ISP blocking that port. Since the server is an E2C server (specifically light-sail), I thought that either were impossible. I was wrong. The isp that amazon uses is fine, HOWEVER! Amazon blocks all ports except 22 and 80. You need to go to your instance, go under the networking tab, and add a tcp port at port 25. Now...

telnet 'mydomain' 25
Trying 'myIp'
Connected to 'mydomain'

Thanks for the help! I hope this helps others.

  • *"You need to go to your instance, go under the networking tab, and add a tcp port at port 25."* What exactly are you talking about, here? Where is the "networking tab?" Is this a Lightsail instance? – Michael - sqlbot Sep 11 '17 at 23:45
  • My bad, I do mean Lightsail. If you click on an instance when looking at your lightsail dash, there should be some tabs near the top (but not at the top). the tabs are "connect", "Metrics", "Networking", "snapshots" , "history", "delete". I mean the networking tab there. There you should see a list of ports that are white listed (designated to be NOT-BLOCKED). Simply add the type of port you want at the right port number (SMTP was a TCP port at port 25, I named mine custom). After that, everything worked fine. – TheJakester42 Sep 12 '17 at 15:24
  • You should correct your question to reflect that this is Lightsail, not EC2. The hardware is the same but the platforms are very different. – Michael - sqlbot Sep 12 '17 at 17:05