Network is unreachable 🐧 Linux

connect: Network is unreachable (ENETUNREACH)

The host has no route to the destination network — no default gateway, interface down, or trying IPv6 without IPv6 connectivity.

Seen on: Linux

Meaning

The kernel fails immediately because the routing table has no route. Typical: the network interface is down, DHCP didn’t set a default gateway, or an IPv6 address was chosen on an IPv4-only network.

Common causes

  • No default route (gateway missing)
  • Interface down / cable/Wi-Fi disconnected
  • IPv6 destination on an IPv4-only network
  • VPN changed routes

⚡ Quick fix

  1. Check routes: ip route and ip -6 route
  2. Bring the interface up and renew DHCP
  3. Prefer IPv4 (-4 flag) if IPv6 isn’t available

Detailed fix by platform

Linux

  1. bash
    ip -br addr
    ip route
    sudo dhclient -v eth0   # or: sudo netplan apply
    curl -4 https://example.com

How to diagnose

  1. Routes — default via … present?
  2. Interface — UP with an address?
  3. Family — IPv6 address being used?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.