johnthagen / pytap2

Object oriented interface to Linux Tun/Tap devices for Python 3
https://pypi.org/project/pytap2/
MIT License
13 stars 4 forks source link

ifconfig error #8

Closed KiwiHC16 closed 2 years ago

KiwiHC16 commented 2 years ago

Hi All,

On a deban RPI3, I tested the first proposed code:

root@host:~# cat test.py 
from pytap2 import TapDevice

with TapDevice() as device:
    device.ifconfig(mtu=1300)
    device.write(b'0000')

And I got an error:

root@host:~# python3 test.py 
sh: 1: ifconfig: not found
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    with TapDevice() as device:
  File "/usr/local/lib/python3.7/dist-packages/pytap2/__init__.py", line 90, in __enter__
    self.up()
  File "/usr/local/lib/python3.7/dist-packages/pytap2/__init__.py", line 213, in up
    raise IfconfigError()
pytap2.IfconfigError

This error was discover in the context of meshtatsic project: https://github.com/meshtastic/Meshtastic-python/issues/104

Any thing I can do ?

Thanks

KiwiHC16

KiwiHC16 commented 2 years ago
pip install pytap2==2.0.0
pip install pytap2==1.6.0
pip install pytap2==1.5.0
pip install pytap2==1.4.0
pip install pytap2==1.3.0

Same issue on all releases ;-(

KiwiHC16 commented 2 years ago

Doesn't work on Debian 10, Ubuntu and Raspbian 10. Is it in relation to the fact that ifconfig doesn't exist in the OS and is replaced by ip addr ?

KiwiHC16 commented 2 years ago

https://linuxconfig.org/how-to-install-missing-ifconfig-command-on-debian-linux

KiwiHC16 commented 2 years ago

pytap2 needs to be adapted for Debian distribution.

johnthagen commented 2 years ago

Also see https://pypi.org/project/python-pytun/ which looks like it might be more actively maintained.

And yes ifconfig needs to be installed for this project to work.

Have you tried:

sudo apt install net-tools
KiwiHC16 commented 2 years ago

Yes

sudo apt install net-tool

Is a solution.

Thanks.

johnthagen commented 2 years ago

This system requirement has been documented in 684155b2a276aa243f300acd9cd346a3bafe7793