How to know if a network interface is tap, tun, bridge or physical?

As much as I recognize, there are 4 major sorts of network user interfaces in Linux: tun, tap, bridge and also physical.

When I'm doing sys admin on equipments running KVM, I generally find tap, bridge and also physical user interfaces on the very same equipment, without having the ability to inform them apart. I can not see any kind of substantial distinctions in ifconfig outcomes, as in ip outcomes.

Just how can I recognize if a user interface is a tun, tap, bridge, or physical?

note: I do not assert that there are nothing else sorts of network user interfaces in Linux, yet I recognize just these 4.

2022-06-07 14:31:53
Source Share
Answers: 2

Regarding TUN and TAP devices: it is not enough to make the check above.

The reason is that there may be cases when we create a TUN device and (by error) call it tap10; or create a TAP device and name it tun10. So, how can I know if it is a tun device or a tap device, since both of course will have "tun_flags" entries?

The answer is to run ethtool -i tunOrTapDeviceName.

  • In case of a TAP device we will get: "bus-info: tap".
  • In case of a TUN device we will get: "bus-info: tun".


$ ethtool -i tapfffb93e9-6a
driver: tun
version: 1.6
bus-info: tap
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
2022-07-05 23:05:01

I do not assume there is a very easy means to identify them. Jabbing about in /sys/class/net I located the adhering to differences:

  • Physical tools have a /sys/class/net/eth0/device symlink
  • Bridges have a /sys/class/net/br0/bridge directory site
  • TUN and also TAP tools have a /sys/class/net/tap0/tun_flags documents
  • Bridges and also loopback user interfaces have 00:00:00:00:00:00 in /sys/class/net/lo/address
2022-06-07 14:55:00