Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-25-2011, 08:22 AM
|
#1
|
Member
Registered: Aug 2010
Posts: 58
Rep:
|
telnet to port 25 not working from outside
Hi,
I'm trying to test smtp connectivity to my postfix configuration and I can telnet to port 25 from the computer itself but cannot from the outside. I get a connection refused error message. What am I doing wrong? I believe my dns is setup correctly as it seems the telnet can hit the box so I'm fairly sure its not that.
Thanks.
|
|
|
03-25-2011, 08:45 AM
|
#2
|
Member
Registered: Mar 2008
Location: Namibia, Swakopmund
Distribution: Redhat, Fedora, Centos, ClearOS, Mandrake
Posts: 151
Rep:
|
Quote:
Originally Posted by showe123
Hi,
I'm trying to test smtp connectivity to my postfix configuration and I can telnet to port 25 from the computer itself but cannot from the outside. I get a connection refused error message. What am I doing wrong? I believe my dns is setup correctly as it seems the telnet can hit the box so I'm fairly sure its not that.
Thanks.
|
DO the following command, and see if your port 25 is running on 0.0.0.0 or 127.0.0.1, which is wrong (127.0.0.1)
netstat -an | grep LIST
It must not be be
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
but
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
|
|
1 members found this post helpful.
|
03-25-2011, 08:46 AM
|
#3
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Is iptables enabled on the box? Is there a firewall between the two?
|
|
1 members found this post helpful.
|
03-25-2011, 08:47 AM
|
#4
|
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824
|
Is postfix listening on your public IP? do: lsof -ni tcp:25. If you only see postfix listening on localhost, you need to configure it to listen on all interfaces instead.
Or you may have a firewall on that is refusing connections, or a router in the way that is not forwarding the port.
|
|
1 members found this post helpful.
|
03-25-2011, 09:00 AM
|
#5
|
Member
Registered: Aug 2010
Posts: 58
Original Poster
Rep:
|
Quote:
Originally Posted by linuxgurusa
DO the following command, and see if your port 25 is running on 0.0.0.0 or 127.0.0.1, which is wrong (127.0.0.1)
netstat -an | grep LIST
It must not be be
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
but
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
|
It's showing 127.0.0.1:25 0.0.0.0* LISTEN
What does that mean?
|
|
|
03-25-2011, 09:01 AM
|
#6
|
Member
Registered: Aug 2010
Posts: 58
Original Poster
Rep:
|
Quote:
Originally Posted by AlucardZero
Is postfix listening on your public IP? do: lsof -ni tcp:25. If you only see postfix listening on localhost, you need to configure it to listen on all interfaces instead.
Or you may have a firewall on that is refusing connections, or a router in the way that is not forwarding the port.
|
I don't have any firewall on and it does seem to be listening on localhost only. How do I change it to listen on all interfaces?
|
|
|
03-25-2011, 09:11 AM
|
#7
|
Member
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375
Rep: 
|
Why are you trying to telnet to your smtp port? They're completely different services. Telnet is usually listening on port 21.
|
|
|
03-25-2011, 09:11 AM
|
#8
|
Member
Registered: Aug 2010
Posts: 58
Original Poster
Rep:
|
Maybe i should add that this is related to the problem I have of only being able to send email and not receive. Perhaps it does have something to do with DNS too?
|
|
|
03-25-2011, 09:17 AM
|
#9
|
Member
Registered: Mar 2008
Location: Namibia, Swakopmund
Distribution: Redhat, Fedora, Centos, ClearOS, Mandrake
Posts: 151
Rep:
|
Quote:
Originally Posted by showe123
It's showing 127.0.0.1:25 0.0.0.0* LISTEN
What does that mean?
|
That is your problem right there buddy
If you do
netstat -an | grep LIST
It must show
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
By default your MTA is configured to ONLY listen on your localhost (127.0.0.1) to prevent spammers from picking up a newbie mail server installation
You must change your postfix mc file to listen on 0.0.0.0 and not on 127.0.0.1
DO you know how to do that ?
|
|
|
03-25-2011, 09:19 AM
|
#10
|
Member
Registered: Mar 2008
Location: Namibia, Swakopmund
Distribution: Redhat, Fedora, Centos, ClearOS, Mandrake
Posts: 151
Rep:
|
Quote:
Originally Posted by SL00b
Why are you trying to telnet to your smtp port? They're completely different services. Telnet is usually listening on port 21.
|
You are missing the point of this excersise bud
If you do
telnet 127.0.0.1
You will make a connection on port 23 yes
If you do the following
telnet 127.0.0.1 25
Then you make a port 25 connection and not a port 23 connection
You can also telnet to port 22, 80, 110, 143 etc to test and see if your ports are listening etc.
Last edited by linuxgurusa; 03-28-2011 at 01:11 AM.
|
|
|
03-25-2011, 09:21 AM
|
#11
|
Member
Registered: Aug 2010
Posts: 58
Original Poster
Rep:
|
Quote:
Originally Posted by linuxgurusa
That is your problem right there buddy
If you do
netstat -an | grep LIST
It must show
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
By default your MTA is configured to ONLY listen on your localhost (127.0.0.1) to prevent spammers from picking up a newbie mail server installation
You must change your postfix mc file to listen on 0.0.0.0 and not on 127.0.0.1
DO you know how to do that ?
|
No, I don't. Im the newbie mail server installation that spammers love I guess. 
|
|
|
03-25-2011, 09:23 AM
|
#12
|
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873
|
Quote:
Originally Posted by SL00b
Why are you trying to telnet to your smtp port? They're completely different services. Telnet is usually listening on port 21.
|
If you have an MTA listening on port 25 then when you telnet to that port you should see a response. That will tell you if the MTA is listening. This is a widely used test procedure.
|
|
|
03-25-2011, 09:25 AM
|
#13
|
Member
Registered: Mar 2008
Location: Namibia, Swakopmund
Distribution: Redhat, Fedora, Centos, ClearOS, Mandrake
Posts: 151
Rep:
|
Quote:
Originally Posted by showe123
No, I don't. Im the newbie mail server installation that spammers love I guess. 
|
LOL, no worries.
I use Sendmail all the time, but I will try and help, since I have done Postfix installs as well, much stronger than Sendmail
OK, so ..
Edit /etc/postfix/master.cf file
look for the line with the 127.0.0.1 in it
replace the 127.0.0.1 with 0.0.0.0
save and quit file, restart postfix, let me know
|
|
1 members found this post helpful.
|
03-25-2011, 09:37 AM
|
#14
|
Member
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375
Rep: 
|
Quote:
Originally Posted by linuxgurusa
You are missing the point of this excersise bud
If you do
telnet 127.0.0.1
You will make a connection on port 21 yes
If you do the following
telnet 127.0.0.1 25
Then you make a port 25 connection and not a port 21 connection
You can also telnet to port 22, 80, 110, 143 etc to test and see if your ports are listening etc.
|
It's axiomatic that someone will always quote your post if you make a simple mistake, so first let me clear up that telnet is port 23, not 21. Port 21 is default for FTP. I always seem to reverse those two, because it seems to me that ssh (port 22) should have come AFTER the unsecured version.
With that said, I was unaware of this trick, which is why I asked the question. It's still more useful to test the connection with the right kind of request, though. All the telnet trick will tell you is that something is listening there, whereas sending a simple smtp message will test that and more.
|
|
|
03-25-2011, 09:54 AM
|
#15
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Quote:
Originally Posted by SL00b
It's axiomatic that someone will always quote your post if you make a simple mistake, so first let me clear up that telnet is port 23, not 21. Port 21 is default for FTP. I always seem to reverse those two, because it seems to me that ssh (port 22) should have come AFTER the unsecured version.
With that said, I was unaware of this trick, which is why I asked the question. It's still more useful to test the connection with the right kind of request, though. All the telnet trick will tell you is that something is listening there, whereas sending a simple smtp message will test that and more.
|
Thats an aphorism for sure.
Using telnet to connect to the mail server, will certainly give you more than just an ack that something is listening. It should give an insight into what is going on. Of course, you have to do this once connected:
Code:
HELO
MAIL FROM:someuser@somehwere.com
RCPT TO:someone@gmail.com
DATA
blah blah blah
.
exit
You should see plenty of output while doing this. After that, the logs are a good place to go.
Last edited by szboardstretcher; 03-25-2011 at 09:56 AM.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 06:39 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|