TUNTAP DRIVER FOR MAC. TUN devices are usually point-to-point connections. TAP driver was designed as low level kernel support for Ethernet tunneling. Essentially what you are creating is a virtual equivalent of a patch cable. TAP devices are commonly used in virtualization systems to provide virtual network adaptors to multiple guest machines.
This repository is unmaintained: You should use the more comprehensive and well maintained. TUN/TAPNOTE: This package is new and should be considered unstable, in terms of both API and function.tuntap is a native wrapper for interfacing with TUN/TAP network devices in an idiomatic fashion.Currently supported are Linux and Mac OS X.
Go get github.com/jamescun/tuntapConfigurationThe configuration required to open a TUN/TAP device varies by platform. The differences are noted below. LinuxWhen creating a TUN/TAP device, Linux expects to be given a name for the new interface, and a new interface will be allocated for it by the kernel module. If left blank, one will be generated (tun tap)(0-9+). Tap, err:= tuntap.Tap('tap1') // created tap1 device if availabletun, err:= tuntap.Tun(') // created tun device at first available id (tun0)Mac OS XOn startup, the Mac OS X TUN/TAP kernel extension will allocate multiple TUN/TAP devices, up to the maximum number of each. When creating a TUN/TAP device, Mac OS X expects to be given a path to an unused device.
If left blank, this package will attempt to find the first unused one. Tap, err:= tuntap.Tap('/dev/tap1') // open tap1 device if unusedtun, err:= tuntap.Tun(') // open first available tun device (tun0)Additionally, unlike Linux, a TUN/TAP device is not 'ready' on OS X until it has an address assigned to it.
Any attempt to read from/write to the interface will fail with ErrBusy. It is safe to backoff and try again until a successful operation. ExamplesSee the directory.
In computer networking, TUN and TAP are virtual networkkernel interfaces. Being network devices supported entirely in software, they differ from ordinary network devices which are backed up by hardware network adapters.
The Universal TUN/TAP Driver originated in 2000 as a merger of the corresponding drivers in Solaris, Linux and BSD.[1] The driver continues to be maintained as part of the Linux[2] and FreeBSD[3][4] kernels.
Design[edit]
TUN and TAP in the network stack
Though for similar tunneling purposes, only one at a time can be used because TUN and TAP apply to different layers of the network stack. TUN, namely network TUNnel, simulates a network layer device and operates in layer 3 carrying IP packets. TAP, namely network tap, simulates a link layer device and operates in layer 2 carrying Ethernet frames. TUN is used with routing. TAP is used for creating a network bridge.[2]
Packets sent by an operating system via a TUN/TAP device are delivered to a user-space program which attaches itself to the device. A user-space program may also pass packets into a TUN/TAP device. In this case the TUN/TAP device delivers (or 'injects') these packets to the operating-system network stack thus emulating their reception from an external source.[2]
Applications[edit]
Platforms[edit]
Platforms with TUN/TAP drivers include:
See also[edit]References[edit]
External links[edit]
Retrieved from 'https://en.wikipedia.org/w/index.php?title=TUN/TAP&oldid=924733211'
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |