fetch_ip_using_dns¶
- getmac.utils.fetch_ip_using_dns()[source]¶
Determine the IP address of the default network interface.
Connects a UDP socket to Cloudflare’s DNS (
1.1.1.1:53), which should go through the default interface. Nothing is sent, since connecting a UDP socket only picks the route. That populates the source address of the socket, which we then inspect and return.- Return type:
- Returns:
IP address of this system’s default network interface as a string