How to get the ip addresses of a nic

Chris Lyon chris.lyon at spritenote.co.uk
Thu Apr 22 08:15:36 EDT 2004


jtdubs at eos.ncsu.edu (Justin Dubs) wrote in message news:<2e262238.0404211825.2f6231b at posting.google.com>...
> "Bo Jacobsen" <bo at systemhouse.dk> wrote in message news:<LEfhc.146586$jf4.7761132 at news000.worldonline.dk>...
> > Is there a simple way to get all the ip addresses of a nic, beyound parsing
> > /etc/sysconfig/.....
> 
> Depending on your needs:
> 
> >>> socket.gethostbyname(socket.gethostname())
> '192.168.0.18'
> 
> Justin Dubs

Tearing apart socket.gethostbyname_ex(socket.gethostname()) might help.



More information about the Python-list mailing list