Best way to get default outgoing IP address on Linux
There are multiple cases where you may need to know which IPv4 or IPv6 address from all IP addresses available on your machine will be used for outgoing connections to remote hosts.
Generic Linux machine may have multiple network interfaces and each of them may have multiple IPv4 or IPv6
Pavel's blog about underlying Internet technologies