distrax.utils.network.ip_address_and_netmask_from_network_interface#
- distrax.utils.network.ip_address_and_netmask_from_network_interface(interface)[source]#
Get the ip address either the inet4 or 6 from the network interface provided.
- Parameters:
interface (
str
) – the network interface i.e. eth0, ib0, etc- Return type:
- Returns:
A string format of the ip address as ..*.* The netmask as a str Then the ..*.*/*
- Raises:
OSError – when the interface does not exist
Examples
>>> distrax.utils.network.ip_address_and_netmask_from_network_interface("lo") '127.0.0.1', '32', '127.0.0.1/32'