Error Codes Wiki

Linux Connection Refused

Warningnetwork

About Linux Connection Refused

Linux "Connection refused" means a TCP connection attempt was actively rejected because no service is listening on the target port. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: errno 111 (ECONNREFUSED) — TCP RST received. Target host is reachable but no service on that port. Different from timeout (host unreachable) or no route. Firewall may also send RST packets. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Service is not running on the target port. Service is listening on a different port or interface. Firewall rejecting (not dropping) the connection. Service crashed and is not restarting. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Check if service is running: systemctl status servicename. Check listening ports: ss -tlnp | grep port. Check firewall: iptables -L or firewall-cmd --list-all. Verify service binds to correct interface (0.0.0.0 vs 127.0.0.1). If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Does connection refused mean the server is down?

The server is up (it sent a RST), but nothing is listening on that specific port.

Overview

Linux "Connection refused" means a TCP connection attempt was actively rejected because no service is listening on the target port.

Key Details

  • errno 111 (ECONNREFUSED) — TCP RST received
  • Target host is reachable but no service on that port
  • Different from timeout (host unreachable) or no route
  • Firewall may also send RST packets

Common Causes

  • Service is not running on the target port
  • Service is listening on a different port or interface
  • Firewall rejecting (not dropping) the connection
  • Service crashed and is not restarting

Steps

  1. 1Check if service is running: systemctl status servicename
  2. 2Check listening ports: ss -tlnp | grep port
  3. 3Check firewall: iptables -L or firewall-cmd --list-all
  4. 4Verify service binds to correct interface (0.0.0.0 vs 127.0.0.1)

Tags

linuxnetworkconnection refusedtroubleshootingfix

More in Network

Frequently Asked Questions

The server is up (it sent a RST), but nothing is listening on that specific port.