{ "id": "linux-network-inspection", "title": "Answer Three Real Questions With Three Real Commands", "category": "Networking", "isolation_type": "shared_namespace", "difficulty": "Easy", "type": "task", "weight": 4, "description": "## Answer Three Real Questions With Three Real Commands\n\nEach networking command answers a specific question. Practice treating them that way.\n\n**Your task:**\n\n1. \"What IP address does this machine have?\" — write your `eth0` IPv4 address to `/srv/network-lab/my-ip.txt`\n2. \"What's listening on port 80?\" — confirm something is, and write `80` to `/srv/network-lab/listening-port.txt`\n3. \"What does DNS say `lab-internal.test` resolves to?\" — a hosts entry for it already exists on this machine; write the resolved IP to `/srv/network-lab/resolved-ip.txt`", "hints": [ { "title": "Your own IP", "body": "`ip -4 addr show eth0` prints your interface's IPv4 address in an `inet a.b.c.d/nn` line.", "command": "ip -4 addr show eth0" }, { "title": "What's listening", "body": "`ss -lnt` lists every TCP socket in LISTEN state and its port.", "command": "ss -lnt" }, { "title": "Resolving a name", "body": "`getent hosts ` resolves a hostname using the same lookup mechanism the rest of the system uses (checks /etc/hosts, then DNS) — a reliable choice when you're not sure which one will answer.", "command": "getent hosts lab-internal.test" } ], "setup_commands": [ { "command": "mkdir -p /srv/network-lab" }, { "command": "grep -q lab-internal.test /etc/hosts || echo '10.99.99.42 lab-internal.test' >> /etc/hosts" } ], "validation": { "commands": [ { "description": "correctly identified a real IPv4 address", "command": "cat /srv/network-lab/my-ip.txt", "expected_output": "^([0-9]{1,3}\\.){3}[0-9]{1,3}$", "match": "regex" }, { "description": "correctly identified port 80 as listening", "command": "cat /srv/network-lab/listening-port.txt", "expected_output": "80", "match": "exact" }, { "description": "correctly resolved lab-internal.test", "command": "cat /srv/network-lab/resolved-ip.txt", "expected_output": "10.99.99.42", "match": "exact" } ] }, "default_namespace": "default", "teardown_commands": [ { "command": "rm -rf /srv/network-lab" } ] }