with logical I mean everything legal in the command
ip link
as in, for instance:
ip link add link dum0 name dum0.200 type vlan protocol 802.1Q id 200
where the logical type would be "vlan". All valid types are, to quote the man page:
vlan | veth | vcan | dummy | ifb | macvlan | macvtap | can | bridge | ipoib | ip6tnl | ipip | sit | vxlan |gre | gretap | ip6gre | ip6gretap | vti
Note that this clearly is not the physical device type (like ethernet, wifi, ppp etc.) as asked in this question, which does contain a gem of a reference to the physical type which led me to test for it :
find /sys/class/net ! -type d | xargs --max-args=1 realpath |
while read d; do
b=$(basename $d) ; n=$(find $d -name type) ; echo -n $b' ' ; cat $n;
done
dum0.200 1
dum0.201 1
dum1.300 1
dum1.301 1
dummy0 1
ens36 1
ens33 1
lo 772
dum0 1
dum1 1
wlan0 1
But which apparently finds both dummy, vlan and wlan devices to be of type ARPHRD_ETHER.
Does somebody know more? Thanks in advance.
====
Revising this in 2023.
It's from a system with two real ethernet interfaces, one wifi, docker installed but inactive, libvirt with two networks and two virtual machines and a wirguard connection. The jq is from stedolan.github.io/jq, commonly installed with a decent package manager.
$ ip -details -j l | jq -r '.[]|"\(.ifname), \(.link_type), \(.linkinfo.info_data.type), \(.linkinfo.info_kind), \(.linkinfo.info_slave_kind)"' | column -t -s ','
lo loopback null null null
enp43s0 ether null null null
enx00e04c680049 ether null null null
wlp0s20f3 ether null null null
virbr2 ether null bridge null
virbr1 ether null bridge null
docker0 ether null bridge null
vnet0 ether tap tun bridge
vnet1 ether tap tun bridge
vnet2 ether tap tun bridge
vnet3 ether tap tun bridge
wg0 none null wireguard null
$
/sys/class/net/$devname/uevent
contains the entryDEVTYPE=vlan
, but that is not a complete answer, since for example loopback (lo
), point-to-point, and wired ethernet-devices (eth0
) do not contain that. However, my wireless device hasDEVTYPE=wlan
.