0

Recently I transferred my domain to NoIP, and I had to create a mail server.

(I had to transfer to noip because I can't setup a static/fixed ip as I am particular not a business, and I don't have a business taxpayer number to get a business line in my ISP...)

But I can't connect to it in my email client.

I followed this tutorial: https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mysql

I assigned/forwarded/opened IMAP, SMTP, POP, and LDAP ports to my Ubuntu Machine in my router:

And I created a mx record in cr7akg.com: cr7akg.com 10 :

Images

The output of telnet cr7akg.com 25 and telnet cr7akg.com smtp are:

Trying 85.245.177.97...
telnet: connect to address 85.245.177.97: Connection refused
telnet: Unable to connect to remote host

What I'm missing? Why I can't connect to email server with my email client?

Output of sudo netstat -panet

Ligações de Internet Activas (servidores e estabelecidos)
Proto Recv-Q Send-Q Endereço Local          Endereço Remoto         Estado       User       Inode       PID/Program name
tcp        0      0 0.0.0.0:7300            0.0.0.0:*               ESCUTA      1001       12435       1231/perl       
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               ESCUTA      117        95382       7965/mysqld     
tcp        0      0 192.168.1.104:27754     0.0.0.0:*               ESCUTA      1001       12434       1231/perl       
tcp        0      0 127.0.0.1:587           0.0.0.0:*               ESCUTA      0          138499      18957/sendmail: MTA
tcp        0      0 0.0.0.0:21              0.0.0.0:*               ESCUTA      0          103425      9641/vsftpd     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               ESCUTA      0          11938       1480/dnsmasq    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               ESCUTA      0          10481       940/sshd        
tcp        0      0 127.0.0.1:631           0.0.0.0:*               ESCUTA      0          205310      9231/cupsd      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               ESCUTA      0          138498      18957/sendmail: MTA
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               ESCUTA      1000       212857      10119/4         
tcp        0    264 192.168.1.104:22        192.168.1.90:62312      ESTABELECIDO 0          213850      10052/sshd: diogosa
tcp        0      0 192.168.1.104:48086     88.81.132.153:7301      ESTABELECIDO 1001       166071      1231/perl       
tcp6       0      0 :::80                   :::*                    ESCUTA      0          123277      7474/apache2    
tcp6       0      0 :::22                   :::*                    ESCUTA      0          10483       940/sshd        
tcp6       0      0 ::1:631                 :::*                    ESCUTA      0          205309      9231/cupsd      
tcp6       0      0 ::1:6010                :::*                    ESCUTA      1000       212856      10119/4

Update:

I removed sendmail:

Ligações de Internet Activas (servidores e estabelecidos)
Proto Recv-Q Send-Q Endereço Local          Endereço Remoto         Estado       User       Inode       PID/Program name
tcp        0      0 0.0.0.0:7300            0.0.0.0:*               ESCUTA      1001       11794       1373/perl       
tcp        0      0 192.168.1.104:27754     0.0.0.0:*               ESCUTA      1001       11793       1373/perl       
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               ESCUTA      117        11580       1227/mysqld     
tcp        0      0 0.0.0.0:587             0.0.0.0:*               ESCUTA      0          9180        1137/master     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               ESCUTA      0          11664       1550/dnsmasq    
tcp        0      0 0.0.0.0:21              0.0.0.0:*               ESCUTA      0          8827        887/vsftpd      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               ESCUTA      0          8843        876/sshd        
tcp        0      0 127.0.0.1:631           0.0.0.0:*               ESCUTA      0          15897       2344/cupsd      
tcp        0      0 0.0.0.0:25              0.0.0.0:*               ESCUTA      0          9174        1137/master     
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               ESCUTA      1000       15993       2387/4          
tcp        0    264 192.168.1.104:22        192.168.1.90:62541      ESTABELECIDO 0          15931       2351/sshd: diogosar
tcp6       0      0 :::587                  :::*                    ESCUTA      0          9181        1137/master     
tcp6       0      0 :::80                   :::*                    ESCUTA      0          11125       1330/apache2    
tcp6       0      0 :::22                   :::*                    ESCUTA      0          8845        876/sshd        
tcp6       0      0 ::1:631                 :::*                    ESCUTA      0          15896       2344/cupsd      
tcp6       0      0 :::25                   :::*                    ESCUTA      0          9175        1137/master     
tcp6       0      0 ::1:6010                :::*                    ESCUTA      1000       15992       2387/4          
tcp6       0      0 ::1:56645               ::1:631                 ESTABELECIDO 0          15325       1110/cups-browsed
tcp6       0      0 ::1:631                 ::1:56645               ESTABELECIDO 0          15909       2344/cupsd 

Output of sudo iptables -L -vnx:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination  
16
  • netstat -panet and iptables -L -vnx output would help. Did you check with tcpdump if any traffic actually reaches your server?
    – fuero
    Jan 25, 2015 at 14:21
  • Ports 21, 53, 80 and some others are open. So the problem are only the mailing ports. Maybe your provider is blocking those?
    – sebix
    Jan 25, 2015 at 14:37
  • 1
    Not sure about ISPs in Portugal but most here in US (unless it is a business tier) don't allow inbound to port 25. The previous comment by @sebix is correct-- your port 25 is blocked at your ISP. Jan 25, 2015 at 15:44
  • @Arul port 25 isn't blocked, check images link please... and I was on the phone with they (ISP (Portugal Telecom)) and they tell me that I can these ports in my router...
    – DiogoSaraiva
    Jan 25, 2015 at 16:40
  • 2
    I strongly suggest to learn some linux, networking and mail basics before addressing this task.
    – sebix
    Jan 25, 2015 at 18:17

2 Answers 2

1

I think the problem is that you are running your mail server only on loop back interface (I assume there are no other entries for :25 on your netstat output above)

tcp        0      0 127.0.0.1:25            0.0.0.0:*               ESCUTA      0          138498      18957/sendmail: MTA

It is not reachable for anything outside of the host. It should run on your physical interface the router is forwarding to.

1

I do not think you can possibly have followed the tutorial you link to, since (a) sendmail is running as your MTA, and (b) it's only listening on 127.0.0.1. That latter is why you can't connect to port 25 from anywhere else.

To change this, look for the line

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

in /etc/mail/sendmail.mc, change it to

dnlDAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

or just delete it in its entirety. Remake your config file with make sendmail.cf and restart the service with service sendmail restart. Confirm that the MTA is now listening on all addresses with netstat -apn|grep -w 25; you want to see something like

tcp        0      0 :::25             :::*             LISTEN      8525/sendmail  

Note the change in column four (all these commands will require privilege). Then you should be able to contact your MTA from the internet-at-large, always assuming (as others have pointed out) that you're not trying from an endpoint which can't talk to the SMTP port by ISP default.

Edit: you have now removed sendmail and installed postfix, and your server is now listening on all ports (see netstat output above). Your server is reachable from the internet at large:

[me@risby ~]$ telnet cr7akg.com 25
Trying 85.245.177.97...
Connected to cr7akg.com.
Escape character is '^]'.
220 Ubuntu ESMTP Postfix (Ubuntu)

So you've solved your problem.

7
  • I followed, I sure, but I also configured sendmail
    – DiogoSaraiva
    Jan 25, 2015 at 17:13
  • That is not a small variance from the article. You would do much better to tell us what you actually did, and better still not to change things without understanding them.
    – MadHatter
    Jan 25, 2015 at 17:16
  • But I'm saying the true, also I will delete --purge sendmail I don't need it anymore What I need it's a mail server... I followed this tutorial: linode.com/docs/email/postfix/… and later this digitalocean.com/community/tutorials/…
    – DiogoSaraiva
    Jan 25, 2015 at 17:24
  • Maybe this : GRANT SELECT ON mailserver.* TO 'mailuser'@'127.0.0.1' IDENTIFIED BY '**********';
    – DiogoSaraiva
    Jan 25, 2015 at 17:43
  • MadHatter please help me :'(
    – DiogoSaraiva
    Jan 25, 2015 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .