Linux Foundations / Read Network Evidence

Separate name resolution from reachability

Lesson 32 of 37. Open to read. No account needed.

A name can resolve even when a packet receives no reply. A packet can receive an ICMP reply even when the application you want is unavailable. Useful diagnosis keeps those observations separate instead of treating one successful command as proof that the whole connection works.

You will collect name-service results and small, bounded ICMP observations in one owned note. Start with loopback inside the guest. Use the one named external target only when the declared guest environment permits it. Supplied failure cases let you practise reasoning without breaking real networking.

1. Ask a different question at each layer

Complete Inspect addresses and routes without changing them first and settle its cleanup. That lesson separated an assigned address, the main-table route listing and a selected route lookup. Its numeric route-get commands sent no packets.

This lesson adds two observations:

ObservationQuestionLimit
Name-service lookupWhat address records does the guest's configured name-service path return for this name now?It does not test a listener or prove a DNS packet was sent.
ICMP Echo probeDoes an Echo Reply return for this particular attempt?It does not test an application connection or prove that every kind of traffic works.

Name resolution maps a name to address information. Linux applications can obtain that information through configured Name Service Switch (NSS) sources. Those sources may include local files and DNS; their actual order and behavior are configuration-dependent. A successful lookup is not proof that the answer came from a fresh DNS exchange.

ICMP carries network control messages. In this lesson, ping sends a small number of Echo Requests and reports matching replies or other diagnostics. An ICMP reply is different from an HTTP response, a successful login or an open application listener. Policy can block or ignore ICMP while some application traffic still works.

The numeric address 127.0.0.1 is loopback inside this guest. A reply from it does not test the host's NAT, an external gateway or the Internet. The external name is ubuntu.com; its actual returned addresses can change. Do not copy a fixed address from a lesson or assume it matches another run.

2. Establish the ordinary guest and the permitted scope

Use the declared full Ubuntu guest and your ordinary nonzero-UID account. Do not run this task on the host or elevate a probe with sudo. Inspect the taught command origins first:

type cd pwd printf set type id ps mkdir ls cat rm rmdir getent ping
type -a ls
type -P ls

Require the expected Bash builtins and guest utilities. For ls, accept only the understood color-only alias, if present, and expected executable paths; stop for a hidden function or other origin. Require getent and ping to be the expected guest executables, without an unexplained alias or wrapper. A missing tool is a readiness gap, not a reason to install or alter anything in this lesson.

Then inspect the existing context:

id -u
id -un
ps -p $ -o comm=
ps -p 1 -o comm=
set -o

Require the recorded ordinary identity, Bash and the full guest's systemd PID 1. Keep the already-taught errexit-off baseline so an unsuccessful lookup or probe can be interpreted. Preserve unexpected settings and reconcile the context before proceeding.

Run one line at a time. Read every result and stop after an unexpected setup, file or permission error. The permitted destinations are loopback and, conditionally, the single name ubuntu.com. This is no invitation to scan a subnet, try other hosts or bypass a network policy. If the external probe is not permitted, record that it was not run and use the supplied reasoning cases; do not manufacture a live result.

All queries and probes run in the foreground. If a lookup or probe hangs unexpectedly, use the already-taught Ctrl+C in that same terminal to interrupt it and wait for the prompt. Record its immediate actual status, then label the run interrupted. Do not assume an interrupted run completed the requested count, or assign it a particular status from memory.

3. Create the evidence note

The task owns only ~/linux-practice/check-names-and-bounded-reachability/ and its network-evidence.txt file. Inspect the known parent and new task name without following a task link:

ls -ld ~/linux-practice
ls -ld ~/linux-practice/check-names-and-bounded-reachability

Require the ordinary parent owned by your recorded account and the task name absent. An existing entry belongs to the resume branch. After acceptance:

mkdir ~/linux-practice/check-names-and-bounded-reachability
ls -ld ~/linux-practice/check-names-and-bounded-reachability

Accept that new ordinary owned directory, then enter and check:

cd ~/linux-practice/check-names-and-bounded-reachability
pwd
ls -a

Require the exact recorded task path and only dot entries. Create the absent note using the already-taught two-line printf seed:

printf '%s\n' 'Name and ICMP observations' 'Actual guest evidence; supplied cases stay separate.' > network-evidence.txt
ls -ld -- network-evidence.txt
cat network-evidence.txt

Require an ordinary owned single-link file with exactly those two lines. Before each later section, recheck its identity and your exact cwd. Require each header, append and redirection to succeed before continuing. The taught >> network-evidence.txt 2>&1 appends stdout and directs stderr to the same file; it does not promise an arrival order between streams.

Capture each query's immediate $? before another command replaces it, then read the note. A query or probe can legitimately return an unsuccessful status; that does not turn a failed file append into valid evidence. Keep actual output, errors and status together.

4. Read name-service results before expecting a response

Earlier account lessons introduced getent as a database lookup. Here, ahosts is the address database and ubuntu.com is the one lookup key:

printf '%s\n' '--- Actual name lookup: ahosts ubuntu.com ---' >> network-evidence.txt
getent ahosts ubuntu.com >> network-evidence.txt 2>&1
printf 'ahosts query exit: %s\n' "$?" >> network-evidence.txt
cat network-evidence.txt

The ahosts lookup uses an unspecified address family request. That does not guarantee both IPv4 and IPv6 rows: configured services, resolver behavior and the guest's available families can affect the answer. Returned rows contain an address, a socket-type label and sometimes a canonical name. STREAM, DGRAM and RAW are returned socket-type categories; three rows for one address are not three different machines or three proved listeners. Preserve the rows and do not count them as server count.

getent resultInterpretation for this named query
Status 0 with returned entriesThe configured name-service lookup found entries. Read the actual addresses and families.
Status 2 without an entry for this keyThe query did not find the requested key. This is not, by itself, a diagnosis of a particular DNS server or a DNS response code.
Status 1A missing argument or unknown database is a command-use error.
Status 3The requested database operation does not support enumeration; it is not an ordinary successful named lookup.

Read the actual status and any diagnostics, including tool errors. A name lookup does not prove that the corresponding address has a usable route, that packets will return or that a service is listening.

For the independent task, the related database ahostsv4 requests IPv4 address information specifically. Its command shape is the same: database then one name. This narrower family request is a useful comparison when the next probe explicitly selects IPv4. It does not change NSS configuration or force a query to a particular DNS server.

Predict: if ahosts returns several STREAM/DGRAM/RAW rows, what would still have to be observed before claiming an application answered?

5. Make the first ICMP observation local and bounded

Read the option meanings before the first ping:

PartMeaning in this task
-4Use IPv4 for this probe.
-nUse numeric output rather than reverse name lookup. A hostname argument still needs forward resolution.
-c 3Send up to three Echo Requests. With the deadline selected, ping can continue waiting for the requested replies or the deadline.
-w 6Set a six-second ping deadline. Do not treat it as a guarantee that all earlier hostname-resolution work fits within six seconds.
-W 2Set the response-wait timeout in seconds for the no-response situation. It is not a universal wall-clock limit for the whole command.
127.0.0.1Probe loopback inside this guest, without a hostname to resolve.

The count and deadline bound the intended probing work. They are not a promise that every request will be sent or answered. In particular, do not calculate a universal elapsed time by multiplying count by -W. The unexpected-hang Ctrl+C recovery remains available.

After the note and location gates, run the exact numeric-loopback attempt:

printf '%s\n' '--- Actual loopback ICMP: count 3 ---' >> network-evidence.txt
ping -4 -n -c 3 -w 6 -W 2 127.0.0.1 >> network-evidence.txt 2>&1
printf 'three-request loopback ping exit: %s\n' "$?" >> network-evidence.txt
cat network-evidence.txt

Read the sent/received counts, loss, diagnostics and status. Reply sequence numbers and timing values vary. A loopback reply is evidence about the guest's local IP path for that attempt; it says nothing about external NAT or an application port. If the ordinary account gets a permission error, preserve it and reconcile the guest baseline instead of adding sudo.

Interpret ping status with the selected options

ResultMeaning
Status 0A successful ping result under the command's criteria; read the actual reply/count summary. It is not application success.
Status 1No replies, or—with both count and deadline—fewer replies than the requested count before the deadline. Partial replies can therefore coexist with status 1.
Status 2Another error, such as a command, name or permission problem. Read the actual diagnostic before classifying it.

An interrupted run needs an explicit interruption label whatever its actual status. After its immediate status has been saved, append this note only if that is what actually happened:

printf '%s\n' 'This run was interrupted with Ctrl+C; it is an incomplete observation.' >> network-evidence.txt

Predict: if a remote attempt sends three requests and receives two before the deadline, can status 1 mean that no packets ever returned?

6. Compare the named external attempt when permitted

Check the declared guest environment permits this one bounded ubuntu.com probe. If it does not, use the not-run branch below. A name-lookup error or other unresolved readiness problem is also a reason to preserve the evidence and postpone the external attempt, rather than treating repeated probing as repair.

When the scope is permitted and the preceding observations are understood:

printf '%s\n' '--- Actual named external ICMP: ubuntu.com ---' >> network-evidence.txt
ping -4 -n -c 3 -w 6 -W 2 ubuntu.com >> network-evidence.txt 2>&1
printf 'named external ping exit: %s\n' "$?" >> network-evidence.txt
cat network-evidence.txt

The same options apply, but the input is now a name. -n suppresses reverse name display; it does not remove the need to obtain a forward address for ubuntu.com. This lookup can happen at a different time or use a narrower family than the earlier ahosts query. Read the actual address chosen by ping instead of assuming it is the first earlier row. A slow lookup can also outlast what you expected from -w; interrupt an unexpected hang and record it honestly.

If scope or readiness prevents this attempt, append an explicit alternative record after the usual note gate, without inventing output or an exit code:

printf '%s\n' '--- Named external ICMP: not run ---' 'Not run: permitted scope or required readiness was not established for this attempt.' >> network-evidence.txt
cat network-evidence.txt

A reply supports that ICMP exchange with the selected address at that time. No reply can reflect filtering, loss, routing, a return-path problem or remote behavior; it does not prove the host is down. Neither outcome alone establishes that the web service works. Do not change DNS, routes, firewall rules or host NAT to make a preferred result appear.

Independent task: classify the evidence, then collect another observation

The following are supplied teaching records, not your guest output and not commands to use for inducing failures.

Case A — a name lookup has no result

Query: getent ahosts ubuntu.com
Returned address rows: none
getent status: 2
Earlier guest record: a non-loopback IPv4 address and a main-table default route were present.
No ICMP probe was made in this case.

Case B — route evidence exists but no ICMP reply was recorded

Named lookup: IPv4 result(s) returned; addresses deliberately omitted.
Selected IPv4 route: available for the recorded destination and lookup context.
Probe target: ubuntu.com, using that attempt's actual selected IPv4 address.
ICMP summary: 3 transmitted, 0 received, 100% packet loss.
ping status: 1
No application connection was tested.

Before opening the hints or answer:

  1. Explain the strongest supported conclusion in each case. Does Case A identify a particular failed DNS component? Does Case B prove the host is down or its web service unavailable?
  2. Propose one specific next observation using this lesson's read-only name-service forms. Explain what its result could clarify and what would remain untested. Do not propose a configuration change or new target.
  3. In your actual guest, query getent ahostsv4 ubuntu.com, appending a separate header, actual output and immediate status to the existing note. Compare families/results with the earlier ahosts section without assuming the network stayed unchanged between queries.
  4. Make an actual independent numeric-loopback attempt with the taught options changed to two requests, a five-second deadline and a one-second response wait. Record its own header, output and immediate status. This local attempt does not depend on permission to probe ubuntu.com.

Success: classify both supplied cases without exceeding their evidence, retain the four actual local/name-service observation sections and the external attempt or its explicit not-run record, and explain each scope. An actual error is evidence to preserve; a readiness block leaves that execution step pending rather than satisfied by the supplied case.

Graduated hints

  1. Separate “no entry returned,” “route selected” and “reply received.” They answer different questions, and a socket-type label is not a listener.
  2. A family-specific ahostsv4 query narrows the lookup question. It does not bypass the configured name-service path or prove a DNS exchange occurred.
  3. Reuse the named capture pattern. For the independent loopback command, keep -4 -n and the numeric target, changing only the three taught values.

Answer and Reasoning

Case A establishes that the named ahosts query did not return an entry. The earlier address and default route do not make name resolution succeed. The record does not identify which NSS source was used or prove a specific DNS server, DNS response code or remote application failure. A targeted ahostsv4 query is a useful next comparison because it asks specifically for IPv4 entries through the same configured name-service mechanism.

Case B has name and route evidence but no Echo Reply in its bounded attempt. That rules out neither ICMP policy nor other loss/return-path explanations. It cannot establish whether the web application is available. A current ahostsv4 query can check the current family-specific lookup result; it will not by itself explain the lost replies. The prior lesson's saved route context and this probe's selected address must also remain distinguishable.

After accepting the actual note identity, cwd and each append, a complete independent lookup is:

printf '%s\n' '--- Actual independent name lookup: ahostsv4 ubuntu.com ---' >> network-evidence.txt
getent ahostsv4 ubuntu.com >> network-evidence.txt 2>&1
printf 'ahostsv4 query exit: %s\n' "$?" >> network-evidence.txt
cat network-evidence.txt

Read the result before continuing. A successful result need not have the same row count or order as ahosts. Neither row count nor repeated socket types counts tested applications. Preserve a failed lookup and explain its scope; the numeric-loopback attempt does not need that name to resolve.

The independent local probe is:

printf '%s\n' '--- Actual independent loopback ICMP: count 2 ---' >> network-evidence.txt
ping -4 -n -c 2 -w 5 -W 1 127.0.0.1 >> network-evidence.txt 2>&1
printf 'two-request loopback ping exit: %s\n' "$?" >> network-evidence.txt
cat network-evidence.txt

Compare actual sent/received counts, diagnostics and status with the guided three-request loopback attempt. Do not replace actual timing or packet counts with an expected example. Numeric loopback avoids a hostname resolution question and remains within the guest's local scope.

The earlier prediction about two replies has a precise answer: with count and deadline together, fewer than the requested three replies can produce status 1 even though replies were received. Status alone is too little evidence. The summary and diagnostics explain which observation occurred.

Diagnose without making the network fit the exercise

ObservationBounded interpretation and next step
ahosts repeats an address with several socket typesRead it as address/socket-type records, not multiple machines or live listeners.
ahosts lacks a familyCompare ahostsv4 and the actual guest context; do not assume every lookup must return both families.
getent returns no entry/status 2Preserve the named-query failure; do not label it a particular DNS failure without evidence.
Numeric loopback is blocked or ping has a permission errorRecord the error and reconcile the ordinary guest baseline; do not elevate or alter policy here.
Named ping resolves an address but no replies arriveDistinguish forward lookup success from ICMP outcome; host-down and application-down claims are unsupported.
ping returns 1 with some repliesCount plus deadline can require more replies; read the actual counts.
A command outlasts the expected intervalCtrl+C the current foreground attempt, save its immediate status and label the interruption. Resolution time is not universally covered by the ping deadline.
External probing is not permittedPreserve the explicit not-run record and complete the supplied reasoning cases; do not turn them into actual execution evidence.

Cleanup and resume

Finish both independent observations and explanations first. Ensure the foreground lookup/probe has returned to the prompt, or interrupt that same attempt as taught. No background probe was launched, and there is no network setting to restore.

Recheck the known parent and task entry:

ls -ld ~/linux-practice
ls -ld ~/linux-practice/check-names-and-bounded-reachability

Require ordinary directories owned by the recorded account, then enter and verify separately:

cd ~/linux-practice/check-names-and-bounded-reachability
pwd

Require the exact recorded path before inspecting the retained evidence:

ls -a
ls -ld -- network-evidence.txt
cat network-evidence.txt

Require only the recognized ordinary owned single-link note and dot entries. Preserve an unexpected entry or unfinished evidence. Establish the actual documented confirmation responses; do not guess an unfamiliar affirmative response from an English y/n example. Only after acceptance:

rm -i -- network-evidence.txt

Refusal leaves the note and stops cleanup. After accepted removal:

ls -a

Require the task empty, then return and verify:

cd ~/linux-practice
pwd

Require the recorded shared-root path, then inspect the remaining task entry:

ls -ld -- check-names-and-bounded-reachability

Only after accepting that ordinary owned empty directory:

rmdir -- check-names-and-bounded-reachability

Retain the shared root and all DNS, route, firewall, host NAT and interface configuration. Do not flush caches or remove system logs as cleanup.

On resume, recheck the guest, account, origins, permitted probe scope and owned note. Read earlier sections before appending a clearly labelled new attempt. A missing old status cannot be recovered from a later $?; a new lookup can return different addresses. Preserve interrupted/not-run labels and do not substitute the supplied cases for missing live evidence.

Sources and other study views

The getent companion is Linux man-pages 6.03, older than the selected Noble glibc 2.39 context. The ping companion documents iputils 20221126, older than the Noble 20240117 family. Only the bounded forms described here are used; installed configuration, returned addresses and exact diagnostic wording can differ. The current Coreutils manual is newer than the selected 9.4 tools. These sources explain command behavior; the actual guest observations remain separate evidence to collect and interpret.

Revision rebuilds the distinction between names and replies. Quick Reference retrieves the bounded forms and status limits.

Study this course with an account

Course access adds revision notes, the Quick Reference, saved progress, bookmarks and your own notes.

INR 99 plus 18% GST. 90 days of online access. No auto-renewal.

See course access

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy