LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Postfix with smtp not working "Host or domain name not found." (https://www.linuxquestions.org/questions/linux-networking-3/postfix-with-smtp-not-working-host-or-domain-name-not-found-755339/)

targettl 09-15-2009 07:42 AM

Postfix with smtp not working "Host or domain name not found."
 
I am trying to send mail to other machines without using some else's smtp server. In the end I want to send server logs to an account on a seperate but local mail server.

Kubuntu Jaunty
apt-get postfix
dpkg-reconfigure postfix
apt-get mailutils
mail user@host.domain
mailq or more /var/log/mail.log
I either get Connection timed out or No route to host
or Host not found, try again

Some errors are from trying to email external servers which might be prevented because ISP's block it I think. telnet ip port 25 doesn't work
But telnet works for the local ones

I can browse the web so dns should be okay.
Does postfix read the hosts table first?
I can ping the host I put in hosts table
But postfix says Host not found

bhaslinux 09-16-2009 09:01 AM

Your query is not clear

If you are creating an MTA to send mails to outside world
There are a few things to keep in mind
1. If you send the mail as-if appearing from your system, most of the SMTP mail servers will reject your mail
as the mail server from which mail is originating must
a) have a static ip address
b) must be reverse-resolveable by name.
However, you can ask your service provider to give you an smtp server to which you can do a smart-host transfer

If you are trying to send mails locally, internally to systems:
Just by adding the host name in the hosts file and sending mail abc@host.dom will not work.
The mx record for the domain/host must be resolve'able.
You might want to take a look at the SMTP RFC to understand more and also read-up on DNS MX records.

DrLove73 09-16-2009 02:40 PM

Best way to test if networking is correcty set on your mail server is to do following:

In terminal type like this:
Quote:

dig gmail.com MX
to see if your system is corectly resolving domain names (corectly set up DNS servers) you should get something like this:
Quote:

; <<>> DiG 9.3.4-P1 <<>> gmail.com MX
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24561
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 13, ADDITIONAL: 7

;; QUESTION SECTION:
;gmail.com. IN MX

;; ANSWER SECTION:
gmail.com. 2265 IN MX 5 gmail-smtp-in.l.google.com.
gmail.com. 2265 IN MX 10 alt1.gmail-smtp-in.l.google.com.
gmail.com. 2265 IN MX 20 alt2.gmail-smtp-in.l.google.com.
gmail.com. 2265 IN MX 30 alt3.gmail-smtp-in.l.google.com.
gmail.com. 2265 IN MX 40 alt4.gmail-smtp-in.l.google.com.

;; AUTHORITY SECTION:
com. 77508 IN NS H.GTLD-SERVERS.NET.
com. 77508 IN NS I.GTLD-SERVERS.NET.
com. 77508 IN NS J.GTLD-SERVERS.NET.
com. 77508 IN NS K.GTLD-SERVERS.NET.
com. 77508 IN NS L.GTLD-SERVERS.NET.
com. 77508 IN NS M.GTLD-SERVERS.NET.
com. 77508 IN NS A.GTLD-SERVERS.NET.
com. 77508 IN NS B.GTLD-SERVERS.NET.
com. 77508 IN NS C.GTLD-SERVERS.NET.
com. 77508 IN NS D.GTLD-SERVERS.NET.
com. 77508 IN NS E.GTLD-SERVERS.NET.
com. 77508 IN NS F.GTLD-SERVERS.NET.
com. 77508 IN NS G.GTLD-SERVERS.NET.

;; ADDITIONAL SECTION:
A.GTLD-SERVERS.NET. 72491 IN A 192.5.6.30
A.GTLD-SERVERS.NET. 72491 IN AAAA 2001:503:a83e::2:30
B.GTLD-SERVERS.NET. 72491 IN A 192.33.14.30
B.GTLD-SERVERS.NET. 72491 IN AAAA 2001:503:231d::2:30
C.GTLD-SERVERS.NET. 72491 IN A 192.26.92.30
D.GTLD-SERVERS.NET. 72491 IN A 192.31.80.30
E.GTLD-SERVERS.NET. 72491 IN A 192.12.94.30

;; Query time: 105 msec
;; SERVER: x.x.219.89#53(x.x.219.89)
;; WHEN: Wed Sep 16 21:26:38 2009
;; MSG SIZE rcvd: 510
Take notice on the
Quote:

;; ANSWER SECTION:
we got 5 mail servers for "gmail.com" domain. next try to get ip for one of them:
Quote:

dig gmail-smtp-in.l.google.com
. Part of the response is:
Quote:

;; ANSWER SECTION:
gmail-smtp-in.l.google.com. 82 IN A 74.125.79.27
This means that you can resolve other mail servers from your server, and that you should follow steps bhaslinux wrote.

I as ISP, I block ANY connection originating from my network that has destination post 25 with IP other then my mail server's. This is to prevent SPAM-ing and blacklisting my IP with other mail servers arround the world. Also, I have active "reverse-resolveable by name" protection bhaslinux mentioned, so any connection from IP that has no reversed DNS record is blocked, like this:
Quote:

Sep 16 21:33:03 sagittarius postfix/smtpd[1994]: connect from unknown[201.221.147.75]
Sep 16 21:33:04 sagittarius postfix/smtpd[1994]: NOQUEUE: reject: RCPT from unknown[201.221.147.75]: 504 5.5.2 <RKLOUMBVHL>: Helo command rejected: need fully-qualified hostname; from=<mitigateb8@rotted.com> to=<igor@xxxxx.net> proto=ESMTP helo=<RKLOUMBVHL>
Sep 16 21:33:04 sagittarius postfix/smtpd[1994]: lost connection after DATA from unknown[201.221.147.75]
Sep 16 21:33:04 sagittarius postfix/smtpd[1994]: disconnect from unknown[201.221.147.75]
or that is already reported by someone as SPAM-er:
Quote:

Sep 16 21:33:06 sagittarius postfix/smtpd[1987]: NOQUEUE: reject: RCPT from unknown[200.135.234.78]: 554 5.7.1 Service unavailable; Client host [200.135.234.78] blocked using zen.spamhaus.org; http://www.spamhaus.org/query/bl?ip=200.135.234.78; from=<igor@xxxxx.net> to=<igor@xxxxx.net> proto=ESMTP helo=<[200.135.234.78]>
Sep 16 21:33:07 sagittarius postfix/smtpd[1987]: disconnect from unknown[200.135.234.78]


All times are GMT -5. The time now is 07:19 PM.