SIOCGIFADDR & ioctl()

Micheal Kelly michealk at newlix.com
Thu Aug 10 10:28:06 EDT 2000


Hi all,

There was some discussion awhile back about getting nic config info (ip
address, netmask, broadcast addresses, MTUs, device names, etc) in Python.
 One suggestion was to use SIOCGIFADDR via ioctl() on a socket.  Question
is, how is this done in Python?  I've poked around in the documentation,
and for some reason, it's not jumping out at me.

Basically, I need to probe a system and determine what network interfaces
exist, and the configuration of each interface.  The platform is Linux.  I
could parse ifconfig's output, but I don't like relying on another
executable - I'd rather just query the OS directly.

Any thoughts?

Thanks,
- Mike K.




More information about the Python-list mailing list