Getting the network interfaces information
Network interfaces information: os.networkInterfaces()
The os
module has the networkInterfaces()
method to return the object that shows the information about the network interfaces available on the system.
The object has multiple interfaces.
Each interface has an identifier used as an object key attribute like lo0
, en0
, utun0
, utun1
… etc.
Each interface has an array of addresses.
Each address is an object like this one:
Where address
, netmask
, mac
, cidr
are the address (ip address, mac addres) and netmask.
The family
attribute identifies the type of the ip protocol.
The internal
attribute is a boolean value, true
if the address is remotely accessible.