This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author psklenar
Recipients psklenar
Date 2011-01-04.10:18:12
SpamBayes Score 8.000799e-08
Marked as misclassified No
Message-id <>
tried python 2.6 on rhel55
tried python-2.7-8 on fedora14

Steps to Reproduce:
1. install machine, have a fixed hostname up to mac address =

2. wait a week or longer when your local dhcp server changes your IP but not
hostname =

[ ~]# host has address

ifconfig shows the same

3.   gethostbyname(gethostname()) shows wrong IP, the original one

Actual results:
[ ~]# python
Python 2.4.3 (#1, Jun 11 2009, 14:09:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import gethostname
>>> from socket import gethostbyname
>>> gethostname()
>>> gethostbyname(gethostname())

Expected results:
gethostbyname(gethostname()) will return your actual IP,

Other: = is added in /etc/hosts in the time of OS installation , then its not changed
Date User Action Args
2011-01-04 10:18:18psklenarsetrecipients: + psklenar
2011-01-04 10:18:18psklenarsetmessageid: <>
2011-01-04 10:18:13psklenarlinkissue10821 messages
2011-01-04 10:18:12psklenarcreate