Python, How to get all external ip addresses with multiple NICs
What is the most efficient way to get all of the external ip address of a machine with multiple nics, using python? I understand that an external server is neeeded (I have one available) but am un able to find a way to find a good way to specify the nic to use for the connection (So I can use a for loop to iterate through the various nics). Any advice about the best way to go about this? You should use netifaces . It is designed to be cross-platform on Mac OS X, Linux, and Windows. >>> import netifaces as ni >>> ni.interfaces() ['lo', 'eth0', 'eth1', 'vboxnet0', 'dummy1'] >>> ni.ifaddresses(