Quantcast
Channel: Python, How to get all external ip addresses with multiple NICs - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by chjortlund for Python, How to get all external ip addresses with...

Required: WMI / PyWin32 (https://sourceforge.net/projects/pywin32/)Use the following snippet to get the IP of the network card(s) on Windows.import wmic = wmi.WMI()for interface in...

View Article


Answer by Patrick for Python, How to get all external ip addresses with...

Get address of all NICs without any external packageimport socketprint socket.gethostbyname_ex(socket.gethostname())[2]

View Article


Answer by Mike Pennington for Python, How to get all external ip addresses...

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',...

View Article

Answer by Jean-Paul Calderone for Python, How to get all external ip...

For the general case, there is no solution. Consider the case where the local machine is behind a machine with two IP addresses doing NAT. You can change your local interface to anything you like, but...

View Article

Answer by Raymond Hettinger for Python, How to get all external ip addresses...

Use the subprocess module to connect to your usual systems tools like ifconfig or netstat:>>> import subprocess>>> print subprocess.check_output(['ifconfig'])

View Article


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...

View Article
Browsing latest articles
Browse All 6 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>