get_default_interface

getmac.getmac.get_default_interface()[source]

Get the name of the default network interface on the system.

This is essentially a convenience wrapper around get_by_method() with the default_iface method type. The code is literally return getmac.getmac.get_by_method("default_iface").

Note

This currently doesn’t work on Windows platforms. It should work on other platforms, including Linux, OSX, and most BSDs.

Return type:

Optional[str]

Returns:

The name of the default network interface, or None if it could not be found or an exception occurred.