Creating a Virtual Network Interface in Linux¶
A TUN/TAP interface is useful for testing network software, VPN-style data paths, and virtual Ethernet configurations.
Prepare the tools¶
Install tunctl:
Check that the kernel has TUN support:
Method 1: Create a TAP interface with tunctl¶

Method 2: Use ip tuntap¶
The ip command can also manage TUN/TAP interfaces:

Run ip tuntap help to see supported modes and options:
Usage: ip tuntap { add | del } [ dev PHYS_DEV ]
[ mode { tun | tap } ] [ user USER ] [ group GROUP ]
[ one_queue ] [ pi ] [ vnet_hdr ]
Installing tunctl from Source¶
Install from the distribution package when possible:
To build it from source:
git clone https://github.com/gooselinux/tunctl.git
cd tunctl
# For cross-compilation, set the desired compiler in the Makefile:
# export CC=<cross-compiler>
#
# For a static binary:
# make LDFLAGS="-static"
make
./tunctl --help
Example run: