Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I type:

telnet localhost 25

into SSH, it says:

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Connection closed by foreign host.

However, when I type:

exiwhat

into SSH, it says:

28543 daemon: -q1h, listening for SMTP on port 25 (IPv6 with IPv4) port 587 (IPv6 and IPv4) and for SMTPS on port 465 (IPv6 and IPv4)

If it's listening on port 25, why does my connection get closed after connecting?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Sounds like Exim is configured to deny incoming connections from 127.0.0.1 to me. Does tailing your "exim-main" log tell you anything? (This file is likely located in /var/log/exim/exim-main, but it doesn't have to be.)

A connect ACL in the exim.conf could be doing this, as could a TCP wrapper configuration. Have a look at /etc/hosts.allow and see if there are any "exim" lines. Likewise, have a look at your exim.conf and see if there's a acl_smtp_connect entry. If you are comfortable with it, post your exim.conf and we'll look at it.

share|improve this answer
    
The main log says: socket bind() to port 25 for address (any IPv4) failed: Address already in use –  John Jun 29 '09 at 18:00
    
Woah there, then. Something else is listening on port 25! Stop the Exim process and do a "netstat -a -p" and look for the line with "smtp" on it in "LISTEN" state. Some other program has port 25. –  Evan Anderson Jun 29 '09 at 18:02
    
It looks like xinetd was listening on port 25. I turned it off and restarted exim, and everything seems fine. Is it OK to end xinetd? –  John Jun 29 '09 at 18:07
    
If you're not using xinetd for anything then you shouldn't be running it. I'm guessing that you probably are, though. You'll have to look thru the configs to tell for sure. –  Evan Anderson Jun 29 '09 at 18:22
    
You can probably use grep -F "disable" /etc/xinetd.d/* to see if any services are using xinetd, look for any that say "disable = no". If they all say "disable = yes" then nothing is using xinetd (unless you have a unique xinetd setup). –  Dave Drager Jun 29 '09 at 18:27
show 1 more comment

Is this for exchange? This sounds like an issue I had of 2 NICs in a server, 1 set to DHCP and 1 set to static IP. I enabled static IP to relay emails in the SMTP server properties. When trying to bounce emails off itself, for whatever reason the server kept trying to use the DHCP IP address.

Make sure all your NIC addresses are static. Make sure your SMTP server has enabled those IPs to relay emails. And I would reference the IP using the actual IP, like 10.20.0.10, not 127.0.0.1

share|improve this answer
    
He's taking about Exim-- have a look at the tags. –  Evan Anderson Jun 29 '09 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.