How do I get the serial number and device id on a GL-X300 router after establishing an ssh connection to the router?
Try this:
If not the case, login by SSH and run (according to this official reply):
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '{"jsonrpc":"2.0","method":"call","params":["","system","get_info",{}],"id":1}'
Serial: uci get ddns.glddns.password
Device ID: uci get ddns.glddns.param_enc
Should work mostly.
If you just want to check them (so no need to getting them straight as some variable for example) you can read the factory partition instead:
FACTORY_PARTITION=$(blkid -t PARTLABEL="factory" -o device)
# Device ID
hexdump -n 8 -s 16 -C $FACTORY_PARTITION
# Serial
hexdump -n 16 -s 48 -C $FACTORY_PARTITION
1 Like