LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 09-02-2008, 11:44 PM   #1
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Rep: Reputation: 0
no route to host on port 25


After several days of searching google and inevitably ending up reading through LQ, I'm posting this. its got me stumped. sadly, this is my first post here at LQ. Wish I could have been more help to other newbies on my first post.

I've got an Ubuntu server that does not want to send mail (tho I have received one or two). I'm mostly interested in allowing outbound mail as it will host a few Wordpress sites and will need to send sql backups and comment notification, etc. Allowing inbound mail would be nice to understand, but it is low priority.

When I try to 'telnet localhost 25' I keep getting connection closed by foreign host. This also happens if I telnet to something like mail.google.com 25, I get 'unable to connect to remote host: No route to host.'

I have disabled ufw, and have shutdown iptables, and have also forwarded the port 25 on my router to this machine. I've also requested that my ISP remove the port 25 filter, and have gotten e-mail confirmation saying that it has been removed.

I've been using the command line for most of this, but I also have Webmin installed and notice that mail sits in the Postfix queue indefinitely. I've done 'dpkg-reconfigure postfix' about 10 times I've done every "simple postfix setup" tutorial on the web (it feels) and am wondering if my domain name, hostname, or routing tables aren't configured incorrectly, though - that is just a random guess.

We installed one of these setups at work, and it shoots out e-mails left and right on our local network. I can telnet the localhost there too. But at home it is a different story. I can tell you with certainty that the problem is user-error (aka PICNIC), but after doing my homework, I don't know what I don't know.

I've got a dynamic IP and am using EveryDNS to update the custom domain name to my current IP. I also have dyndns running on it as a backup way of connecting to the box, but I don't think that would affect any of this. MX records are setup through EveryDNS and a backup at dyndns too.

Hope some of that info is helpful to some kind soul.
 
Old 09-03-2008, 12:27 AM   #2
uncle_philip
Member
 
Registered: Apr 2008
Location: sydney
Distribution: centos5.2
Posts: 50

Rep: Reputation: 15
I'm not familiar with Ubuntu, but with the port 25 turn on, mail-server is running (sendmail/postfix), mail transport is running (dovecot), localhost assign as 127.0.0.1.
you suppose can "telnet localhost 25"
 
Old 09-03-2008, 12:46 AM   #3
cyberhydra
LQ Newbie
 
Registered: Aug 2007
Posts: 25

Rep: Reputation: 15
first, you connecting to port 25 from your home computer does not have anything to do with your server sending out mail from an application hosted on it.

Try shelling in to the comp and telnet to 25....that will work.

port 25 allows your server to listen and get mail from the internet to put in your inbox or to relay to other computers. The fact that you have received a few tells you that it is open and you have the ability to recevie working fine.

Test this by sending a mail to yourself via gmail or something.
Also, if you are getting your mail via something like outlook at home, then you are able to connect to your port 110 and are downloading mail via POP.

So you can receive mail and you can POP3 it to you.

If you cannot send mail from an application on your site, I suggest trying to send one...then going to /var/log/messages or /var/log/error or most importantly 'maillog'

And look for the latest errors and see what they are saying.

It could be you do not have mutt, mail, or any other form of mail program working locally for the program to call.

I am not familiar with postfix, but I would check to see if it is listening on 25...HOWEVER...you have said you can receive mail to the server if somoene sends you one...and you can then download it.

So the simple thing is what is stopping your application, wordpress, from being able to access the 'mail' function.

Search online and look up the syntax to use from the command line to use 'mail'

>mail joe@mysite.com "hello" (something along those lines)... send it to your outside account like gmail.
If there is an error it will pop up...if there is not then you are fine and wordpress has an issues.

Turn your iptables back on, they have nothing to do with the issue since your mail is working well (at least receving and POP3)

Your error logs may show why the mail is queued....I would look at the file and see exactly what mail is queued there before I jump to conclusions about it not working.

Without any type of error, without seeing any error log entires...without seeing any type of syntax around 'mail not sent' there is no way for us to really tell you what else to do.

Based on it all...

1- Port 25 is working as is port 110. You can receive mail to the server from the net and POP3 it to your home computer.

2- the applications you are using must be making errors somewhere, look for them

3- send a test mail from the command line using 'mail' function

This has nothing to do with dns, firewalls, or anything other than what is happening on your server with mail, mutt, or whatever mailer the program is trying to call.

thats all I can do to help.
 
Old 09-03-2008, 01:39 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
When I try to 'telnet localhost 25' I keep getting connection closed by foreign host. This also happens if I telnet to something like mail.google.com 25, I get 'unable to connect to remote host: No route to host.'
These may not be the same problem. Are you sure Postfix is running, and if so, is it listening to localhost? Can you post the output of

netstat -lnp | grep :25

The google issue sounds like a network issue. Can you ping mail.google.com

Quote:
I have disabled ufw, and have shutdown iptables, and have also forwarded the port 25 on my router to this machine. I've also requested that my ISP remove the port 25 filter, and have gotten e-mail confirmation saying that it has been removed.
But you are looking to send email - this is generally irrelevant to to sending.

Quote:
I've been using the command line for most of this, but I also have Webmin installed and notice that mail sits in the Postfix queue indefinitely. I've done 'dpkg-reconfigure postfix' about 10 times I've done every "simple postfix setup" tutorial on the web (it feels) and am wondering if my domain name, hostname, or routing tables aren't configured incorrectly, though - that is just a random guess.
What's the output of

route

Quote:
I've got a dynamic IP and am using EveryDNS to update the custom domain name to my current IP. I also have dyndns running on it as a backup way of connecting to the box, but I don't think that would affect any of this. MX records are setup through EveryDNS and a backup at dyndns too.
Not relevant to sending though

Can you post the output of

postconf -n

And we'll get you working
 
Old 09-03-2008, 10:08 AM   #5
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Wow, thank you everyone for your thorough feedback. This is truly a gem on the web. Okay, I'm going to try to address all requests:


cyberhydra:

I have done
Code:
'echo "hello" | mail email@mygoogleappsaccount.com'
and the mail log says the following:
Code:
connect to ALT2.ASPMX.L.GOOGLE.com[74.125.47.114]:25: No route to host
So this made me think that perhaps my routing table was not set correctly (see output below)

I then tried going into my Google Apps account and sent an e-mail to this server I'm setting up. This message gets through and I can see it in mutt.


billymayday:
Here are the outputs of those commands

netstat -lnp | grep :25
Code:
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp6       0      0 :::25                   :::*                    LISTEN

ping mail.google.com
Code:
64 bytes from ar-in-f19.google.com (72.14.223.19): icmp_seq=1 ttl=246 time=14.4 ms
""
""

route
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    100    0        0 eth0

postconf -n
Code:
alias_maps = hash:/etc/postfix/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mail_spool_directory = /var/spool/mail
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = black.br0ck.com, localhost.localdomain, localhost
mydomain = br0ck.com
myhostname = black
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_note_starttls_offer = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt
smtpd_tls_key_file = /etc/ssl/private/smtpd.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
 
Old 09-03-2008, 04:39 PM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Some quick thoughts, I may come back with more later

Can you post

traceroute -Y-p 25 mail.google.com

Are you sure that your ISP ha unblocked OUTGOING port 25 and not just incoming? Repost the output of "telnet localhost 25" and also add a line to main.cf saying

relayhost = smtp.myisp.com (clearly replace smtp.myisp.com with your ISP's smtp server)

Hopefully your ISP won't need authentication for relaying its own IPs

You need to add br0ck.com to

mydestination = black.br0ck.com, localhost.localdomain, localhost

if you want to receive mail for user@br0ck.com
 
Old 09-03-2008, 04:48 PM   #7
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
just an aside, I would include 'a' in the netstat command so you can see what process has the port open.

Nothing like messing with the config of a program to find out something else had the port open the whole time..
Code:
it-etch:/~ # netstat -alnp | grep :25
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      26014/exim4
probably not your issue, but still doesn't hurt to check.

We now return you to your regularly scheduled thread......
 
Old 09-03-2008, 05:12 PM   #8
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by farslayer View Post
just an aside, I would include 'a' in the netstat command so you can see what process has the port open.

Nothing like messing with the config of a program to find out something else had the port open the whole time..
Code:
it-etch:/~ # netstat -alnp | grep :25
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      26014/exim4
probably not your issue, but still doesn't hurt to check.

We now return you to your regularly scheduled thread......
Interesting - I get that by default in CentOS
 
Old 09-03-2008, 05:59 PM   #9
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Okay - thanks to all for those ideas. Here is what I found in response:

billymayday: the traceroute -Y through up a bad argument error, so I did it as -p.

brockangelo@black:~$ traceroute -p 25 mail.google.com
Code:
traceroute to mail.google.com (72.14.223.83), 30 hops max, 40 byte packets
 1  192.168.1.1 (192.168.1.1)  2.165 ms  2.359 ms  2.597 ms
 2  adsl-76-199-7-254.dsl.chmpil.sbcglobal.net (76.199.7.254)  13.245 ms  13.888 ms  16.115 ms
 3  dist1-vlan50.chmpil.ameritech.net (67.36.90.226)  18.785 ms  20.932 ms  23.125 ms
 4  bb1-g8-0.chmpil.ameritech.net (67.36.90.115)  25.789 ms  28.206 ms  30.617 ms
 5  bb1-p2-1.chcgil.sbcglobal.net (151.164.92.235)  60.732 ms  61.405 ms  62.064 ms
 6  bb2-p10-0.chcgil.ameritech.net (70.245.63.186)  111.300 ms  29.113 ms  74.691 ms
 7  151.164.241.191 (151.164.241.191)  16.022 ms  17.864 ms  20.781 ms
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
Also, billymayday, I made the changes in the main.cf. I can't say for sure that my ISP blocked both inbound and outbound. The e-mail said nothing about inbound or outbound. Would there be a way to check?

brockangelo@black:~$ netstat -alnp | grep :25
Code:
(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::25                   :::*                    LISTEN      -
 
Old 09-03-2008, 06:39 PM   #10
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Try sudo netstat -alnp | grep :25

Sorry that was a typo - should have been -T not -Y.

I'm going to fire up Ubuntu and see what I get for the netstat
 
Old 09-03-2008, 06:45 PM   #11
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Okay, here goes:

brockangelo@black:~$ sudo traceroute -T -p 25 mail.google.com
Code:
traceroute to mail.google.com (72.14.223.18), 30 hops max, 40 byte packets
 1  192.168.1.1 (192.168.1.1)  5.074 ms  4.622 ms  4.289 ms
 2  adsl-76-199-15-254.dsl.chmpil.sbcglobal.net (76.199.15.254)  21.808 ms  33.3                 70 ms  30.863 ms
 3  dist1-vlan60.chmpil.ameritech.net (67.36.90.242)  28.356 ms  25.843 ms  23.3                 48 ms
 4  bb1-g1-0.chmpil.ameritech.net (67.36.90.99)  22.471 ms  22.190 ms  21.673 ms
 5  ex1-p2-0.eqchil.sbcglobal.net (151.164.42.149)  21.851 ms  50.186 ms  47.915                  ms
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
And then here:
brockangelo@black:~$ sudo netstat -alnp | grep :25
Code:
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      17130/master
tcp6       0      0 :::25                   :::*                    LISTEN      17130/master
Since the last few changes from earlier today, I noticed that everything has cleared out of my Postfix queue, but I haven't received any of the e-mails.
 
Old 09-03-2008, 06:47 PM   #12
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Can you post output of telnet localhost 25 please
 
Old 09-03-2008, 06:49 PM   #13
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Original Poster
Rep: Reputation: 0
I don't know if this makes a difference at all, but when I was looking at the Postfix General Options tab inside of Webmin, it shows that the

Internet hostname of this mail system - black
Local internet domain name - br0ck.com

black is the hostname of the machine, and br0ck.com is the domain name I'm using for inbound e-mails. It is not "joined" to a domain in the traditional DNS capacity, if that matters.
 
Old 09-03-2008, 06:49 PM   #14
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I just saw you final point. Can you have a look through your maillog at any delivery notifications
 
Old 09-03-2008, 06:51 PM   #15
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Original Poster
Rep: Reputation: 0
telnet localhost 25:

through putty and when sitting at the machine, it says
Code:
brockangelo@black:~$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
When I do it at the machine, it hangs for about 30 seconds before it gives me the "Connection closed by foreign host"
 
  


Reply

Tags
mail, postfix


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scp: port 22: No route to host xpucto Linux - Networking 4 10-22-2013 10:58 PM
rcp -- port 544: No route to host jchambers Linux - Networking 1 08-26-2007 03:53 AM
route locally generated traffic to ip:port to localhost:port maenho Linux - Software 2 03-11-2005 05:08 AM
Port 25: No route to host dhruv Linux - Networking 4 04-07-2004 09:23 AM
Port 25: No route to host dhruv Linux - Newbie 0 04-03-2004 10:37 AM


All times are GMT -5. The time now is 08:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration