TUN is a virtual network layer device which operates in OSI layer 3.
Questions tagged [tun]
149 questions
3
votes
4 answers
TAP/TUN adapter in LXC container
I am trying to create an lxc container that acts as a vpn server. I am trying to add the tap/tun adapter to the container's device list. I have tried adding the following line to the lxc config.
lxc.cgroup.devices.allow = c 10:200 rwm
That did not…

ashwinjv
- 2,787
- 1
- 23
- 32
3
votes
1 answer
C compiler errors on TUN/TAP
I like to create a TUN/TAP interface out of a C++ program. I found a straight foward tutorial on the net at
http://backreference.org/2010/03/26/tuntap-interface-tutorial/.
The problem is, that I seem to have linking problems with with if.h and…

Marste
- 627
- 7
- 22
3
votes
2 answers
ioctl fails when trying to get more than 8 queue file descriptor from a tun interface
After I heared that after kernel 3.8 linux added multi queue ability to tun tap device with flag IFF_MULTI_QUEUE, I upgraded my kernel to 3.10 and have its header in /usr/src
then I altered my c code to have a thread to open a new queue file…

madz
- 1,803
- 18
- 45
3
votes
0 answers
How can I get a IP of the local interface that directly connects to a default GW
-Environment-
VPN connection(OpenVPN)
-Default gateway is changed into VPN server IP
-Virtual interface(tunXX) for VPN connection directly connects to a default gateway
Interfaces & default gateway
interfaces :
lo inet addr:127.0.0.1
…

jazzsir
- 609
- 2
- 7
- 14
3
votes
1 answer
tun program not creating device node
I'm following http://backreference.org/2010/03/26/tuntap-interface-tutorial/
The following code successfully gets a fd (usually 3) when I run it as root, but it does not create a /dev/tun77 device.
Should it?
#include
#include…

fadedbee
- 42,671
- 44
- 178
- 308
3
votes
1 answer
Is there a userspace TCP stack which operates as a TUN interface?
Is there a userspace TCP stack which operates as a TUN interface and with an API similar to POSIX on the application side?

fadedbee
- 42,671
- 44
- 178
- 308
2
votes
0 answers
Create a socks proxy with SSH, but use a specific interface for outbound traffic
I have a linux server who have an interface "tun0" which is a VPN connection and I want to start a proxy on it for listing eth0 but use tun0 to get internet.
(default route on the server stay on eth0)
eth0 : ip 91.xxx.xx.xx ( public ip )
tun0 :…

Anthony
- 21
- 1
2
votes
1 answer
Getting TCP Retransmission instead of ACK on TUN device
I'm trying to implement a TCP stack over TUN device according to RFC 793 in Linux. By default, my program is in the LISTEN state and is waiting for an SYN packet to establish a connection. I use nc to send an SYN:
$ nc 192.168.20.99 20
My program…

Iman
- 348
- 2
- 11
2
votes
1 answer
Masquerading docker interface and host interface
I am running a docker on a host and I would like to connect a specific interface inside the docker (TUN interface) to one the host's external interfaces.
When running ifconfig inside the docker, I see 3 interfaces: eth0, lo and my_tun (tun…

TJR
- 454
- 8
- 24
2
votes
0 answers
`ioctl` returns -1 when trying to TUNSETIFF a TUN device
I've been following the official documentation on creating a TUN device. There's very little documentation, but what even is there does not seem to work. Here's what I have so far:
#include
#include
#include…

Carson Graham
- 519
- 4
- 15
2
votes
0 answers
cannot assign IP to tun / tap interface because the error : System has not been booted with systemd as init system (PID 1). Can't operate
Hello I've created a tun tap interface inside WSL2,with the following commands :
chown root.users /dev/net/tun
chmod g+rw /dev/net/tun
tunctl -t tap0 -u username
ifconfig tap0 up
at this point I tried to assign an IP address to it,but this is what…

john_connor
- 165
- 2
- 2
- 15
2
votes
0 answers
Unable to receive UDP packets on multiple TUN device
I am trying to create multiple TUN devices to tunnel the multi-device traffic through a common physical interface.
This is the schema I have:
Socket 1 is sending traffic through tun1 with destiny IP 1.1.1.2 and Socket 2 is doing the same on the…

j0lama
- 79
- 6
2
votes
0 answers
How do you identify iptables-marked packets in the user-space implementation of a tun device?
I have some custom VPN code, written in C, which uses a Linux tun device.
Is it possible for this user-space code to see iptables marks that were attached to packets? Or do those marks not propagate as far as a tun interface?

fadedbee
- 42,671
- 44
- 178
- 308
2
votes
0 answers
Are other layer 2 protocols than Ethernet possible over a TAP device?
When using a TAP-device, does someone know, if it is possible to use other layer 2 protocols than Ethernet, e.g. PPP oder FDDI?
All examples, I could find only use Ethernet, but the kernel documentation…

OC Jan
- 21
- 1
2
votes
1 answer
Exposing Tap interface from docker container to docker host
my application creates a tap interface inside a docker container.
e.g. tap_1: ip: 192.168.2.1
My requirement is that any packet coming on docker host can be directly sent to tap interface which is present inside the docker container. I am basically…

AnkitG
- 95
- 1
- 9