Python, How to get all external ip addresses with multiple NICs

后端 未结 5 1073
闹比i
闹比i 2020-12-10 18:48

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 o

5条回答
  •  隐瞒了意图╮
    2020-12-10 19:21

    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 it's unlikely that you'll convince the NAT machine to make a different routing decision on its outgoing connections.

提交回复
热议问题