Postfix: can't connect to localhost but can connect to

January 19, 2018 1.4k views
Email Ubuntu 16.04

Hello all!

For some reason I can’t seem to connect to postfix using ‘localhost’. The command 'telnet localhost 25’ returns the following:

telnet: Unable to connect to remote host: Connection refused

My /etc/hosts file looks as follows: localhost localhost.localdomain

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

/etc/postfix/ (relevant section):

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

Could anybody help me solve what’s going on?

1 Answer


Seems like that there is a typo in your /etc/hosts file, you need to change: localhost

To: localhost


Have another answer? Share your knowledge.