1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
Python ethtool module
=====================
*Python bindings for the ethtool kernel interface*
The Python ``ethtool`` module allows querying and partially controlling network
interfaces, driver, and hardware settings.
.. warning::
This is the new upstream for python-ethtool maintained by Fedora's
Python SIG. We ported it to Python 3 and only maintain it for the current
tools to keep working. **No new development is happening. This is a
deprecated package.** If you are considering to start using this, please
don't. We recommend `netifaces <https://pypi.org/project/netifaces/>`_ instead.
Installation
------------
The easiest way to install ``ethtool`` is to use your distribution packages
repositories. For example:
**Fedora**: ``sudo dnf install python3-ethtool`` or ``sudo dnf install python2-ethtool``
**Ubuntu**: ``sudo apt install python-ethtool``
In order to install ``ethtool`` from source or PyPI install its dependencies first:
**Fedora**: ``sudo dnf install libnl3-devel gcc redhat-rpm-config python3-devel``
**Ubuntu**: ``sudo apt install python3 python3-setuptools libpython3.6-dev libnl-route-3-dev``
And then install ``ethtool``:
**from PyPI**: ``pip3 install ethtool``
**from source**: ``python3 setup.py install``
Usage
-----
``ethtool`` may be used as a Python library::
>>> import ethtool
>>> ethtool.get_active_devices()
['lo', 'enp0s31f6', 'wlp4s0', 'virbr0', 'docker0', 'virbr1', 'eth0', 'tun0']
>>> ethtool.get_ipaddr('lo')
'127.0.0.1'
The ``ethtool`` package also provides the ``pethtool`` and ``pifconfig`` utilities. More example usage may be gathered from their sources,
`pethtool.py <https://github.com/fedora-python/python-ethtool/blob/master/scripts/pethtool>`_
and
`pifconfig.py <https://github.com/fedora-python/python-ethtool/blob/master/scripts/pethtool>`_.
``pethtool`` mimics behavior of the ``ethtool`` utility, but does not
support all options.
e.g., to get driver information on the ``eth0`` interface::
$ pethtool -i eth0
driver: cdc_ether
bus-info: usb-0000:00:14.0-4.1.3
Analogically, ``pifconfig`` mimics ``ifconfig`` in usage. It may be
used to view information on an interface::
$ pifconfig lo
lo
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope: host
UP LOOPBACK RUNNING
Further usage information may be found in the respective manpages for
`pethtool <https://github.com/fedora-python/python-ethtool/blob/master/man/pethtool.8.asciidoc>`_
and
`pifconfig <https://github.com/fedora-python/python-ethtool/blob/master/man/pifconfig.8.asciidoc>`_.
Tests
-----
Tests may be run by ``tox``.
Authors
-------
* Andy Grover
* Antoni S. Puimedon
* Arnaldo Carvalho de Melo
* Bohuslav Kabrda
* Braňo Náter
* Dave Malcolm
* David S. Miller
* David Sommerseth
* Harald Hoyer
* Charalampos Stratakis
* Jeff Garzik
* Lumir Balhar
* Miro Hrončok
* Miroslav Suchý
* Ruben Kerkhof
* Sanqui
* Yaakov Selkowitz
Current maintainers
-------------------
* Lumír Balhar <lbalhar@redhat.com>
* Miro Hrončok <mhroncok@redhat.com>
* Charalampos Stratakis <cstratak@redhat.com>
Contributing
------------
Feel free to help us with improving test coverage, porting to Python 3
or anything else.
Issues and PRs `on GitHub <https://github.com/fedora-python/python-ethtool>`_
are welcome.
License
-------
The Python ``ethtool`` project is free software distributed under the terms of
the GNU General Public License v2.0, see
`COPYING <https://github.com/fedora-python/python-ethtool/blob/master/COPYING>`_.
|