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.0008e-08
Marked as misclassified No
Message-id <1294136298.58.0.0957564280259.issue10821@psf.upfronthosting.co.za>
In-reply-to
Content
version:
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
1.1.1.1 = machine.something.com

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

[root@machine.something.com ~]# host machine.something.com
machine.something.com has address 1.1.1.159

ifconfig shows the same

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

Actual results:
[root@machine.something.com ~]# 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()
'machine.something.com'
>>> gethostbyname(gethostname())
'1.1.1.1'
>>>

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

Other:
1.1.1.1 = machine.something.com is added in /etc/hosts in the time of OS installation , then its not changed
History
Date User Action Args
2011-01-04 10:18:18psklenarsetrecipients: + psklenar
2011-01-04 10:18:18psklenarsetmessageid: <1294136298.58.0.0957564280259.issue10821@psf.upfronthosting.co.za>
2011-01-04 10:18:13psklenarlinkissue10821 messages
2011-01-04 10:18:12psklenarcreate