I need help setting up working mail server

Discussion in 'Server Operation' started by hoggwild, Apr 11, 2008.

  1. hoggwild

    hoggwild New Member

    First off, I am a newbie at Linux, although I've been running a WAMP webserver for a couple of years on Windows Pro XP SP2. I have four websites running on this server, along with a hMailServer for three of them. I currently use ZoneEdit.com for DNS forwarding for all sites. Although the Windows setup is working fine, I would like to move everything to a Linux server for security reasons (I've had my mail server hijacked a couple of times). The server resides in my home behind a router/gateway, and I use ADSL through the phone company for internet access. I do have a static IP address through the phone company.

    I just installed "The Perfect Server" using Ubuntu 7.10, following the instructions on HowtoForge, and installed ISPConfig to manage the various virtual sites. I'm having trouble with the mail server piece. I am able to send mail from one user at mydomain.com to another user at mydomain.com, but mail to/from external addresses is not getting delivered or received, and I have no idea what I may have set up wrong that is causing this to happen (this is not a problem on the Windows machine). I've been working on this for almost a week now, and am no closer to solving this issue now than I was when I started.

    Any assistance here would be most greatly appreciated. I'll post any log or configuration files that you tell me to post.

    Help!
     
  2. topdog

    topdog Active Member

    Have you taken a look at the logs are there any errors there ?
     
  3. hoggwild

    hoggwild New Member

    Thanks for responding....

    :) I did finally get the "receive" piece to work....I can now send mail from an external address and it is received at the main user's mailbox (the user I set up when I installed Ubuntu), although nothing is getting delivered to a user who is set up inside ISPConfig yet (I'm trying to tackle one thing at a time here).

    When I try to send mail from the main user to an external address, the connection is timing out (here is the latest group of messages from the mail log; these get repeated over and over). I used telnet to compose the message:
    ----
    Apr 11 08:10:28 server postfix/qmgr[19911]: AFC52320429E: from=<[email protected]>, size=510, nrcpt=1 (queue active)
    Apr 11 08:10:59 server postfix/smtp[30748]: connect to b.mx.mail.yahoo.com[66.196.97.250]:25: Connection timed out
    Apr 11 08:11:29 server postfix/smtp[30748]: connect to c.mx.mail.yahoo.com[216.39.53.3]:25: Connection timed out
    Apr 11 08:11:59 server postfix/smtp[30748]: connect to d.mx.mail.yahoo.com[66.196.82.7]:25: Connection timed out
    Apr 11 08:12:29 server postfix/smtp[30748]: connect to a.mx.mail.yahoo.com[209.191.118.103]:25: Connection timed out
    Apr 11 08:12:59 server postfix/smtp[30748]: connect to e.mx.mail.yahoo.com[216.39.53.1]:25: Connection timed out
    Apr 11 08:12:59 server postfix/smtp[30748]: AFC52320429E: to=<[email protected]>, relay=none, delay=25430, delays=25280/0.01/151/0, dsn=4.4.1, status=deferred (connect to e.mx.mail.yahoo.com[216.39.53.1]:25: Connection timed out)
    ----
    On the Windows server, I relay messages through the phone company's mail server, and I originally had that server set up as a relay on the Linux server, but I removed it because I thought that might be the problem (I was doing on the Windows server b/c without the relay my mail gets flagged as "spam"). When I removed the relayserver setting there was no impact on the type of log messages other than they now says relay=none.

    Incoming messages on port 25 are getting delivered to [email protected], and if I switch the router to point to the Windows server the mail function works without a problem so I'm pretty sure this is a configuration issue with either Linux or with Postfix; however, I have no idea what I need to change.
     
    Last edited: Apr 11, 2008
  4. topdog

    topdog Active Member

    From the logs it looks like the postfix machine cannot connect outside your network on port 25.

    Are you sure you have the default gateway setup correctly and your router is not blocking the connections out
     
  5. hoggwild

    hoggwild New Member

    No, the router is working fine -- if I simply point it to the Windows server instead of the Linux server by changing the internal IP address for the mail server ports (POP, IMAP and SMTP) everything works great. I'm fairly certain this is confined to the Linux machine, either the server setup or Postfix.

    Here's a netstat -tulp listing:

    Code:
    root@server:/home/lhridley# netstat -tulp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 *:mysql                 *:*                     LISTEN     5076/mysqld
    tcp        0      0 *:www                   *:*                     LISTEN     5547/apache2
    tcp        0      0 *:81                    *:*                     LISTEN     5511/ispconfig_http
    tcp        0      0 192.168.2.114:domain    *:*                     LISTEN     32622/named
    tcp        0      0 localhost.locald:domain *:*                     LISTEN     32622/named
    tcp        0      0 *:ftp                   *:*                     LISTEN     6712/proftpd: (acce
    tcp        0      0 localhost.localdoma:953 *:*                     LISTEN     32622/named
    tcp        0      0 *:smtp                  *:*                     LISTEN     19907/master
    tcp        0      0 *:https                 *:*                     LISTEN     5547/apache2
    tcp6       0      0 *:imaps                 *:*                     LISTEN     5189/couriertcpd
    tcp6       0      0 *:pop3s                 *:*                     LISTEN     5224/couriertcpd
    tcp6       0      0 *:pop3                  *:*                     LISTEN     5202/couriertcpd
    tcp6       0      0 *:imap2                 *:*                     LISTEN     5164/couriertcpd
    tcp6       0      0 *:ssh                   *:*                     LISTEN     4982/sshd
    tcp6       0      0 ip6-localhost:953       *:*                     LISTEN     32622/named
    tcp6       0      0 *:smtp                  *:*                     LISTEN     19907/master
    getnameinfo failed
    udp        0      0 192.168.2.114:domain    *:*                                32622/named
    udp        0      0 localhost.locald:domain *:*                                32622/named
    udp        0      0 *:32840                 *:*                                32622/named
    udp        0      0 192.168.2.114:ntp       *:*                                5356/ntpd
    udp        0      0 localhost.localdoma:ntp *:*                                5356/ntpd
    udp        0      0 *:ntp                   *:*                                5356/ntpd
    udp6       0      0 *:32841                 *:*                                32622/named
    udp6       0      0 fe80::219:66ff:fe5d:ntp *:*                                5356/ntpd
    udp6       0      0 ip6-localhost:ntp       *:*                                5356/ntpd
    udp6       0      0 *:ntp                   *:*                                5356/ntpd
    
    There is one thing that stands out to me:
    Code:
    tcp6       0      0 *:smtp                  *:*                     LISTEN     19907/master
    getnameinfo failed
    
    But I have no idea how to fix this. Any pointers?
     
    Last edited: Apr 11, 2008
  6. topdog

    topdog Active Member

    thats not a problem.

    whats the output of
    Code:
    netstat -nr
    Does it have the correct default route ?

    Can you connect
    Code:
    telnet smtp.gmail.com 25
     
  7. hoggwild

    hoggwild New Member

    netstat -nr produces:

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
    0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
    
    I cannot get a connection using telnet smtp.gmail.com 25.

    However, I can get a connection to my phone company's mail server using:
    Code:
    telnet mail.bellsouth.net 25
    
     
    Last edited: Apr 11, 2008
  8. topdog

    topdog Active Member

    Okay that means your ISP/phone company is blocking port 25 connections you need to use thier mail server as your smart host.

    Add this to your postfix main.cf
    Code:
    relayhost = [mail.bellsouth.net]
    That is if that is the mail server your ISP lets you use to relay mail, if its different then substitute it there.
     
  9. hoggwild

    hoggwild New Member

    :( I did that...still no go.
     
  10. topdog

    topdog Active Member

    What is it logging now ?
     
  11. hoggwild

    hoggwild New Member

    oh! Oh! OH! Success!!! :D

    I changed "mynetworks" in the main.cf file....I forgot to put the commas between the different network IP addresses...... :p

    And I added the mail.bellsouth.net relay.

    And restarted postfix...

    And now I've now successfully delivered two e-mails to my yahoo.com address from mydomain.com.

    Thank you! Thank you! Thank you!

    Even though you didn't catch my stupidity, sometimes you just need dialogue with another to make things click.

    Thanks so much for your willingness to help with this.
     

Share This Page