Lab notes · networking · 2026-10-24

Taking control of the PNETLab console short version

PNETLab 4.2.10 · 192.168.1.192 · taken from the terminal, no GUI needed

The whole thing in five steps. The goal was simple: get a working console on a lab we could not log into, then fix the lab from there. The interface was locked and half the usual advice did not apply. Below is only what mattered.

What "taking control" actually meant

The PNETLab web UI was locked (offline mode → login refused, uploads fail). No Lab Settings, no drag-and-drop, no "reset lab" button. But the box itself was reachable over SSH, and everything the UI does is just files and processes underneath.

The one idea behind all of it: the GUI is only a front-end. Once you have root on the box, you control the lab — regardless of whether the web page works.

The five steps

1. Take the lab down cleanly — cleaner

Before touching anything, stop every running node with PNETLab's own helper. This is how a lab is released without leaving half-dead iol processes holding bridge interfaces:

/opt/unetlab/wrappers/unl_wrapper -a stop -T 0

Confirm nothing is left behind:

ps aux | grep -c '[i]ol'          # should be 0
ls /opt/unetlab/tmp/              # per-pod working dirs, now empty

2. Log in as root, not me

Every other machine in this lab network uses a normal user with sudo. PNETLab is an appliance image — the usual account does not exist, and only root owns /opt/unetlab.

ssh [email protected]
unetlab version          # 4.2.10 — confirms we are on the right box
node -v && npm -v        # the console front-end is Node/React, useful if it misbehaves
Wrong-box trap. The first VM we tried was not the PNETLab install at all — different address, too little disk. unetlab version is the fast way to prove you are on the real appliance before changing one file.

3. Read the lab's real state from the file system

The .unl file is plain XML. It tells you which nodes exist, which images they boot, their interfaces, and their canvas coordinates. Reading it beats guessing from the broken UI:

ls -l /opt/unetlab/labs/*.unl
grep -o 'name="[^"]*"' /opt/unetlab/labs/EBGP.unl | sort -u
grep -o 'image="[^"]*"' /opt/unetlab/labs/EBGP.unl | sort -u
grep -o 'nogrid="[01]"' /opt/unetlab/labs/EBGP.unl

That last line matters more than it looks — the nogrid flag chooses which drawing path the canvas uses, and it explains a class of "my change does nothing" problems. One line of grep saved an afternoon of theories.

4. Start the lab from the command line

Same wrapper, opposite verb. This is the actual "taking control" moment: nodes boot, consoles exist, without one HTTP request:

/opt/unetlab/wrappers/unl_wrapper -a start -T 0 -F /opt/unetlab/labs/EBGP.unl

Then check what came up:

ps aux | grep '[i]ol'
ls /opt/unetlab/tmp/0/<lab-id>/    # per-node dirs appear

5. Attach to the router consoles

Every running node gets a Linux pseudo-terminal. That is the console. No telnet client, no Java applet, no browser:

# one console
telnet 127.0.0.1 <port>

# or simply attach to the node's log
cat /opt/unetlab/tmp/0/<lab-id>/<node-id>/docker.log

# or go straight into the network namespace of the node
ip netns list
ip netns exec <ns> vtysh -c "show bgp summary"
Result: full console access on every router, shell-level access to the box, and the ability to start/stop the lab at will — with the web UI never once loading.

Why the UI was dead (so it does not surprise you again)

The checklist worth reusing

Taking over any appliance that locks you out
  1. Prove you are on the right host — version command, not just an IP that looked familiar.
  2. Find the account that actually owns the app directory. It is often not the "normal" user.
  3. Stop workloads cleanly with the vendor's own wrapper before changing anything.
  4. Read the config file directly — it usually contains the same state the UI shows, plus flags the UI hides.
  5. Do the work with the CLI wrapper, then verify with ps and the file system, not the web page.
  6. When a change has no effect, stop re-verifying the change and go find the code path that reads it.
The honest lesson: we spent most of the time on the background image, which was a side quest. The important part — console control — took one command to stop, one to start, and SSH as root. Do that first, every time.