I currently manage two servers on Linode. The first "server-a" is running 12.04, the second "server-b" is a fresh install of 14.04.
A while ago I had some trouble with spf records on server-a and came to the realization that I needed to explicitly add (or create an A record for) the ipv6 address since the postfix service was using ipv6 to connect to gmail. This was surprising to me since I just assumed it would be using ipv4 by default. After a bit more followup I discovered that nearly all services were using ipv6 in some cases but not others.
For instance, if postfix delivers mail, or if I telnet or ssh to another host on Linode my ipv6 address shows up the log. On the other hand if I connect to my local server here at home or to one on Digital Ocean's network, ipv4 is used.
Can anyone explain when and how it is determined that ipv4 or ipv6 should be used when establishing a connection? Does it vary from service to service or is this part of a central configuration?