DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Fix “Unknown Host” on Linux When Pinging the IP Works

When Linux can ping an IP but says “unknown host” for its name, the route is usually fine and hostname resolution is failing. This guide pinpoints DNS, NSS, resolver ownership, mDNS, and VPN causes with exact commands and persistent fixes.
Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If ping 203.0.113.25 succeeds but ping server.example returns unknown host, your network path is probably working and hostname resolution is not. The IP test goes straight to an address; the hostname test must first pass through Linux’s name-service stack, including /etc/hosts, DNS, NSS, and sometimes mDNS or a local resolver.

Fix the failing layer rather than changing routes or firewall rules at random. Confirm the name, test the same lookup path applications use, inspect resolver ownership and configuration, then make the correction in the service that manages your DNS settings.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What “unknown host” means when the IP responds

A successful IP ping proves only that the kernel can send traffic to that address and receive replies (subject to the limits of ICMP and the remote host’s firewall). It does not prove that Linux can translate a name into an address. Name translation happens before ping opens its network connection.

SUSE’s administration guidance describes this condition directly: when ping reports unknown host, “the name service is not configured correctly or the host name used was incorrect.” The two broad possibilities are therefore a wrong name and a broken local lookup path. A typo, an incomplete short name, a missing search domain, an unavailable DNS server, an incorrect NSS rule, or an mDNS mismatch can all produce the same symptom.

#1 Best Overall
Sale
TP-Link USB to Ethernet Adapter,Support Nintendo Switch,1Gbps,Plug and Play | Gigabit RJ45 to USB A 3.0 Network Adapter, Foldable & Portable Design, Compatible w/ Windows, macOS, & Linux(UE306)
  • 𝐇𝐢𝐠𝐡-𝐒𝐩𝐞𝐞𝐝 𝐔𝐒𝐁 𝐄𝐭𝐡𝐞𝐫𝐧𝐞𝐭 𝐀𝐝𝐚𝐩𝐭𝐞𝐫 - UE306 is a USB 3.0 Type-A to RJ45 Ethernet adapter that adds a reliable wired network port to your laptop, tablet, or Ultrabook. It delivers fast and stable 10/100/1000 Mbps wired connections to your computer or tablet via a router or network switch, making it ideal for file transfers, HD video streaming, online gaming, and video conferencing.
  • 𝐔𝐒𝐁 𝟑.𝟎 𝐟𝐨𝐫 𝐅𝐚𝐬𝐭𝐞𝐫, 𝐌𝐨𝐫𝐞 𝐒𝐭𝐚𝐛𝐥𝐞 𝐃𝐚𝐭𝐚 𝐓𝐫𝐚𝐧𝐬𝐟𝐞𝐫𝐬- Powered via USB 3.0, this adapter provides high-speed Gigabit Ethernet without the need for external power(10/100/1000Mbps). Backward compatible with USB 2.0/1.1, it ensures reliable performance across a wide range of devices.
  • 𝐒𝐮𝐩𝐩𝐨𝐫𝐭𝐬 𝐍𝐢𝐧𝐭𝐞𝐧𝐝𝐨 𝐒𝐰𝐢𝐭𝐜𝐡- Easily connect your Nintendo Switch to a wired network for faster downloads and a more stable online gaming experience compared to Wi-Fi.
  • 𝐏𝐥𝐮𝐠 𝐚𝐧𝐝 𝐏𝐥𝐚𝐲- No driver required for Nintendo Switch, Windows 11/10/8.1/8, and Linux. Simply connect and enjoy instant wired internet access without complicated setup.
  • 𝐁𝐫𝐨𝐚𝐝 𝐃𝐞𝐯𝐢𝐜𝐞 𝐂𝐨𝐦𝐩𝐚𝐭𝐢𝐛𝐢𝐥𝐢𝐭𝐲- Supports Nintendo Switch, PCs, laptops, Ultrabooks, tablets, and other USB-powered web devices; works with network equipment including modems, routers, and switches.

The most useful distinction is whether every lookup method fails or only one. Linux applications normally use the Name Service Switch (NSS) through the system resolver libraries. A tool such as host or dig can query DNS more directly, so it may succeed while an application using NSS still fails.

Run a short diagnostic sequence first

Use the exact hostname that fails, replacing NAME below. Run these commands as the affected user; elevated privileges are not needed for reading the usual files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Verify spelling and qualification. Try the fully qualified domain name (FQDN), such as server.example.com, rather than relying on a short name such as server. A short name works only when an appropriate search domain is configured.
  2. Test the application lookup path. Run getent hosts NAME. This uses NSS, the path most command-line programs and many libraries use. An address line means NSS resolved the name; no output or a “not found” result means the NSS path did not.
  3. Compare another resolver client. Run host NAME or, on systems using systemd-resolved, resolvectl query NAME. SUSE recommends host for checking whether a hostname translates to an address. Record whether the result contains an address, an authoritative error such as NXDOMAIN, or a timeout.
  4. Identify the resolver in use. Check systemctl status systemd-resolved and resolvectl status when systemd-resolved may be present. Also inspect the target of /etc/resolv.conf with ls -l /etc/resolv.conf. The symlink and service status reveal whether a local stub, NetworkManager, DHCP client, or a static file owns the settings.
  5. Inspect the two key configuration files. Read /etc/resolv.conf and /etc/nsswitch.conf. Look for valid nameservers, search domains, and a sensible hosts: line.
  6. Query a DNS server directly. If dig is installed, run dig NAME @SERVER, replacing SERVER with a nameserver shown by your configuration. A timeout points to reachability, filtering, or a server problem. A valid DNS answer combined with a failing getent result points toward NSS ordering, local policy, or caching.

Keep the results together. The combination of getent, host/resolvectl, and direct dig testing usually identifies the layer without guesswork.

Check /etc/resolv.conf without breaking resolver ownership

/etc/resolv.conf records the nameserver addresses and, commonly, the search domain used by the host. A typical static-looking file contains one or more lines such as nameserver 192.0.2.53 and possibly search example.com. An empty file, an unreachable private address, or a stale nameserver from an old network explains why IP traffic works while names fail.

Rank #2
Amazon Basics USB 3.0 to 10/100/1000 Gigabit Ethernet Internet Adapter, Compatible with Windows and macOS, Black
  • Connects a USB 3.0 device (computer/laptop) to a router, modem, or network switch to deliver Gigabit Ethernet to your network connection. Does not support Smart TV or gaming consoles (e.g.Nintendo Switch).
  • Supported features include Wake-on-LAN function, Green Ethernet & IEEE 802.3az-2010 (Energy Efficient Ethernet)
  • Supports IPv4/IPv6 pack Checksum Offload Engine (COE) to reduce Cental Processing Unit (CPU) loading
  • Compatible with Windows 8.1 or higher, Mac OS

Do not assume that the visible file is the authoritative configuration. On many distributions it is a symbolic link generated by systemd-resolved or NetworkManager. A hand edit can appear to fix the problem, then disappear after a reboot, DHCP lease renewal, VPN connection, or network restart. First determine which component owns the file; then change the DNS server or search domain in that component’s configuration.

What to verify

  • At least one listed nameserver is reachable from the current network and is intended for this connection.
  • The search domain matches the local network or VPN when you expect short names to work.
  • There are no stale entries from a disconnected interface, previous VPN, or old office network.
  • The file’s format is valid: one directive per line, with no copied prompt characters or unrelated text.

If DHCP or NetworkManager normally supplies DNS, renew the connection or restart that manager after correcting its settings instead of repeatedly editing the generated file.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect NSS: the hosts: line controls lookup order

NSS determines where Linux looks for host information and in what order. Open /etc/nsswitch.conf and locate the line beginning with hosts:. A common baseline is:

hosts: files dns

Here, files checks /etc/hosts first and dns then consults the configured DNS resolver. Real systems may add modules for mDNS, LDAP, or local caches. The order and return conditions matter: a module can stop the search before DNS is attempted.

Rank #3
USB A/C to Ethernet Adapter, 3xUSB3.0 and 1000M RJ45 Network hub for laptop | Plug & play 4-in-1 USB C Hub, Gigabit LAN for Mac/Chrome/XPS & USB-C phones/iPad, 3 USB-A ports for mouse/keyboard/USB fan.
  • [Expansion Ports] The USB C to Ethernet Adapter expands the device to three USB 3.0 ports and one Gigabit Ethernet port. Provides you more peripheral ports while maintaining a stable network connection, plug and play, no driver required.
  • [Gigabit Network Port] ALL-LUCKY USB Ethernet Adapter transmission rate up to 1000Mbps, also compatible with 10/100Mbps bandwidth. It allows you to enjoy a smooth and stable network connection and avoid too much lag. (Note: To reach 1Gbps, please use CAT6 or above Ethernet cable connection)
  • [Convertible Connector]This usb hub with ethernet not only has USB-A connector, but also can be converted to USB-C connector, so that you can easily convert the connector according to the device port, improve the convenience of use.
  • [High-Speed Data Transfer] The usb to ethernet adapter adopts USB 3.0 transmission technology, supports up to 5Gbps transmission rate, and is compatible with USB 2.0(480Gbps),USB 1.0(12Mbps), easily transfer video, files and other data for you in seconds. (Note: Maximum output current is 900mA, does not support charging devices.)
  • [Widely Compatible]The usb c ethernet adapter for iMac, MacBook Pro, iPad Pro, XPS and many other devices. Compatible with Windows 11/10/8.1/8, Mac OS, iPad OS, Chrome OS.(Note: Driver is required on Win 7) It can be used in office, school, library and other occasions, compact and portable, easy to carry around.

Correct an early-return rule

One failure pattern documented for Red Hat systems involves an erroneous [NOTFOUND=return] action or stale caching module. If an earlier source reports “not found” and the action says to return immediately, the DNS module later on the line is never reached. Remove the bad action or place the intended DNS source where it can be consulted, preserving any organization-required modules.

After changing NSS, test with getent hosts NAME rather than relying only on host. The goal is for the same path used by ordinary applications to return an address.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When systemd-resolved is involved

systemd-resolved can provide a local stub resolver, per-link DNS servers, split DNS domains, and caching. Start with:

systemctl status systemd-resolved
resolvectl status

resolvectl status shows global and link-specific DNS servers, search domains, and routing domains. A VPN interface may own a private DNS server for internal names while the normal interface handles public names. If the required link is down, has no DNS server, or lacks the routing domain for the name, the query can fail even though an IP address remains reachable.

Rank #4
Sale
Anker USB C to Ethernet Adapter, Portable 1 Gbps Network Hub | Aluminum, Compact, 10/100/1000Mbps, for MacBook Pro, iPad Pro, ChromeBook, XPS, Galaxy and More
  • The Anker Advantage: Join the 65 million+ powered by our leading technology.
  • Instant Internet: Connect to the internet instantly from virtually any USB-C 3.0 device, and enjoy stable connection speeds of up to 1 Gbps.
  • Lightweight and Compact: The space-saving and portable design measures just over half an inch thick and weighs about the same as a AA battery.
  • Premium Build: Features a sleek aluminum exterior and braided-nylon cable to complement the design of high-end devices.
  • What You Get: PowerExpand USB-C to Gigabit Ethernet Adapter, welcome guide, 18-month worry-free warranty, and friendly customer service.

Check where /etc/resolv.conf points. A design using the systemd-resolved stub normally points to a resolver-managed file; replacing that link with a manually maintained file can bypass the intended per-link behavior. Conversely, a system that does not run systemd-resolved should not point at a stub address that has no listener.

Once the owning design is clear, reconnect the affected link, renew its DHCP information, or correct the resolver manager’s DNS and domain settings. Then rerun resolvectl query NAME and getent hosts NAME.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common causes and targeted fixes

A typo or missing domain suffix

Try the exact FQDN. If getent hosts server fails but getent hosts server.example.com works, add the correct search domain through DHCP, NetworkManager, systemd-resolved, or the relevant network profile. Do not add a random public suffix: short-name expansion is local policy, not a universal DNS feature.

Stale or invalid DNS servers

If host NAME and dig NAME @SERVER time out, test each configured server separately. Restore the DNS servers supplied by the current network, DHCP lease, VPN, or resolver manager. In one systemd incident, adding nameserver 8.8.8.8 to /etc/resolv.conf immediately restored hostname queries; that is evidence of a missing server, not a general instruction to hard-code a public resolver. Use the DNS service appropriate to the network, especially when internal names are required.

Best Value
BENFEI USB 3.0 to Ethernet Adapter, USB C to RJ45 Gigabit LAN (1000Mbps) Network Adapter, Compatible with MacBook/Pro/Air, Surface Pro, Windows 11/10/8/7, Mac OS [Aluminium Shell&Nylon Cable]
  • COMPACT DESIGN - The compact-designed portable BENFEI USB A/C to Ethernet adapter connects your computer or tablet to a router,modem or network switch for network connection. It adds a standard RJ45 port to your Ultrabook, notebook or Macbook Air for file transferring, video conferencing, gaming, and HD video streaming.
  • SUPERIOR STABILITY - Built-in advanced IC chip works as the bridge between RJ45 Ethernet cable and your USB A/C devices. The driver-free installation with native driver support in Chrome, Mac, and Windows OS; The USB A/C Ethernet adapter dongle supports important performance features including Wake-on-Lan (WoL), Full-Duplex (FDX) and Half-Duplex (HDX) Ethernet, Crossover Detection, Backpressure Routing, Auto-Correction (Auto MDIX).
  • INCREDIBLE PERFORMANCE - Supports full 10/100/1000Mbps gigabit ethernet performance over USB A/C's 5Gbps bus, faster and more reliable than most wireless connections. Link and Activity LEDs. USB powered, no external power required. Backward compatible with USB 2.0/1.1.✅ To reach 1Gbps, make sure to use CAT6 & up Ethernet cables.
  • BROAD COMPATIBILITY - The USB A/C-Ethernet adapter is compatible with Windows 11/10/8.1/8/7/Vista/XP, Mac OSX 10.6/10.7/10.8/10.9/10.10/10.11/10.12, Linux kernel 3.x/2.6, Android and Chrome OS.Compatible with IEEE 802.3, IEEE 802.3u and IEEE 802.3ab. Supports IEEE 802.3az (Energy Efficient Ethernet).❌Do Not Support Windows RT. (NOT compatible with Nintendo Switch.)
  • 18 MONTH WARRANTY - Exclusive BENFEI Unconditional 18-month Warranty ensures long-time satisfaction of your purchase; Friendly and easy-to-reach customer service to solve your problems timely.

An incorrect /etc/hosts entry

Review /etc/hosts for a wrong address, duplicate name, or missing private mapping. Because files commonly precedes dns, an incorrect local line can make Linux use the wrong address or prevent the expected DNS result. Correct or remove the stale line, then verify with getent hosts NAME.

“.local” names and mDNS

Names ending in .local are often multicast DNS (mDNS), not ordinary unicast DNS. Inspect the hosts: line for entries such as mdns4_minimal [NOTFOUND=return]. Micro Focus documents cases where this rule causes ping to report unknown host even though host or nslookup can resolve the same name through DNS. Decide whether the name is intended to be mDNS or ordinary DNS, then configure the matching NSS module and service; do not blindly remove mDNS support if local discovery depends on it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Split DNS or VPN routing

A private hostname may resolve only while a VPN interface is connected. Compare resolvectl status before and after connecting the VPN and look for the domain’s routing rule and DNS server. If the name is sent to the public resolver instead of the private one, correct the VPN profile or resolver manager rather than changing the remote host’s IP.

Make the repair persistent

Resolver state has an owner. Common owners include DHCP, NetworkManager, systemd-resolved, a VPN client, or a deliberately static configuration. Make the change there:

  • DHCP-managed links: correct the DHCP-provided DNS or renew the lease after fixing the network.
  • NetworkManager profiles: update the connection’s DNS and search-domain settings, then reactivate the connection.
  • systemd-resolved: configure per-link or global DNS through the service’s supported interface and verify with resolvectl status.
  • Static servers: maintain /etc/resolv.conf as a static file only when no other manager is expected to generate it.
  • VPN clients: ensure the client installs the private DNS server and routing domain on connection and removes them on disconnect.

A manual edit to a generated /etc/resolv.conf is a useful diagnostic experiment, but it is not a durable fix if another service will overwrite it.

Compare the resolver designs before changing anything

Question What to inspect Why it matters
Who owns resolver configuration? Symlink target of /etc/resolv.conf, service status, network manager, VPN client Editing the wrong layer will be overwritten or bypassed
Which DNS servers are active? resolv.conf and resolvectl status An unreachable or inappropriate server causes timeouts or NXDOMAIN
What is the NSS order? hosts: in /etc/nsswitch.conf Early-return rules or stale caches can prevent DNS from running
What kind of name is this? Ordinary DNS, split DNS, private zone, or .local mDNS Each type requires the corresponding server, routing, or NSS module
Which tools disagree? getent, host, resolvectl, and dig Disagreement identifies whether the fault is DNS itself or the local lookup path

Verify the result and avoid false conclusions

  1. Run getent hosts NAME and confirm the expected address.
  2. Run ping NAME and verify that it uses the same address you intended; DNS may return multiple addresses.
  3. Repeat the test after reconnecting the network, renewing DHCP, or reconnecting the VPN, depending on the original failure.
  4. Test a public name and the affected private name separately. A public success does not prove that split-DNS routing is correct.
  5. Check applications that originally failed. Some programs cache DNS independently, so restart that application after changing resolver state.

If the IP ping later fails too, you have a separate routing, firewall, ICMP, or remote-host problem. Keep that investigation distinct from the original name-resolution error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.