The Python Cookbook (1st ed) suggests this, in recipe 10.4 ("Finding Your Own Name and Address): >>> import socket >>> myname = socket.getfqdn(socket.gethostname()) >>> myaddr = socket.gethostbyname(myname) >>> myaddr '192.168.1.120'