My Pockethernet V2 tool is still great and in weekly use. See my Review Article. But I wanted to be able to drive it from my laptop, not only my phone.
Don’t get me wrong, the phone app is perfectly fine (beside that rotate sizing issue) and the idea of running the tests from a CLI is more a possibility than a necessity. The advantage is that you can easily copy and paste the results to store them or automate tests.
Example
Before getting more into the actual script, take this example. The example contains output of the quick run. The quick run does a row of basic tests to give you an idea of the connection.
Link test
─────────
✓ Link Up, 1000 Mbit, Full duplex
Speed 1000 Mbit/s
Duplex Full duplex
Partner capabilities
10M Half & Full Duplex
100M Half & Full Duplex
1000M Half & Full Duplex
multig Not advertised
Polarity 1-2 Normal, 3-6 Normal, 4-5 Normal, 7-8 Normal
Skew 8, 0, 0, 0 ns
Length 30 m
→ Requesting an IPv4 address via DHCPv4...
DHCPv4
──────
✓ Lease acquired: 192.0.2.10
Address 192.0.2.10
Subnet mask 255.255.255.0
Gateway 192.0.2.1
DHCP server 192.0.2.2
DNS 192.0.2.53, 192.0.2.54
Lease 19 h 59 min
Server MAC AA:BB:CC:DD:EE:01
→ Starting CDP/LLDP discovery...
→ Waiting for a CDP/LLDP advertisement...
LLDP neighbor
─────────────
✓ LLDP: switch-1
Source MAC AA:BB:CC:DD:EE:02
Chassis ID AA:BB:CC:DD:EE:02
Port ID AA:BB:CC:DD:EE:02
TTL 120 s
System name switch-1
System description Example switch
Capabilities MAC Bridge, WLAN Access Point, Router, Station
Capabilities Enabled Station
Management IPv4 192.0.2.20
Management IPv6 2001:db8::1
Port description eth0
→ Running PoE test...
✗ PoE test timed out
Quick test summary
──────────────────
✓ Link Link Up, 1000 Mbit, Full duplex
✓ DHCPv4 192.0.2.10
✓ LLDP LLDP: switch-1
✗ PoE timed out
Available Tests
The most used tests are included in the CLI:
- discover: scan for Pockethernet devices
- connect: connect and print device information
- link: run a link test and print the result
- ip: get the IPv4 address via DHCPv4
- lldp: discover CDP/LLDP neighbor information
- poe: measure PoE voltage, class, and pair polarity
- quick: run link, DHCPv4 and LLDP tests in one pass
- tdr: measure pair length and faults with TDR
- wiremap: map the pairs and read the far-end ID dongle
Pockethernet V2 Protocol
I got the inspiration from another GitHub project which already discovered most of the protocol. The project I refer to is Pockethernet-Web. That’s a nice project with a similar aim, but it runs fully in the browser. Unfortunately on my Ubuntu environment I could not get it to run stable enough. So I came up with my own implementation in Python for the CLI.
You find the repo of my project on GitHub: pockethernet.py. This contains install and usage instructions.
Pockethernet CLI Linux
The script is tested on my Framework Laptop 13 using Python 3.14.4 on Ubuntu 26.04.
It contains a wrapper to call it easily from the CLI without first needing to enable the venv. I linked it to /usr/bin/pockethernet so if I want to use it I only need to ensure my Pockethernet V2 is turned on and then type the command pockethernet in my terminal.
Due to the V2 of Pockethernet using Bluetooth LE you do not need to pair or wait for repairing; it is an instant discovery and connect.
Comments
Nothing is loaded from external services until you click.
With a Fediverse or Mastodon account you can reply to this post. Replies from any compatible server are shown below once loaded.
Mastodon replies
Web mentions
Leave a comment
Reply to this post on Mastodon and your reply will show up here.