netifaces2
Portable network interface information
What it is and what it does
netifaces2 is a rewrite of the abandoned original netifaces library, providing a way to query network interface information (IP addresses, gateways, interface names) in Python across Linux, macOS, and Windows. It aims to be a drop-in replacement with the same API, but adds type annotations and support for current Python versions. The package wraps system calls via Rust bindings to retrieve network configuration data.
The library exposes functions like interfaces(), ifaddresses(), gateways(), and default_gateway() to enumerate network adapters and retrieve their addresses and routing information. However, the gateways API has known limitations: it requires /proc/net/route or the ip tool on Linux and is non-functional on Windows. The AF_ constants now reflect platform-native values rather than being abstracted, which may require code changes when migrating from the original netifaces.
Use it for:
- Enumerate all network interfaces and their IP addresses on a system for inventory or diagnostic tools.
- Retrieve the default gateway for network routing decisions in cross-platform applications.
- Query interface-specific address information (IPv4, IPv6, MAC) for network configuration scripts.
- Build system monitoring tools that need to detect network adapter changes or status.
- Develop network-aware applications that must discover local interface details at runtime.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Retrieves network interface information (addresses, gateways, interface names) across Linux, macOS, and Windows with type annotations and a modernized API.
No. The repository is archived and abandoned as of 2024-09-04 with no active maintenance. While the 0.0.22 release is stable and has no known vulnerabilities, the lack of ongoing support, known API gaps (non-functional Windows gateways, incomplete address families), and medium install friction make it unsuitable for new projects. Consider only if you are maintaining legacy code already using netifaces2 and need Python 3.6+ support.
Install
netifaces2 on PyPI
pip
pip install netifaces2uv
uv add netifaces2poetry
poetry add netifaces2Installing netifaces2
Before you install
Medium install friction due to compiled Rust components requiring a build step. Repository is archived and unmaintained as of 2024-09-04, with no active development; use only if the frozen 0.0.22 release meets your needs.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions; no copyleft obligations.
Quickstart
pip install netifaces2
import netifaces
print(netifaces.interfaces())
print(netifaces.ifaddresses('en0'))
print(netifaces.default_gateway())
Requires Rust toolchain (rustup) for local development builds; gateways API requires /proc/net/route or the ip tool on Linux and is non-functional on Windows.
Verify before relying
- Whether the frozen 0.0.22 release is compatible with Python versions beyond 3.6 despite the abi3 wheels suggesting broader support.
- Whether address families and PEER addresses mentioned as incomplete in the description have been addressed in 0.0.22.
- Real-world compatibility with PyPy given the Rust implementation.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | abandoned — 898 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 235,569/month — #8,997 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl; netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; netifaces2-0.0.22-cp37-abi3-macosx_10_12_x86_64.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl; netifaces2-0.0.22-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; netifaces2-0.0.22-cp37-abi3-musllinux_1_1_aarch64.whl; netifaces2-0.0.22-cp37-abi3-musllinux_1_1_armv7l.whl; netifaces2-0.0.22-cp37-abi3-musllinux_1_1_i686.whl; netifaces2-0.0.22-cp37-abi3-musllinux_1_1_x86_64.whl; netifaces2-0.0.22-cp37-abi3-win_amd64.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
netifacesProvides portable access to network interface…
permissive · top 5,000 on PyPI
netifaces-plusRetrieves network interface information…
permissive · top 15,000 on PyPI
getmacRetrieves MAC addresses of local network…
permissive · top 15,000 on PyPI
ifaddrEnumerate network interfaces and their IP…
permissive · top 5,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
IP2LocationLooks up geolocation data (country, region,…
permissive · top 15,000 on PyPI
ipaddrProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI
ifcfgIfcfg parses network interface configuration…
permissive · top 15,000 on PyPI
types-ipaddressProvides type stubs for Python's standard…
permissive · top 15,000 on PyPI
iptoolsProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI