Courseiva
Advanced Networking ConfigurationhardMultiple ChoiceObjective-mapped

LPIC-2 Advanced Networking Configuration Practice Question

An administrator is troubleshooting network isolation in a Linux container environment. The container should have its own network stack, but it appears to be using the host's interfaces. Which command correctly runs a command inside a network namespace named 'ns1' to verify its network configuration?

⚠ Common exam trap

It's easy for candidates to confuse `nsenter` with `ip netns exec`; while both can enter a network namespace, `nsenter` requires a process PID and does not directly support named namespaces, whereas `ip netns exec` is the correct tool for named network namespaces like 'ns1'.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

ip netns exec ns1 ip addr show

The `ip netns exec` command is specifically designed to execute a command within a given network namespace. In this scenario, `ip netns exec ns1 ip addr show` runs the `ip addr show` command inside the network namespace named 'ns1', allowing the administrator to verify that the container has its own network stack and is not using the host's interfaces.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • nsenter -t 1234 -n ip addr show

    Why it's wrong here

    Requires process PID; not for named namespace.

  • ip netns exec ns1 ip addr show

    Why this is correct

    Executes command in named network namespace.

  • unshare -n ip addr show

    Why it's wrong here

    Creates new namespace, does not use existing one.

  • ip netns add ns1

    Why it's wrong here

    Only adds namespace, does not execute command.

About these practice questions

This LPIC-2 question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.