Taking control of the PNETLab console short version
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.
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
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"
Why the UI was dead (so it does not surprise you again)
- Offline mode. With
ctrl_online_mode=0the login is locked and POSTs return CSRF 419. Every tutorial that starts with "open Lab settings" assumes a login you do not have. - Not a per-lab background. The canvas background is a theme asset —
/opt/unetlab/html/themes/default/images/background/dark_2D.png. Replace it and every lab changes. - Two rendering paths. Grid on → the PNG is used. Grid off → a flat colour, the PNG is never read. Check
nogridbefore blaming your file. - Caching lies. Apache and the browser both cache hard. Verify with
curl+ MD5, then hard-refresh (Ctrl+Shift+R).
The checklist worth reusing
- Prove you are on the right host — version command, not just an IP that looked familiar.
- Find the account that actually owns the app directory. It is often not the "normal" user.
- Stop workloads cleanly with the vendor's own wrapper before changing anything.
- Read the config file directly — it usually contains the same state the UI shows, plus flags the UI hides.
- Do the work with the CLI wrapper, then verify with
psand the file system, not the web page. - When a change has no effect, stop re-verifying the change and go find the code path that reads it.
root. Do that first, every time.