agent.smith
agent.smith

Reputation: 9436

tun/tap interface understanding

I am currently exploring different networking interfaces and came across tun/tap. I got confused about one part which was creating sockets.

Can we create regular sockets with well know ports on the ip address assigned to tun/tap interface?

Is it possible to create sockets for both tun and tap interfaces?

I apologies if it is too basic to ask it here. (I could not find enough online doc on this subject.)

P.S. I think as it is a networking interface, it should be possible.

Upvotes: 2

Views: 7508

Answers (1)

Cong Wang
Cong Wang

Reputation: 2049

Why not? It is not different with any other network interfaces from the socket's point of view.

You just need to send the packets like what you do for other network interfaces. The packets you send via tun/tap interface will be read by the process (normally a hypervisor or some VPN daemon) from /dev/net/tun device automatically. These processes will further process the packets, for example, passing them to your guest.

So, unless you are programming hypervisor or some VPN daemon, you don't even notice the difference...

Upvotes: 2

Related Questions