I have difficulties to understand difference between tap and tun interface. I know it is an often asked question and I apologize for that. I asked the same questions on stackoverflow and someone told me to try this forum so I hope I'm in a good place. Moreover, I'm only curious about networks but I'm not a network student or professional so forgive me if my questions are too easy for you.
I read tap work at layer 2 and tun works at layer 3. I also read that tap is used for bridging and tun is used for routing. I already heard things like "ROUTERS work at layer 3" or "BRIDGES work at layer 2" : this make sense for me because routers manipulate layer 3 protocols and bridge manipulate layer 2 protocols? but, because tap and tun are "interfaces", it means the sentence like "INTERFACES work at layer 3" has a sense but I don't understand what it is : I mean interfaces doesn't manipulate protocols(the OS do that but not an interface) so it sounds like tun interface == tap interface:
If I create two tap interfaces(with tunctl) with two ip that are on different networks (192.168.2.1/24 and 192.168.3.1/24), then I link these to two kvm virtual machine (one tap interface match to one VM) and if I enable routing on the host, my two VM can communicate.
So tap interfaces can also be used for routing : what is the difference with tun ? maybe a tap is also a tun interface?
Also I can create a tap interface with tunctl command but how can I create a tun interface with the same command(the command is called TUNctl not TAPctl...)?
Moreover someone told me :
a TUN device is a virtual Ethernet adapter whereas a TAP device is a virtual point-to-point IP link (in case these don't make sense, ask your search engine what is the difference between point-to-point ip link and an Ethernet)
So I do research about point-to-point ip link and Ethernet link and i have others questions :
what is a "point-to-point ip link"? According to me, a point-to-point link is, when we have a network of several machine, the fact of communicate between two machines without the others machines know it. So I guess a "point-to-point ip link" is a specific case of one could call "layer 3 point-to-point link" meaning the point-to-point connection is ensure by the level 3 is that right?
if I have several PC connected to a switch by Ethernet , all links can be consider as "point-to-point ip link". the Wiki Ethernet page say a similar thing ("(...)which was designed for point-to-point links"). Same thing here : http://ethernetdirect.com/support_faqs.asp "Ethernet is a point to point network scheme" so what is the difference between "point-to-point ip link" and Ethernet link?
Can you help me to clarify that?