LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Using Postfix with MX record only. (https://www.linuxquestions.org/questions/linux-server-73/using-postfix-with-mx-record-only-4175472802/)

jamiebond 08-09-2013 12:42 PM

Using Postfix with MX record only.
 
Hello, I am basically just looking for some confirmation here please.

I'm relatively new to all this, so please be nice...

I am fairly confident that my installation (see below) is correct because everything works as expected.

The issue:
-----------
My Domain Registrar says before they can register/bind myownserver.com to point to my IP, they require a fully functioning SMTP server at my IP which is capable of receiving mail for postmaster- and abuse@myownserver.com

So I have this installation:
http://howtoforge.com/perfect-server...ot-ispconfig-3

My Registrar DID create an MX record for me at:
MAIL.myownserver.com...

...in their zone on:
NS1.REGISTRARSDOMAIN.TLD
and
NS2.REGISTRARSDOMAIN.TLD

DIG and NSLOOKUP results confirms the above.

I therefor have used the above NameServers' IPs and MAIL.MYOWNSERVER.COM in my Server/Postfix configuration.

What I know:
1. My IP does NOT resolve to myownserver.com yet.
2. My IP DOES have a MX record; mail.myownserver.com

When doing a smtp test AGAINST MY IP ADDRESS here...
https://wormly.com/test_smtp_server

...I get the following result:

-----------------------------------
Connecting...
SMTP -> FROM SERVER:
220 mail.myownserver.com ESMTP Postfix (Ubuntu)
SMTP -> FROM SERVER:
250-myownmailserver
250-PIPELINING
250-SIZE
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: someone@somewhere.com
SMTP -> FROM SERVER:
250 2.1.0 Ok
RCPT TO: postmaster@myownserver.com
SMTP -> FROM SERVER:
250 2.1.5 Ok
Sending Mail Message Body...
SMTP -> FROM SERVER:
354 End data with .
SMTP -> FROM SERVER:
250 2.0.0 Ok: queued as 37BD92608
Message completed successfully.
----------------------------------------

And of course I confirmed that the mail is in fact delivered at the server.

Looking at the above result, I assume that my SMTP server does in fact accept mail FROM ANYWHERE to postmaster@myownserver.com - because I have an MX record - even though I don't have a Qualified Domain Name yet.

Is this correct ?
Can i go back to my registrar with this working Postfix configuration ?

Please comment your thoughts on this.

Thank you kindly.

Jamie.

Ser Olmy 08-09-2013 01:15 PM

Quote:

Originally Posted by jamiebond (Post 5006400)
Looking at the above result, I assume that my SMTP server does in fact accept mail FROM ANYWHERE to postmaster@myownserver.com - because I have an MX record - even though I don't have a Qualified Domain Name yet.

You don't have an MX record, but yes, your server is accepting mail for the domain in question. (Make sure you create an account or alias for "abuse" as well.)

When you tell your registrar that the mail server is up and running, they will create (at least) two records in the DNS zone for your domain:
  1. an A record pointing from a server name (such as "mail.yourdomain.com") to your IP address
  2. an MX record for the domain, pointing to the server name in the A record
Once they've done that, external servers will be able to deliver mail for your domain to your server.

jamiebond 08-09-2013 01:37 PM

Thank you. Yes I do have accounts for abuse, webmaster, info, etc.

So an A record points my IP to mail.mydomain.com, which is the name of the server(the host computer)?

And a MX record is something on the Registrars system "pointing/routing" emails from "out there" to mail.mydomain.com?

Or is it the other way round ? I've been at this for 3 weeks straight, and after google'ing this day and nite, I am still trying to understand the difference between:

mail.mydomain.com
and
mydomain.com

Anyway, thank you for the feedback.

Just to be absolutely sure before I go back to my Registrar...
You agree that I DO have a MAIL SERVER capable of receiving mail at mail.MYDOMAINNAME.com ?

Kind regards,
Jamie.

Ser Olmy 08-09-2013 01:55 PM

Quote:

Originally Posted by jamiebond (Post 5006432)
So an A record points my IP to mail.mydomain.com, which is the name of the server(the host computer)?

That is correct. Every host on the Internet needs to have one if it's to be accessed by name rather than by IP address. A (Address) records exist in the DNS zone for a domain, like "mydomain.com", and contains a name and an address. The entry in the DNS zone file looks something like this:
Code:

mail    IN  A  1.2.3.4
Quote:

Originally Posted by jamiebond (Post 5006432)
And a MX record is something on the Registrars system "pointing/routing" emails from "out there" to mail.mydomain.com?

MX stands for "Mail Exchanger", and each domain needs at least one in order for inbound mail to function.

The MX record looks like the A record, except:
  • it points from the domain itself rather than from a hostname
  • it must point to a name rather than an address
  • it contains an extra priority field
Here's an example:
Code:

@        IN  MX  5  mail
In this case, the server name is actually "mail.mydomain.com"; the DNS server will automatically append the domain name to any value that doesn't end with a dot ("."), except IP addresses. Had the MX server been in another domain (like if your mail had been handled by your ISP or a "cloud provider" like Microsoft), the record would have looked something like this:
Code:

@        IN  MX  5  mail1234.outlook.com.
Notice the trailing dot.

Quote:

Originally Posted by jamiebond (Post 5006432)
Just to be absolutely sure before I go back to my Registrar...
You agree that I DO have a MAIL SERVER capable of receiving mail at mail.MYDOMAINNAME.com ?

Absolutely.

You may want to double-check that your server isn't acting as an open relay (that is, forwarding inbound mail for non-local addresses). You can do that by entering your IP address here, here or here.

jamiebond 08-09-2013 02:19 PM

Thank you.
 
Thank you. Your explanation is so much clearer than wikipedia's version of A and MX records.

Believe it when I say I did the complete server installation 5 times, yes, 5 times "clean install" in order to get it right.
Coming from windows (forcibly due to work) over the past 20years, this was a steep learning curve and very long hours for me.

So I sincerely appreciate your feedback.

Thanks for the heads up on the open relay test. I'll be sure to double-check that also.

Thanks again.
Jamie.

PS: To any Windows users reading this - let it be known:
Windows makes you lazy !! Linux is hard work, but sooooooo much faster, more effective, and way better. Period.

jamiebond 08-12-2013 08:19 AM

Issues
 
Hi again, I just want to keep this thread alive for now because there is an issue:

Every so often the SMTP would just stop working (see below).
As soon as I restart amavis (/etc/init.d/amavis restart), the SMTP works again, for a while.

I've been testing the SMTP all day long at https://www.wormly.com/test_smtp_server

Every few (undetermined) minutes of testing apart, I would get a:

SMTP -> ERROR: Failed to connect to server: Connection refused (111)
Message sending failed.

Then I do /etc/init.d/amavis restart
Run the test again.
Test successful.

I could not find anything significant in mail.log, yet.
I want to believe it is some kind of timeout issue but I am still looking into the problem.

I will post here if I get it sorted.

Any thoughts from you would be greatly appreciated.

Thank you.
Jamie.

Noway2 08-13-2013 02:39 PM

Quote:

Every few (undetermined) minutes of testing apart, I would get a:

SMTP -> ERROR: Failed to connect to server: Connection refused (111)
Something is killing the amavis daemon process. Once started, it shouldn't be stopping on it's own. In addition to mail.log, I would look in places like syslog, messages, daemon, mail.error and mail.info. Also, see this how-to-forge post about how to check, and if necessary set, the logging function of amavis.

jamiebond 08-14-2013 01:44 AM

Hi, thank you for your reply.

Quote:

Something is killing the amavis daemon process
I am also getting the "feeling" that amavis is the issue but I can not confirm that yet.
I still do not find amavis related errors in the logs but I am still investigating.
(Also, see below for -> not needing to restart amavis)

Something else, and maybe just my imagination, but it does seem strange that:

During after hours, when the (cisco 800) router is not very busy (low traffic), my testing the SMTP server is successful (error free) every time, all through the nite. During office hours, when the router is more busy (with general internet traffic), I start getting the test errors:
Sometimes it will error out at EHLO, sometimes at HELO, sometimes at DATA, and then sometimes the (111) error as described previously.

Today I noticed that I do NOT have to restart amavis for the test to be successful again later.

So in short:
Testing the server at (https://www.wormly.com/test_smtp_server - and other urls), the test result would be successful 80% of the time.

If/when the test does result in an error, it would be successful again a few minutes later, irrespective of me restarting amvis or not.

I am at a loss - but will keep at it.
I need 100% up-time of the SMTP server. As it should be.

I will post back here with my findings.

Your thoughts on this is always appreciated.
Thank you.
Jamie.

Noway2 08-14-2013 09:38 AM

Interesting. Connection refused typically means that the port is closed. You're experiencing this during times of heavier traffic and have not problems during periods of lighter traffic. Have you looked at the router status to see what the CPU utilization is, as well as other metrics like packet losses, and percent traffic capacity? Perhaps your router isn't able to keep up and is responding by denying new connections?

jamiebond 08-15-2013 12:16 AM

Quote:

Originally Posted by Noway2 (Post 5009161)
Interesting. Connection refused typically means that the port is closed. You're experiencing this during times of heavier traffic and have not problems during periods of lighter traffic. Have you looked at the router status to see what the CPU utilization is, as well as other metrics like packet losses, and percent traffic capacity? Perhaps your router isn't able to keep up and is responding by denying new connections?

Thanks. I've looked at mail- sys- daemon- etc logs and don't see any smtp related errors, so yes I think the problem is the router. I just can't proof it yet.

Yesterday (during office hours), I disconnected the rest of the network (approx 12 comps - 1 of which does video conferencing), had only 3 other comps generating traffic, and did not once have connection errors while testing the smtp. I will get the rest of the network up today, get some high traffic usage going and see how it goes. Will keep you posted for interest sake.

jamiebond 08-21-2013 06:15 AM

Solved
 
There were 2 switches between the router and my smtp server.
I think that configuration was the issue.
Although it shouldn't have an effect (?) - because i have other machines running through those switches with no connection problems.

Anyway, I connected the smtp box directly to the router and since then not experience any connection/mail errors.

Thank you to everyone who replied.

I appreciate your comments and advice.

Kind regards.
Jamie.


All times are GMT -5. The time now is 06:25 PM.