1

I would like to find all possible addresses that might identify my computer on all of its network interfaces. I would like to do this within Python.

For example if I run ifconfig on linux I get the following:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 
          inet addr:172.25.24.6  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: ... Scope:Link

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host

wlan0     Link encap:Ethernet  HWaddr
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: ... Scope:Link

I see that my machine identifies as 172.25.24.6, 127.0.0.1, and 192.168.1.1. How can I get this information in a cross platform way from within Python?

MRocklin
  • 55,641
  • 23
  • 163
  • 235

0 Answers0