tunctl
networkingLinux
The tunctl command is one of the most frequently used commands in Linux/Unix-like operating systems. tunctl Create and manage persistent TUN/TAP interfaces
Quick Reference
Command Name:
tunctl
Category:
networking
Platform:
Linux
Basic Usage:
tunctl [options] [arguments]
Common Use Cases
Syntax
tunctl [-t device-name] [-u owner] [-g group] [-b] [-f tun-clone-device] [-d device-name]
Options
| Option | Description |
|---|---|
-t device-name |
Name of the interface to create or delete |
-f tun-clone-device |
The tun clone device to open (default: /dev/net/tun) |
-b |
Brief output (don't display the device name on creation) |
-u owner |
Set owner of the device (username or numeric uid) |
-g group |
Set group of the device (group name or numeric gid) |
-n |
Create a TUN device (rather than a TAP device) |
-p |
Set persistent mode (device survives when tunctl exits) |
-d device-name |
Delete the specified device |
Examples
How to Use These Examples
The examples below show common ways to use the tunctl command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
Create a new TUN/TAP device
sudo tunctl
Create a TUN/TAP device with a specific name
sudo tunctl -t tap0
Create a device and assign it to a specific user
sudo tunctl -t tap0 -u username
Delete a TUN/TAP device
sudo tunctl -d tap0
Advanced Examples:
Create a device with a specific name and group ownership
sudo tunctl -t tap1 -g netgroup
Create a device in "bridge" mode (no IFF_NO_PI)
sudo tunctl -b -t tap2