Linux command
ip-tuntap 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Example
ip tuntap
Example
sudo ip tuntap add dev [tun0] mode tun
Example
sudo ip tuntap add dev [tap0] mode tap
Delete
sudo ip tuntap delete dev [tun0] mode tun
Example
sudo ip tuntap add dev [tun0] mode tun user [username]
Example
sudo ip tuntap add dev [tun0] mode tun user [username] group [groupname]
说明
ip tuntap creates and manages TUN/TAP virtual network interfaces. TUN devices operate at layer 3 (IP packets) while TAP devices operate at layer 2 (Ethernet frames). These virtual interfaces are commonly used by VPN software, virtualization (QEMU/KVM), and network testing tools. Setting user/group ownership allows non-root processes to use the device.
参数
- add dev _NAME_ mode _MODE_
- Create a TUN or TAP device.
- delete dev _NAME_ mode _MODE_
- Remove a TUN or TAP device.
- show | list
- List existing TUN/TAP devices.
- mode _tun|tap_
- Device mode: tun (layer 3, IP packets) or tap (layer 2, Ethernet frames).
- user _USERNAME_
- Set device owner by username or UID.
- group _GROUPNAME_
- Set device group by name or GID.
- one_queue
- Use the old single-queue TUN/TAP driver.
- pi
- Enable packet information (prepend a 4-byte header to each packet).
- vnet_hdr
- Include a virtio-net header (used with vhost-net).
- multi_queue
- Create a multi-queue TUN/TAP device.
FAQ
What is the ip-tuntap command used for?
ip tuntap creates and manages TUN/TAP virtual network interfaces. TUN devices operate at layer 3 (IP packets) while TAP devices operate at layer 2 (Ethernet frames). These virtual interfaces are commonly used by VPN software, virtualization (QEMU/KVM), and network testing tools. Setting user/group ownership allows non-root processes to use the device.
How do I run a basic ip-tuntap example?
Run `ip tuntap` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does add dev _NAME_ mode _MODE_ do in ip-tuntap?
Create a TUN or TAP device.