1
General Discussion / Re: Determine LAN/WAN Interfaces from CLI in Machine-Parseable Format
« on: June 26, 2024, 01:41:47 pm »
That's a pretty awesome insight and one I will definitely make use of in the future, thanks! Unfortunately, I do not see a way the interfaces can be differentiated by LAN/WAN/OPT designation. My output:
Code: [Select]
# netstat -ni --libxo json | json_pp
{
"statistics" : {
"interface" : [
{
"address" : "enc0",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x0",
"mtu" : 1536,
"name" : "enc0",
"network" : "<Link#1>",
"received-errors" : 0,
"received-packets" : 0,
"send-errors" : 0,
"sent-packets" : 0
},
{
"address" : "lo0",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x8049",
"mtu" : 16384,
"name" : "lo0",
"network" : "<Link#2>",
"received-errors" : 0,
"received-packets" : 43106475,
"send-errors" : 0,
"sent-packets" : 43106475
},
{
"address" : "::1",
"flags" : "0x8049",
"name" : "lo0",
"network" : "::1/128",
"received-packets" : 0,
"sent-packets" : 0
},
{
"address" : "fe80::1%lo0",
"flags" : "0x8049",
"name" : "lo0",
"network" : "fe80::%lo0/64",
"received-packets" : 0,
"sent-packets" : 0
},
{
"address" : "127.0.0.1",
"flags" : "0x8049",
"name" : "lo0",
"network" : "127.0.0.0/8",
"received-packets" : 43106475,
"sent-packets" : 43106475
},
{
"address" : "pfsync0",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x0",
"mtu" : 1500,
"name" : "pfsync0",
"network" : "<Link#3>",
"received-errors" : 0,
"received-packets" : 0,
"send-errors" : 0,
"sent-packets" : 0
},
{
"address" : "pflog0",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x20100",
"mtu" : 33160,
"name" : "pflog0",
"network" : "<Link#4>",
"received-errors" : 0,
"received-packets" : 0,
"send-errors" : 0,
"sent-packets" : 0
},
{
"address" : "fa:8f:4e:40:ee:b5",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x8843",
"mtu" : 1500,
"name" : "xn0",
"network" : "<Link#5>",
"received-errors" : 0,
"received-packets" : 4480553623,
"send-errors" : 0,
"sent-packets" : 2771648753
},
{
"address" : "108.63.21.82",
"flags" : "0x8843",
"name" : "xn0",
"network" : "108.63.21.80/29",
"received-packets" : 1547762,
"sent-packets" : 20687781
},
{
"address" : "2e:3e:a9:7f:34:45",
"collisions" : 0,
"dropped-packets" : 0,
"flags" : "0x8943",
"mtu" : 1500,
"name" : "xn1",
"network" : "<Link#6>",
"received-errors" : 0,
"received-packets" : 3039114099,
"send-errors" : 0,
"sent-packets" : 4467667506
},
{
"address" : "aaa.bbb.ccc.1",
"flags" : "0x8943",
"name" : "xn1",
"network" : "aaa.bbb.ccc.0/24",
"received-packets" : 4905395,
"sent-packets" : 1711444
},
{
"address" : "aaa.bbb.ccc.211",
"flags" : "0x8943",
"name" : "xn1",
"network" : "aaa.bbb.ccc.0/24",
"received-packets" : 429339,
"sent-packets" : 612557
}
]
}
}