Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Telnet to port 25; connection refused for all but local host

  1. #1
    Join Date
    Mar 2005
    Beans
    105

    Telnet to port 25; connection refused for all but local host

    I can telnet (while on the actual machine) using

    telnet localhost 25
    When I try and use the local machine's ip
    telnet 192.168.100.9 25
    I get
    Trying 192.168.100.9...
    telnet: Unable to connect to remote host: Connection refused
    When I use it's URL
    telnet rcws01.rosminicollege.school.nz 25
    I get
    Trying 127.0.1.1...
    telnet: Unable to connect to remote host: Connection refused
    This last one is strange as I the IP looks odd.

    What I am doing wrong, and how do I fix it. After much surfing many mosts say that telnet is not used anymore but I want to use it to test my smtp server.

  2. #2
    Join Date
    May 2005
    Location
    Sydney, Australia
    Beans
    281

    Re: Telnet to port 25; connection refused for all but local host

    Looks like your email server is only listening on localhost. If you run the following command you can see what it is listening on -

    Code:
    sudo netstat -plntu
    You will see a line like -

    Code:
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      5807/master
    You need to change your email server config to listen on all interfaces - differs depending on the email server you are using.


    Quote:
    Trying 127.0.1.1...
    telnet: Unable to connect to remote host: Connection refused
    This last one is strange as I the IP looks odd.
    My guess is you will have an entry in your /etc/hosts file for rcws01.rosminicollege.school.nz which translates to 127.0.0.1 so that is why the ip address looks like that.

  3. #3
    Join Date
    Mar 2005
    Beans
    105

    Re: Telnet to port 25; connection refused for all but local host

    Hi, yes you are right. How do I make it listern on other ips? I am using Postfix.

    Thanks

  4. #4
    Join Date
    May 2005
    Location
    Sydney, Australia
    Beans
    281

    Thumbs down Re: Telnet to port 25; connection refused for all but local host

    Edit /etc/postfix/main.cf and change the following line as shown -

    Code:
    inet_interfaces = all
    Note that this change will allow any machine that can connect to your machine to be able to connect to postfix. Check out the postfix documentation for tips on how to secure your server and think about installing a firewall.

  5. #5
    Join Date
    Mar 2005
    Beans
    105

    Re: Telnet to port 25; connection refused for all but local host

    uhm... it looks like that is already the case

    see main.cf bellow

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


    # Debian specific: Specifying a file name will cause the first
    # line of that file to be used as the name. The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = no

    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname = rcws01.rosminicollege.school.nz
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = rcws01.rosminicollege.school.nz, localhost.rosminicollege.schoo$
    relayhost =
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    Last edited by abasel; January 13th, 2010 at 08:42 PM. Reason: Pasted wrong text

  6. #6
    Join Date
    May 2005
    Location
    Sydney, Australia
    Beans
    281

    Re: Telnet to port 25; connection refused for all but local host

    Interesting

    Can you post the output of
    Code:
    sudo netstat -plntu

  7. #7
    Join Date
    Mar 2005
    Beans
    105

    Re: Telnet to port 25; connection refused for all but local host

    The last line of main.cf, has

    inet_interfaces = all
    Here is netstat -plntu

    root@rcws01:~# netstat -plntu
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN 3951/slapd
    tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 3884/mysqld
    tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4205/apache2
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3794/sshd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    tcp6 0 0 :::389 :::* LISTEN 3951/slapd
    tcp6 0 0 :::22 :::* LISTEN 3794/sshd

  8. #8
    Join Date
    May 2005
    Location
    Sydney, Australia
    Beans
    281

    Re: Telnet to port 25; connection refused for all but local host

    tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    There is the problem - you are using sendmail and not postfix.

    You need to either edit the /etc/mail/sendmail.mc file(can't remember off the top of my head the setting to change)

    or you need to remove sendmail and use postfix

  9. #9
    Join Date
    Mar 2005
    Beans
    105

    Re: Telnet to port 25; connection refused for all but local host

    I, I've definetly installed postfix and can even run

    dpkg-reconfigure postfix

    When I try to remove sendmail I get

    root@rcws01:~# apt-get remove sendmail
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package sendmail is not installed, so not removed
    The following packages were automatically installed and are no longer required:
    gcj-4.3-base libsm-dev libstdc++5 libice-dev x11proto-xext-dev liblcms1
    libgcj9-0 ttf-wqy-zenhei libgcj-bc x11proto-kb-dev ttf-kochi-mincho
    sun-javadb-common ttf-kannada-fonts sendmail-base libjaxp1.3-java-gcj
    libxi-dev java-common libaccess-bridge-java libxdmcp-dev libxerces2-java-gcj
    ttf-kochi-gothic procmail xtrans-dev fontconfig ant-optional-gcj libxfont1
    sensible-mda imqv2 x11proto-core-dev ant default-jdk libcups2 default-jre
    libgcj-common sendmail-cf libgif4 ttf-telugu-fonts libjaxp1.3-java
    openjdk-6-jre-headless libxt-dev openjdk-6-jdk sun-javadb-core tzdata-java
    libxext-dev libice6 openjdk-6-jre openjdk-6-jre-lib libgcj9-jar
    libxerces2-java x11proto-input-dev libasound2 libpthread-stubs0-dev
    libxau-dev libpthread-stubs0 libfontenc1 glassfishv2-bin xfonts-utils
    libxtst6 rhino ttf-indic-fonts-core ttf-oriya-fonts ttf-baekmuk libsm6
    libx11-dev libxcb-xlib0-dev default-jre-headless libxi6 ca-certificates-java
    libxcb1-dev ttf-bengali-fonts ant-gcj xfonts-encodings ant-optional libxt6
    x-ttcidfont-conf make
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
    Sorry, I must be missing something

  10. #10
    Join Date
    May 2005
    Location
    Sydney, Australia
    Beans
    281

    Re: Telnet to port 25; connection refused for all but local host

    Even more interesting

    Code:
    tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 4020/sendmail: MTA:
    Can you please run the following command. It will tell us what actual program is listening on port 25.

    Code:
    ls -l /proc/4020 | grep exe
    You may need to change the above number if the pid of sendmail has changed - run the netstat -plntu command again to see if it is still pid 4020.

    You will see output similar to

    Code:
    [root@system ~]# ls -la /proc/4022 | grep exe
    lrwxrwxrwx  1 root root 0 2010-01-19 08:14 exe -> /usr/lib/postfix/master
    Then lets see what package that file belongs to

    Code:
    [root@system ~]# dpkg -S /usr/lib/postfix/master
    postfix: /usr/lib/postfix/master
    It belongs to the postfix package.

    Try that on yours and lets see what package the program is from.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •