Questions tagged [tun]

TUN is a virtual network layer device which operates in OSI layer 3.

149 questions
33
votes
2 answers

Android firewall with VpnService

I'm trying to implement a simple firewall for android with VpnService for BS project. I choose VpnService because it will be working on non-rooted devices. It will log connections and let you filter connection. (Based on IP) There is an application…
fatihdurmus
  • 333
  • 1
  • 3
  • 5
28
votes
4 answers

How to interface with the Linux tun driver

I'm having a hard time figuring this problem out - I am trying to write a program that will interact with the Linux tunnel driver. At a very basic level, I simply want to create an application that is able to transfer data over a network tunnel. …
rmrobins
  • 435
  • 2
  • 5
  • 6
22
votes
3 answers

Ubuntu, remove network TAP interface

I'm creating a network interface via a program in order to build a bridge between a simulated network (NS-3) and the real Linux host. So when the "bridged" node receive a packet in NS-3, the real Linux host receive the packet. But when I run the…
user2561112
  • 221
  • 1
  • 2
  • 3
18
votes
2 answers

What is the "destination address" for a TAP/TUN device?

What is the purpose of the "destination address" for a TAP/TUN device? Pytun lets you easily set parameters of a tap/tun device: tun = TapTunDevice(name='mytun') tun.addr = '10.66.66.1' tun.dstaddr = '10.66.66.2' tun.netmask =…
Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
14
votes
2 answers

Tap interfaces and /dev/net/tun device, using ip tuntap command

I'm using ip tuntap to create a tap interface, like this: $ sudo ip tuntap add mode tap tap0 Afterwards, I set the interface up and address it with the common IP commands. I can see then my interface up and addressed with a simple ifconfig. Now, I…
C. Paul
  • 241
  • 1
  • 3
  • 7
11
votes
1 answer

How do I set an ip address for TUN interface on OSX (without destination address)?

How do I set an IP address for a TUN interface on OSX? I cannot figure out how to set up an ip address for my interface without specifying a destination IP. I don't want to do that- I'm want to more or less build a tunnel to an arbitrary address at…
nflacco
  • 4,972
  • 8
  • 45
  • 78
8
votes
1 answer

Raw socket vs TUN device

What is the difference between sending IP packets (from user-space) to a tun device and using a raw socket? For the purpose of tunneling IP packets through user-space. Why would I use one method over the other? raw socket: s = socket(AF_INET,…
weinrea
  • 108
  • 1
  • 5
8
votes
1 answer

Using TUN driver in windows

I have installed the TAP-WIN32 Adapter V9 on my Windows 7 machine. I want to use TUN to read the IP packets out of the interface. I followed the C# sample from http://www.varsanofiev.com/inside/using_tuntap_under_windows.htm I modified the code like…
Vijaya
  • 81
  • 1
  • 2
7
votes
2 answers

How to create tun interface inside Docker container image?

I'm trying to create a Docker image with a /dev/net/tun device so that the image can be used across Linux, Mac and Windows host machines. The device does not need access to the host's network interface. Note that passing --device…
moof2k
  • 1,678
  • 1
  • 17
  • 19
7
votes
1 answer

What is difference between /dev/ppp and /dev/net/tun?

What is difference between PPP and tun/tap? Both seem to be for implementing networking over user-space programs. With PPP, kernel creates ppp%d for use and let userspace program provide the backend for it. With tun/tap, kernel creates tun%d for use…
Vi.
  • 37,014
  • 18
  • 93
  • 148
7
votes
2 answers

Interfacing with TUN\TAP for MAC OSX (Lion) using Python

I found the following tun\tap example program and can not get it to work: http://www.secdev.org/projects/tuntap_udp/files/tunproxy.py I have modified the following lines: f = os.open("/dev/tun0", os.O_RDWR) ifs = ioctl(f, TUNSETIFF,…
user974896
  • 1,795
  • 4
  • 28
  • 48
6
votes
1 answer

Reading packets with Linux::TunTap

I've put together a perl script that reads packets into userspace via Linux::TunTap, and it all seems to work fine: #!/usr/bin/perl use warnings; use strict; use Linux::TunTap; $tun = new Linux::TunTap(NAME => 'localtun') or die "Couldn't connect…
Jarmund
  • 3,003
  • 4
  • 22
  • 45
6
votes
1 answer

Android VpnService. Why does all traffic go through the TUN device?

I created a TUN device using VpnService. Why does the TUN interface have the highest priority among other network interfaces of my device? Update #1 This is how I configured the TUN device: mInterface = new…
Maksim Dmitriev
  • 5,985
  • 12
  • 73
  • 138
6
votes
3 answers

How to open tap device on android using native code C?

I am trying build a VPN client mobile for Android based applications that connect to virtual infrastructure over VPN tunnel. I have a similar application for Linux/Windows and I know how to open a tun/tap device (open /dev/net/tun). How do we do the…
TJ13
  • 75
  • 3
  • 8
5
votes
0 answers

ioctl() Operation not permitted

I am developing an app in C for Android. I want to add a new tun interface and use the file descriptor to access the device. The way I am doing it is the same as described here:…
pavshr
  • 51
  • 5
1
2 3
9 10