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.

classification
Title: socket.getfqdn() returns domain "mshome.net"
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.7, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: markuskramerIgitt, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-03-20 13:40 by markuskramerIgitt, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg338472 - (view) Author: Markus (markuskramerIgitt) Date: 2019-03-20 13:40
In a corporate network, `wmic computersystem get domain` returns the correct domain.

On some clients, the Python query "socket.getfqdn()" returns the wrong domain, namely "mshome.net"

>>> import socket
>>> socket.getfqdn()
'*****.mshome.net'

I have only found only very old nominations of that domain.

Problems persists after reboot.

Tried versions 
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32

Currently, I suspect this is a DHCP configuration problem.
msg338478 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-03-20 15:04
We just return the result of GetComputerNameEx [1] here - we don't use WMI at all (and given the complexities, we are not going to start).

Are you able to provide any more information? In particular, if the documentation for GetComputerNameEx (below) helps you understand why these machines are different, that would be helpful to know.

Obviously (I hope) we can't diagnose a DHCP issue on your network, so claiming this is a bug in Python is likely premature.

[1]: https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getcomputernameexw
msg338482 - (view) Author: Markus (markuskramerIgitt) Date: 2019-03-20 15:21
Dear Steve,
in fact not a Python bug at all.

I used 2 commands: 
  ipconfig /release
  ipconfig /renew
and rebootet.

This fixed the issue, for now.

Also, I found this domain in c:\Windows\System32\drivers\etc\hosts.ics

Unclear who created that entry.


Documenting this here could help others with the same problem.

Closing this issue.
msg338487 - (view) Author: Markus (markuskramerIgitt) Date: 2019-03-20 15:53
I found the IP of mshome.net in an Ethernet adapter "vEthernet"
It seems that this adapter stems from Hyper-V.


It therefore seems that socket.getfqdn() reported the wrong network adapter once.

Because I cannot reproduce this, I leave this issue closed.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80563
2019-03-20 15:53:09markuskramerIgittsetresolution: not a bug -> works for me
messages: + msg338487
2019-03-20 15:21:41markuskramerIgittsetstatus: open -> closed
resolution: not a bug
messages: + msg338482

stage: resolved
2019-03-20 15:04:39steve.dowersetmessages: + msg338478
2019-03-20 13:40:49markuskramerIgittcreate