tun/tap in Windows

Goal

While tun comes standard with Linux, it's often considered hard to use under Windows. This tutorial will show that that it isn't.

tun is a handy little thing which allows you to write an application which emulates a physical interface. That is, when your kernel sends IP packets to this "virtual" interface, it's your application that receives them, not some piece of hardware. Similarly, your application can inject IP packets into the kernel as if they came from a regular (e.g. Ethernet) interface.

The kernel has no clue that it's not a physical interface, and so you can do everything you're used to: assign IP addresses, manage gateways and routing, and apply firewall rules.

It's a great tool for messing with (and learning about) the protocol stack shipped with your operating system, or to build a Virtual Private Network. Yet, in the world on low-power wireless devices, tun comes in handy when connecting your low-power mesh to the internet, as described in the Your 6LoWPAN mesh on the Internet tutorial.

This is a step-by-step hands-on tutorial, which will have you install, use and understand tun.