How to get the ip addresses of a nic
Bo Jacobsen
bo at systemhouse.dk
Thu Apr 22 12:52:48 EDT 2004
> > 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
I need to get addresses on hosts with mulitiple nics, and with multiple
aliases.
Trying to parse output from "$ip addr show" on those hosts are not easy.
Bo
More information about the Python-list
mailing list