Compare OpenVPN Tap vs Tun Mode. Which is better than the other?

2.8K    Asked by AashnaSaito in SQL Server , Asked on Nov 29, 2021

I would appreciate if someone told me the practical difference between TAP vs TUN mode when use with OpenVPN. When to use TAP and When to use TUN ? What types of traffic will pass with both mode TAP vs TUN ?

Answered by Angela Baker

TAP is basically at Ethernet level (layer 2) and acts like a switch whereas TUN works at the network level (layer 3) and routes packets on the VPN. TAP is bridging whereas TUN is routing. From the OpenVPN Wiki:

TAP benefits:

  • behaves like a real network adapter (except it is a virtual network adapter)
  • can transport any network protocols (IPv4, IPv6, Netalk, IPX, etc, etc)
  • Works in layer 2, meaning Ethernet frames are passed over the VPN tunnel
  • Can be used in bridges

TAP drawbacks:

  • causes much more broadcast overhead on the VPN tunnel
  • adds the overhead of Ethernet headers on all packets transported over the VPN tunnel
  • scales poorly

TUN benefits:

  • A lower traffic overhead, transports only traffic which is destined for the VPN client
  • Transports only layer 3 IP packets
  • TUN drawbacks:
  • Broadcast traffic is not normally transported
  • Can only transport IPv4 (OpenVPN 2.3 adds IPv6)
  • Cannot be used in bridges

OpenVPN TAP vs TUN OpenVPN Tap

OpenVPN tap is the protocol that you should enable if you are looking to bridge two computers only using the ethernet cable for the connectivity between them. With this being the bottom line of using tap, on the OpenVPN setup, you should also have a better idea of the technicalities that are involved so that you can make it useful to its best abilities and also analyze the risks and contingencies that you will be facing as well.

OpenVPN Tun

Tun is another protocol that you can choose on the OpenVPN while bridging two devices through ethernet to create a virtual host server to divert the information. It is somehow similar to the tap as it does the same task, but with a bit more sophistication and neatness. That means you don’t have to deal with all the subnet IP masking and things like that because OpenVPN will take care of all that for you on its own and help you optimize the perfect settings that might be needed for the OpenVPN to run.





Your Answer

Interviews

Parent Categories