A portable library to retrieve network interface information (IP addresses, MAC addresses, gateways, etc.) on Unix, Windows, and macOS. Version 0.12.5 supports Python >=3.6. Fork of the unmaintained netifaces with modern Python support and additional features. Released irregularly.
Install & Compatibility
Where this runs
tested against v0.12.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The library name in PyPI is 'netifaces-plus' but the import package is 'netifaces'. Do not use the hyphenated name.
import netifaces
The function to list interface names is `interfaces()`, not `networks()`.
netifaces.interfaces()
`gateways()` is a top-level function returning all gateway info. There is no `default_gateway()`.
netifaces.gateways()
Basic usage: list interfaces, get addresses for first interface, and show gateways.
import netifaces
# List all network interface names
ifaces = netifaces.interfaces()
print('Interfaces:', ifaces)
# Get addresses for a specific interface (e.g., 'eth0' or 'en0')
if ifaces:
iface = ifaces[0]
addrs = netifaces.ifaddresses(iface)
print(f'Addresses for {iface}:', addrs)
# Get default gateways
print('Gateways:', netifaces.gateways())
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.