On a Linux box, I see there exists a lot of virtual NIC's. If I want to know what's the link type when created them using 'ip link add ... type ...', what do I do?

Thanks, woody


You can use multiple ways -

  1. brctl show - Bridge membership can be displayed

  2. ifconfig -a | grep HWaddr - match with MAC addresses

  3. ls -l /sys/class/net/ - virtual ones will show all in virtual and lan is on the PCI bus.


ip -details link show will add almost (but not) all imaginable properties of an interface, including, usually at start of 3rd line, its type, eg a bridge, a veth, etc. Real ethernet or wireless devices won't show their hardware nature with this command except by the absence of such additional property. Wireless can be detected by the existence of its phy name in /sys/class/net/<ifname>/phy80211/name.

Here's a dirty script (that shouldn't be considered reliable because it's parsing unreliable format!) to display most types (but eg pimreg appearing with a PIM multicast daemon would have its special property link/pimreg before which wouldn't be shown):

$ ip -details link show |awk '/^[0-9]+:/ { line=NR; printf "\n%s ",gensub("(@.*|:)$","",1,$2) } NR == line+2 { printf "%s",$1 } END { printf "\n" }'

dummy0 dummy
lxcbr0 bridge
virbr0 bridge
virbr0-nic tun
gre0 gre
gretap0 gretap
erspan0 erspan
ifb0 ifb
ifb1 ifb
vethIRMVCJ veth
vethQOHSJ9 veth
testbr0 bridge
wg0 wireguard
macvlan0 macvlan

There may be some other way. I use the reverse question:

ip link show type bridge

where you can substitute bridge with other type of NIC.

  • 1
    Thanks, this is useful! But it seems it's no help if the device is a tuntap, right?
    – Woody Wu
    Aug 28 '18 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.