socket.gethostbyaddr(socket.gethostname()) will return a tuple containing fully qualified hostname, alternative hostnames, ip addresses (>1 if multihomed). Thanks, --Kartic