.\" SPDX-FileCopyrightText: 2019 Alyssa Ross .\" SPDX-License-Identifier: GPL-2.0-or-later .Dd December 15, 2019 .Dt MKTUNTAP 8 .Os Linux .Sh NAME .Nm mktuntap .Nd create and open a TUN or TAP device on a file descriptor, then exec .Sh SYNOPSIS .Nm .Fl ( n | p ) .Op Fl v .Op Fl B .Op Fl P .Op Fl E .Op Fl i Ar ifr_name .Ar fd .Ar prog... .Sh DESCRIPTION Create a TUN or TAP device named with format .Ar ifr_name , open it on file descriptor .Ar fd , set the .Ev TUNTAP_NAME variable in the environment to the name of the opened device, and then exec into .Ar prog . .Pp By default, the .Dv IF_NO_PI flag is set on the device. .Pp The arguments are as follows: .Bl -tag -width Ds .It Fl p Create a TAP device. Mutually exclusive with .Fl n . .It Fl n Create a TUN device. Mutually exclusive with .Fl p . .It Fl v Set the .Dv IFF_VNET_HDR flag on the device. .It Fl B Open the device in nonblocking mode. See discussion of .Dv O_NONBLOCK in .Xr open 2 . .It Fl P Don't set the .Dv IFF_NO_PI flag on the device. .It Fl E Don't set the .Ev TUNTAP_NAME environment variable. Caution: if you use this without using .Fl i to set a static device name, it will be difficult to determine the device name later. .It Fl i Set the name for the device. If present, the character sequence .Dq %d will be replaced with a number to create a unique name. Default: .Dq tap%d or .Dq tun%d , as appropriate. .El .Sh EXIT STATUS .Ex -std See .Xr sysexits 3 for further details. .Sh SEE ALSO .Xr tunctl 8 , .Xr ip 8