Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant telnet to port 25 - Redhat/Postfix

Status
Not open for further replies.

biketech

MIS
Jul 19, 2004
65
US
Hi everyone.

I just did a fresh install of RedHat 9, running Postfix. I am able to send mail from the server to local accounts...no problem. I can ssh remotely on 22, telnet remotely on 23, and ping the server. I can also telnet from the server itself to 127.0.0.1 on port 25, but cannot telnet to 25 remotely or even from other computers on the internal network. Of course, I cannot send or receive smtp mail either. I've confirmed that the SMTP port is open through the firewall GUI (still kind of a newbie with command line interface).

Also, I'm on a dynamic IP using dyndns.org to resolve the domain. Thought that might be the problem, but then not being able to telnet from the intranet using an inside IP shot that down.

Any ideas? Thanks in advance.
 
One quick check. Can you telnet to port 25 on the dyanamic IP address from the same machine?

You really do want to *completely* shut down your firewall on the machine to test this out. Eliminate as many variables as you can.
 
Thanks for the reply Eric.

I'm not by the machine right now unfortunately, but I'm pretty sure I tried telnetting to the domain associated with my dynamic IP...pretty sure that didn't work. Also, I did try shutting down the firewall on the linux box before telnetting in and that didn't change anything. I'll rerun both tests when I get home.

I'm not sure if it's something with Postfix not listening to the port, or if it's something else in the basic configuration of the machine.

Thanks again.
 
You can check that postfix is listenting on the port with a utility called "lsof" (ls open files).

Code:
root@ns1(~)# lsof -i | grep smtp
master     1387    root   11u  IPv4   2975  TCP *:smtp (LISTEN)
smtpd     26922 postfix    6u  IPv4   2975  TCP *:smtp (LISTEN)
smtpd     26970 postfix    6u  IPv4   2975  TCP *:smtp (LISTEN)
smtpd     27142 postfix    6u  IPv4   2975  TCP *:smtp (LISTEN)
smtpd     27212 postfix    6u  IPv4   2975  TCP *:smtp (LISTEN)
 
Ok..I think we're on to something. I ran lsof as you suggested and all I get in response is:

Code:
master   1174    root    11u    IPv4    2212    TCP    *:smtp (LISTEN)

So nothing about Postfix. Does this mean Postfix isn't even running as a service? I've confirmed that it does start up at boot.

Also, I tried opening up the firewall entirely and telnetting to 25 directly across a hub (bypassing internet connection completely) and still nothing, although port 23 works fine.

Any suggestions?

Thanks.

 
No, that's okay. Master is a postfix process and acts like a super server, like inetd. When you connect it is supposed to spawn an smtpd process...

like this:

Code:
s5(~)$ sudo lsof -i | grep smtp
Password:
master  15708    root   11u  IPv4 357675       TCP *:smtp (LISTEN)
s5(~)$ telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.comfortechassist.com ESMTP Postfix
quit
221 Bye
Connection closed by foreign host.
s5(~)$ sudo lsof -i | grep smtp
master  15708    root   11u  IPv4 357675       TCP *:smtp (LISTEN)
smtpd   30984 postfix    6u  IPv4 357675       TCP *:smtp (LISTEN)

That's really, really strange.

If you do a tcpdump, can you see the connection come in?
 
Yup...I can see it come in...looks like this:

Code:
21:38:10.287203 192.168.0.40.1156 > 192.168.0.2.smtp: S 410521841:410521841(0) win 16384 <mss 1460,nop,nop,sackOK> (DF)
21:38:10.287308 192.168.0.2.smtp > 192.168.0.40.1156: R 0:0(0) ack 410521842 win 0 (DF)
21:38:10.791610 192.168.0.40.1156 > 192.168.0.2.smtp: S 410521841:410521841(0) win 16384 <mss 1460,nop,nop,sackOK> (DF)
21:38:10.791675 192.168.0.2.smtp > 192.168.0.40.1156: R 0:0(0) ack 1 win 0 (DF)
21:38:11.294152 192.168.0.40.1156 > 192.168.0.2.smtp: S 410521841:410521841(0) win 16384 <mss 1460,nop,nop,sackOK> (DF)
21:38:11.294248 192.168.0.2.smtp > 192.168.0.40.1156: R 0:0(0) ack 1 win 0 (DF)

..where 192.168.0.2 is the linux box and 192.168.0.40 is another box on the network trying to telnet in on 25.
 
And if it helps, here's my main.cf

Code:
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, $mydomain,    mail.$mydomain, [URL unfurl="true"]www.$mydomain,[/URL] ftp.$mydomain
mydomain = example.dyndns.org
myhostname = mail.example.dyndns.org
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-1.1.12/README_FILES
relay_domains =
relayhost = $mydomain
sample_directory = /usr/share/doc/postfix-1.1.12/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
 
Ok...in reply to my own post. Just in case someone finds this useful:

One thing I may not have made clear was that my computer's hostname was NOT the same as the hostname specified in the postfix config file. I thought this would still work out, and I'm sure there IS a way to make it work, but it didn't for me. After changing my computer's hostname to be exactly the same as the hostname in my postfix config file, Postfix now works fine. I followed the steps outlined in the post below to change my hostname:


Thanks everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top