getip
Query the device's IP / subnet / gateway
go-udap getip MAC [--timeout DURATION] [--format text|json|csv | --json]What it does
Sends UCP_METHOD_GET_IP (0x0002) to the device and prints the
device's current IP, subnet mask, and gateway as three labelled lines.
Distinct from discovery: discovery passively observes (the source IP
of the device's discovery reply); getip actively asks the device
for its own view of its network state. Useful after a set to verify
the new config took effect.
Output
IP: 192.168.1.50
Subnet: 255.255.255.0
Gateway: 192.168.1.1If the device doesn't have a network config yet (factory state),
each line shows -.
With --json (or -o json), one object. A value shown as - in text
is null:
{"ip":"192.168.1.50","subnet_mask":"255.255.255.0","gateway":null}With -o csv, a header row and one row. A null value is an empty
cell:
ip,subnet_mask,gateway
192.168.1.50,255.255.255.0,The JSON keys and CSV columns are a stable contract: none will be removed or renamed without a major version. New ones may be added. See Output formats.
Flags
| Flag | Default | Description |
|---|---|---|
--timeout DURATION | 2s | Operation timeout |
--format FORMAT, -o | text | Output format: text, json or csv |
--json | off | Shorthand for --format json |
Exit codes
0— success1— device not found, or transport error2— invalid MAC, or an unknown or invalid flag (including a format name other thantext,jsonorcsv, or--jsonwith--format)