Linux for network engineers lab 4 of 14

Network namespaces and veth pairs

One Linux box becomes a small network: namespaces as hosts and a router, veth pairs as cables, a bridge as a switch and a real interface as the uplink. It's how containers get their networking.

Run this lab

It needs Lite: its 2 nodes are set to 2 vCPU and 1,024 MB in total. That fits the free demo too.

In your workspace: Shared, then Linux for network engineers guided labs, then 04 - Network namespaces and veth pairs

Try it free for 30 minutesRun it on Lite from £3 a day

The free demo needs no card and no email. Every lab plan includes every guided lab.

Level
Intermediate
Time
About 50 minutes
Nodes need
2 vCPU, 1,024 MB
Smallest plan
Lite

The scenario

The Sheffield team wants a test network for the tracker application before it goes live, but the depot has one spare Linux box, LNX1, and one port on router R1. Network namespaces let you build the whole thing inside LNX1: three hosts, a switch, a router and a real uplink. Anyone who runs containers uses these same parts every day.

DeviceInterfaceAddressRole
redeth010.4.1.10/24namespace, LAN 1
greeneth010.4.1.20/24namespace, LAN 1
blueeth010.4.2.10/24namespace, LAN 2
rtrlan1, lan210.4.1.1/24, 10.4.2.1/24router namespace
rtreth0 (the real port)10.4.0.2/30uplink to R1
R1Gi0/0, Loopback110.4.0.1/30, 10.4.99.1/24depot router
DeviceRunsHow to log in
R1Cisco IOSv 15.9The console opens at >; enable has no password.
LNX1Alpine Linux 3.16 with iptables and iproute2Opens on a menu: press 5, then Enter, for a root shell.

What you’ll practise

  • Create namespaces and run commands inside them
  • Connect namespaces with veth pairs and a bridge
  • Build a router namespace with its own forwarding setting
  • Move a physical interface into a namespace
  • Find sockets and processes that belong to a namespace

The tasks

  1. Start the Linux nodes
  2. Make a namespace
  3. Join two namespaces with a cable
  4. Add a router namespace
  5. Run a service in a namespace

The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.

Topology and devices

The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.

Topology of Network namespaces and veth pairs2 nodes, 1 link. Every link is listed as text below the diagram.R1LNX1eth0Gi0/0
2 nodes, with the interface names each link uses.
Nodes in Network namespaces and veth pairs, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
R1Cisco IOSvvios-adventerprisek9-m.spa.159-3.m91 vCPU, 512 MB
LNX1Alpine WAN emulatorclbalpinewanem-alpine-3-16-2-wanem1 vCPU, 512 MB

How to open this lab

  1. Sign in to your workspace at lab.cloudlabbox.com.

  2. In File Manager, open Shared, then the folder Linux for network engineers guided labs.

  3. Open 04 - Network namespaces and veth pairs and start its nodes, then open Lab Tasks for the scenario and the steps.

The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.

More Linux for network engineers labs

All Linux for network engineers labs

CloudLabBox is independent of Cisco, CompTIA, the Linux Foundation and the Linux Professional Institute. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.