skillfed

netifaces2

Portable network interface information

netifaces2 v0.0.22 235.6K downloads/30d#8,997 on PyPI2
Permissive license Abandoned released

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 netifaces2

uv

uv add netifaces2

poetry

poetry add netifaces2

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: RustTopic :: System :: Networking

Tags

network interface addressesget local ip addressesnetwork gateway informationcross-platform network infointerface enumerationnetwork configuration querysystem network details
network-interfacessystem-infocross-platform

More Networking packages