Signal9Signal9 — home
online
back to labs

Network Namespaces: Two Hosts in One Box

MediumNetworking20-30 min
The brief

The team wants to test a client and a server against each other on this one box: no second VM, and the service must not be reachable from, or even visible to, the host. That is exactly what a network namespace gives you: its own interfaces, addresses, routes, firewall and port space, sharing the kernel.

/root/case/assignment.env names the client namespace, the server namespace, the /24 to use and the service's TCP port (all differ per session; /root/case/brief.txt has the details). Build it:

1. Two named namespaces, so ip netns list shows them.

2. A veth pair with one end in each namespace, both ends up, each with its own address in the /24.

3. The client namespace can ping the server's address across that link.

4. A TCP listener on the service port inside the server namespace, and not on the host. Leave it running.

Grading reads the live namespaces, links, addresses and sockets, so any construction passes: ip netns add or unshare, creating the veth ends in place or moving them with ip link set … netns, any two addresses.

What you'll do
  • Create two named network namespaces
  • Join them with a veth pair, addressed and up on both ends
  • Prove the client namespace reaches the server across the link
  • Run a service inside a namespace where the host can't see it

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.