Tun/Tap interface tutorial

How tun/tap works in Linux, with sample code