netifaces
Portable network interface information.
What it is and what it does
netifaces is a Python library that abstracts away the platform-specific complexity of querying network interface information. Instead of writing different code for Linux, macOS, Windows, and other systems, you import netifaces and call simple functions to enumerate interfaces, retrieve their addresses (IPv4, IPv6, MAC), and discover gateway configuration. It returns results as dictionaries keyed by address family, allowing you to handle multiple addresses per interface and different address types uniformly.
The package solves the portability problem by wrapping low-level system APIs into a single consistent interface. You can list all interfaces, query addresses for a specific interface by family, retrieve hardware addresses, and access default or non-default gateways—all without worrying about whether you're running on POSIX or Windows.
Use it for:
- Enumerate all network interfaces and their IP addresses to discover local network configuration in a cross-platform tool.
- Retrieve MAC addresses for network interfaces to identify hardware or implement network-based licensing.
- Query default gateway information to route traffic or configure network policies programmatically.
- Build network monitoring or diagnostics utilities that need to work on Linux, macOS, and Windows without platform-specific code.
- Detect IPv6 addresses alongside IPv4 to support dual-stack network applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides portable access to network interface information (addresses, gateways, hardware details) across Linux, macOS, Windows, and other Unix-like systems from Python.
No—not recommended for new projects. The package is abandoned (last release 2021-05-31, repository archived, maintainer explicitly unable to continue). While it works and has no known vulnerabilities, there is no active maintenance, no response to issues or pull requests, and no guarantee of compatibility with future Python or OS versions.
Install
netifaces on PyPI
pip
pip install netifacesuv
uv add netifacespoetry
poetry add netifacesInstalling netifaces
Before you install
Medium install friction due to C extension compilation required on installation. Package is abandoned as of 2021-05-31 with no active maintenance; the original maintainer explicitly stated they can no longer maintain it. Repository is archived.
License in practice
MIT License (permissive) allows commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
import netifaces
# List all network interfaces
interfaces = netifaces.interfaces()
# Get addresses for a specific interface
addrs = netifaces.ifaddresses('lo0')
ipv4_addrs = addrs[netifaces.AF_INET]
# Get gateway information
gateways = netifaces.gateways()
default_gw = gateways['default'][netifaces.AF_INET]
Requires C compiler and platform development tools to build the extension during installation (tar/setup.py or pip will compile from source on most systems).
Verify before relying
- Whether the package works reliably on modern Python versions despite being abandoned since 2021
- Whether pre-built wheels for recent Python versions are available or if compilation is always required
- Known compatibility issues or regressions on current operating systems
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,901 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 2,666,675/month — #2,951 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: netifaces-0.11.0-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl; netifaces-0.11.0-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl; netifaces-0.11.0-cp27-cp27mu-manylinux_2_5_i686.manylinux1_i686.whl; netifaces-0.11.0-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl; netifaces-0.11.0-cp27-cp27m-win32.whl; netifaces-0.11.0-cp27-cp27m-win_amd64.whl; netifaces-0.11.0-cp34-cp34m-win32.whl; netifaces-0.11.0-cp35-cp35m-manylinux_2_5_i686.manylinux1_i686.whl; netifaces-0.11.0-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl; netifaces-0.11.0-cp35-cp35m-win32.whl; netifaces-0.11.0-cp36-cp36m-macosx_10_15_x86_64.whl; netifaces-0.11.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl; netifaces-0.11.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl; netifaces-0.11.0-cp36-cp36m-win32.whl; netifaces-0.11.0-cp36-cp36m-win_amd64.whl; netifaces-0.11.0-cp37-cp37m-macosx_10_15_x86_64.whl; netifaces-0.11.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl; netifaces-0.11.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl; netifaces-0.11.0-cp37-cp37m-win32.whl; netifaces-0.11.0-cp37-cp37m-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
netifaces-plusRetrieves network interface information…
permissive · top 15,000 on PyPI
netifaces2Retrieves network interface information…
permissive · top 15,000 on PyPI
ifcfgIfcfg parses network interface configuration…
permissive · top 15,000 on PyPI
ifaddrEnumerate network interfaces and their IP…
permissive · top 5,000 on PyPI
getmacRetrieves MAC addresses of local network…
permissive · top 15,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
pyroute2Pyroute2 is a pure Python networking framework…
unclear · top 5,000 on PyPI
django-netfieldsProvides Django model fields for PostgreSQL…
permissive · top 15,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
ipaddrProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI