TUNCTL(8)

πŸ’… tunctl(8) β€” like, the manual page, bestie

okay so this is tunctl, and it lives in section 8 of the manual (that's the sysadmin-y one, iykyk). she's a little tool with one job and she does it impeccably. let's get into it 🫢


✨ NAME ✨

tunctl β€” create and manage persistent TUN/TAP interfaces 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

tunctl [ OPTIONS ] [ -u owner ] [ -t device-name ]

tunctl -d device-name

like, that's the whole vibe. either you're making an interface or you're deleting one, no in-between πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

tunctl lets the host sysadmin preconfigure a TUN/TAP network interface so it's ready for a particular user before that user even shows up. iconic behaviour, honestly.

the deal is: that user gets to open and use the network/write side of the interface β€” the "wire" side, the fun side β€” but they can not change any aspects of the host side of the interface. that part stays locked down. main character energy on the user's side, zero admin powers, periodt. πŸ”₯


πŸ’– OPTIONS πŸ’–

  • -b β€” brief output, bestie. prints just the interface name. no extra chatter, we love a minimalist.
  • -n β€” create a point-to-point TUN interface without an Ethernet header. this gets automatically enabled if the desired interface name starts with "tun" β€” she knows what you meant 🧚
  • -p β€” create a TAP type interface with an Ethernet header. automatically selected if the desired interface starts with "tap", or if you didn't give an interface name at all. slay, defaults πŸŽ€
  • -f tun-clone-device β€” specifies the tun clone device name. the default is /dev/net/tun, but some systems use /dev/misc/net/tun instead. not me checking your distro's vibe πŸ™ˆ
  • -d interfacename β€” delete the specified interfacename (i.e. set it to non-persistent). bye bestie πŸ‘‹
  • -u user β€” specifies the owner of the interface. this user is allowed to attach to the "network/wire" side.
  • -g group β€” specifies the group of the interface. this group is allowed to attach to the "network/wire" side of the interface.
  • -t interface β€” specifies the desired interface name. name her, don't be shy πŸ’œ

🌈 USAGE 🌈

⭐ making one

to create an interface for use by a particular user, invoke tunctl without the -d option:

# tunctl -u someuser

Set 'tap0' persistent and owned by 'someuser'

see how she told you exactly what she did? obsessed. πŸ’–

⭐ then configure it

then, configure the interface as normal β€” like, business as usual, no special tunctl magic here:

# ifconfig tap0 192.168.0.254 up

# route add -host 192.168.0.253 dev tap0

# bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'

# arp -Ds 192.168.0.253 eth0 pub
ngl that's a whole lot of commands but they're literally copy-pastable, so we're fine 🫢

⭐ deleting it

to delete the interface, use the -d option:

# tunctl -d tap0

Set 'tap0' nonpersistent

and that's it. she's gone, she's non-persistent, she's at peace ✨


πŸ” SEE ALSO πŸ”

the UserModeLinux-HOWTO β€” <URL:http://user-mode-linux.sourceforge.net/old/UserModeLinux-HOWTO.html> β€” go read it, iykyk πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

tunctl was originally written by Jeff Dike <jdike@karaya.com> as part of the User Mode Linux tools. the current version is maintained as a separate package by Henrik Nordstrom <henrik@henriknordstrom.net>. absolute legends, both of them πŸ’…

this manual page was originally written by Matt Zimmerman <mdz@debian.org> for the Debian GNU/Linux system, based on examples from Jeff Dike. extended by Henrik Nordstrom <henrik@henriknordstrom.net> to cover all options supported. the way they kept it complete… we stan a thorough queen πŸŽ€


⭐ and that's the whole page! this version is dated 26 February 2024 and it's from the TUNCTL(8) manual (section 8, sysadmin club πŸ‘‘). bye bestie, go make some interfaces πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from