montag451 / pytun

Linux TUN/TAP wrapper for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytun.Error: [Errno 2] No such file or directory

diakbar opened this issue · comments

I tried this on Ubuntu for Windows, but I got following weird error:

>>> from pytun import TunTapDevice, IFF_TAP
>>>
>>> tap = TunTapDevice(flags=IFF_TAP)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pytun.Error: [Errno 2] No such file or directory
>>> tun = TunTapDevice()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pytun.Error: [Errno 2] No such file or directory
>>> TunTapDevice

Am I missed something?

Hi,

The tun module is maybe not loaded. Can you post the result of the command:

lsmod | grep tun

here's the output:
libkmod: ERROR ../libkmod/libkmod-module.c:1655 kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory Error: could not get list of modules: No such file or directory

i think I know now that ubuntu for windows 10 not include lsmod with limited hardware access.
based on this article
https://www.webreflection.co.uk/blog/2016/04/13/bash-on-ubuntu-on-windows

I'm windows user for my main work, just curious if pytun available for python Windows and how do I install it?

Unfortunately pytun doesn't work neither on Windows nor on WSL (Windows Subsystem for Linux) because it uses specific functionalities provided by the Linux kernel (by the tun module to be more precise). I'm not a Windows user myself so I can't really provide you with assistance on this topic but I know that a Windows driver exists which provides the same kind of functionalities than the Linux equivalent (you can find an example here)

I'm closing this issue because it's not related to pytun