qemu-options: Improve description for -smb option
PATCH 1/1 qemu-options: Improve description for -smb option
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
qemu-options.hx +3 -3
@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.
Signature · 1 line
2.20.1
+cc slirp & network maintainers
Quoted 34 lines · On Saturday 02 August 2025 13:05:49 Pali Rohár wrote:
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
Signed-off-by Pali Rohár <[email protected]>--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qemu-options.hx +3
-3@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.Signature · 1 line
2.20.1
PING?
Quoted 37 lines · On Sunday 10 August 2025 15:09:48 Pali Rohár wrote:
+cc slirp & network maintainers
Quoted 34 lines · On Saturday 02 August 2025 13:05:49 Pali Rohár wrote:
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
Signed-off-by Pali Rohár <[email protected]>--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qemu-options.hx +3
-3@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.Signature · 1 line
2.20.1
Any comments?
Quoted 37 lines · On Sunday 10 August 2025 15:09:48 Pali Rohár wrote:
+cc slirp & network maintainers
Quoted 34 lines · On Saturday 02 August 2025 13:05:49 Pali Rohár wrote:
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
Signed-off-by Pali Rohár <[email protected]>--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qemu-options.hx +3
-3@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.Signature · 1 line
2.20.1
Quoted 31 lines · Pali Rohár
Any comments?
Quoted 27 lines · On Sunday 10 August 2025 15:09:48 Pali Rohár wrote:
+cc slirp & network maintainers
Quoted 24 lines · On Saturday 02 August 2025 13:05:49 Pali Rohár wrote:
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
Signed-off-by Pali Rohár <[email protected]>--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qemu-options.hx +1
-1@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR
Quoted 7 lines
Quoted 7 lines
qemu-options.hx SRST · line 3316
Quoted 7 lines
qemu-options.hx +2
-2- must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.
Apologies for this not having been picked up earlier. The problem (as I mentioned in our IRC conversation) I think is the lack of anybody who knows anything about SMB or old Windows versions who felt competent to review it. But since nobody has, and as you say you've tested it with this, I guess we should take it.
My only concern is whether the "#PRE #NOFNR" advice is still valid for newer Windows versions, or whether it really is only something that NT 3.1 and Windows 3x needed. In particular this more recent LMHOSTS documentation from MS:
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nbte/01f85bfc-cfa3-4be0-b659-4ca0eddb5996
includes #PRE in its list of LMHOSTS known keywords, but not #NOFNR.
I think also we could probably helpfully explain what those two tags do, something like:
(The #PRE tag tells Windows to pre-cache the mapping to speed up initial connection. The #NOFNR tag tells Windows not to attempt to send QEMU Name Queries, because QEMU doesn't understand them.)
Then anybody who finds they need to adapt this to some other version of Windows will have a better idea whether they can just drop them or what they might need to change them to.
thanks
-- PMM
Quoted 46 lines · On Friday 17 April 2026 14:51:38 Peter Maydell wrote:
Quoted 31 lines · Pali Rohár
Any comments?
Quoted 27 lines · On Sunday 10 August 2025 15:09:48 Pali Rohár wrote:
+cc slirp & network maintainers
Quoted 24 lines · On Saturday 02 August 2025 13:05:49 Pali Rohár wrote:
Add #PRE and #NOFNR flags to LMHOSTS example line. Include information about LMHOSTS path on Windows 3.x.
Windows NT 3.1 requires #NOFNR flag for successful hostname resolving as described in MS article Q103765 because qemu/smbd does not respond to netbios name verification queries. #PRE is suggested in that article too and decrease delay on Windows 3.x for the first connection.
Signed-off-by Pali Rohár <[email protected]>--- qemu-options.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qemu-options.hx +1
-1@@ -3307,10 +3307,10 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNRQuoted 7 lines
Quoted 7 lines
qemu-options.hx SRST · line 3316
Quoted 7 lines
qemu-options.hx +2
-2- must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows + must be added in the file ``C:\WINDOWS\LMHOSTS`` (for Windows + 3x/9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows NT/2000). Then ``dir`` can be accessed in ``\\smbserver\qemu``.Apologies for this not having been picked up earlier. The problem (as I mentioned in our IRC conversation) I think is the lack of anybody who knows anything about SMB or old Windows versions who felt competent to review it. But since nobody has, and as you say you've tested it with this, I guess we should take it.
Quoted 6 lines
My only concern is whether the "#PRE #NOFNR" advice is still valid for newer Windows versions, or whether it really is only something that NT 3.1 and Windows 3x needed. In particular this more recent LMHOSTS documentation from MS:
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nbte/01f85bfc-cfa3-4be0-b659-4ca0eddb5996
includes #PRE in its list of LMHOSTS known keywords, but not #NOFNR.
I was trying to find documentation related to this topic and found this:
Q102725 - LMHOSTS File Information and Predefined Keywords (NT 3.1 - 2000):
https://web.archive.org/web/20130727015114/http://support.microsoft.com/kb/102725
Q314884 - LMHOSTS file information and predefined keywords (Windows XP):
https://web.archive.org/web/20130426133556/http://support.microsoft.com/kb/314884
Q103765 - #NOFNR Flag in LMHosts to Communicate Across Routers
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/103765
(seems that web archive does not have copy of Q103765)
Q106169 - Windows NT and HP LAN Manager/X Version 1.4 Interoperability
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/106169
(seems that web archive does not have copy of Q106169)
#PRE and #NOFNR are documented up to the Windows XP. I have not found any updated KB of LMHOSTS for Vista and up, maybe it hidden somewhere (like you found that [MS-NBTE]).
#NOFNR is documented in Q106169 that does not apply for NT 3.5 (and maybe up too).
I did experiments with NT 3.1, WFW 3.11 and XP under Wireshark what are systems doing with and without #NOFNR. NT 3.1 without #NOFNR is sending NBNS packet (udp port 137) to specified IP address with name query of "smbserver" (the configured hostname). If there is no response then accessing the SMB share fails with error 53 (same as described in Q103765). Without #NOFNR it is not sending NBNS packet, it directly try to establish SMB connection over tcp port 139.
All other tested systems do not try to do name query independently of #NOFNR. So it looks like that non-NT3.1 are behaving as if the #NOFNR was always specified. (NBNS = NetBios Name Service)
So based on these experiments, the #NOFNR is required only for Windows NT 3.1 because Qemu does not answer to those UDP NBNS packets sent to internal 10.0.2.4 address. But it is harmless and not needed for other Windows versions.
About #PRE, I have subjective feeling for persistent drive assigning (those which are restored on every startup during login) for more Windows versions is #PRE causing faster connection and login. The most visible it is in WFW 3.11, where File Manager is not able to access network disk for more seconds and show error message that disk is inaccessible, and needs waiting... When #PRE is used it never showed me error message and always accessed network disk without delay.
Quoted 7 lines
I think also we could probably helpfully explain what those two tags do, something like:
(The #PRE tag tells Windows to pre-cache the mapping to speed up initial connection. The #NOFNR tag tells Windows not to attempt to send QEMU Name Queries, because QEMU doesn't understand them.)
Quoted 6 lines
Then anybody who finds they need to adapt this to some other version of Windows will have a better idea whether they can just drop them or what they might need to change them to.
thanks
-- PMM
Yes, this is a good idea to mention. Finding those information would be harder in future, specially when Microsoft already removed those KB articles from own servers and web archive does not have copies of them.
About about path to LMHOSTS file. On 3x/9x/Me systems it is <WIN>\LMHOSTS and on NT systems it is <WIN>\SYSTEM32\DRIVERS\ETC\LMHOSTS <WIN> is the Windows directly which can chosen during installation of Windows itself. 3x/9x/Me has default C:\Windows; NT 3.1-2000 has default C:\WINNT and since Windows XP it is default C:\Windows. So path to the LMHOSTS file depends on installation and default path was changed more times.
Note that Microsoft Network Client 3.0 and Microsoft LAN Manager Client (both are DOS based) also need that adjustment of the LMHOSTS file. Default location for Network Client is C:\NET\LMHOSTS and for LAN Manager is C:\LANMAN\ETC\LMHOSTS. I check Network Client 3.0 and it is working fine with and also without #PRE #NOFNR.
Maybe the documentation could be extended and mention something like:
must be added in the file ``C:\NET\LMHOSTS`` (for DOS Network Client) or ``C:\LANMAN\ETC\LMHOSTS`` (for DOS LAN Manager)
or ``C:\WINDOWS\LMHOSTS`` (for Windows 3x/9x/Me)
or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows NT/2000) or ``C:\WINDOWS\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows XP and new)
(People who are installing to non-default location would be already aware that would need to adjust any WINDOWS related path)
Quoted 19 lines · Pali Rohár
Yes, this is a good idea to mention. Finding those information would be harder in future, specially when Microsoft already removed those KB articles from own servers and web archive does not have copies of them.
About about path to LMHOSTS file. On 3x/9x/Me systems it is <WIN>\LMHOSTS and on NT systems it is <WIN>\SYSTEM32\DRIVERS\ETC\LMHOSTS <WIN> is the Windows directly which can chosen during installation of Windows itself. 3x/9x/Me has default C:\Windows; NT 3.1-2000 has default C:\WINNT and since Windows XP it is default C:\Windows. So path to the LMHOSTS file depends on installation and default path was changed more times.
Note that Microsoft Network Client 3.0 and Microsoft LAN Manager Client (both are DOS based) also need that adjustment of the LMHOSTS file. Default location for Network Client is C:\NET\LMHOSTS and for LAN Manager is C:\LANMAN\ETC\LMHOSTS. I check Network Client 3.0 and it is working fine with and also without #PRE #NOFNR.
Quoted 7 lines
Maybe the documentation could be extended and mention something like:
must be added in the file ``C:\NET\LMHOSTS`` (for DOS Network Client) or ``C:\LANMAN\ETC\LMHOSTS`` (for DOS LAN Manager)
or ``C:\WINDOWS\LMHOSTS`` (for Windows 3x/9x/Me)
or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows NT/2000) or ``C:\WINDOWS\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows XP and new)
Thanks for doing the testing on different Windows versions. Based on this conversation, I'm going to take this patch, with some expansion of it, like this, so we explain what #PRE and #NOFNR do, and list LMHOSTS locations for newer Windows. Let me know if you're OK with this or you'd prefer some other changes.
qemu-options.hx +14 -5
@@ -3415,7 +3415,7 @@ SRST ``smb=dir[,smbserver=addr]`` When using the user mode network stack, activate a built-in SMB - server so that Windows OSes can access to the host files in + server so that Windows OSes can access the host files in ``dir`` transparently. The IP address of the SMB server can be set to addr. By default the 4th IP in the guest network is used, i.e. x.x.x.4.
@@ -3424,11 +3424,20 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows - NT/2000). + must be added in the ``LMHOSTS`` file. In this line, ``#PRE`` + requests pre-caching of the mapping, which speeds up the initial + connection on some Windows versions. ``#NOFNR`` is necessary for + Windows NT 3.1 to tell it not to send QEMU NBNS query packets that + QEMU does not handle, and is harmlessly ignored on other versions. + + The ``LMHOSTS`` file may be in different locations depending on + the Windows version: + + - ``C:\WINDOWS\LMHOSTS`` for Windows 3x/9x/Me + - ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` for Windows NT/2000 + - ``C:\WINDOWS\SYSTEM32\DRIVERS\ETC\LMHOSTS`` for Windows XP and newer Then ``dir`` can be accessed in ``\\smbserver\qemu``.
thanks
-- PMM
Quoted 72 lines · On Thursday 30 April 2026 11:58:21 Peter Maydell wrote:
Quoted 19 lines · Pali Rohár
Yes, this is a good idea to mention. Finding those information would be harder in future, specially when Microsoft already removed those KB articles from own servers and web archive does not have copies of them.
About about path to LMHOSTS file. On 3x/9x/Me systems it is <WIN>\LMHOSTS and on NT systems it is <WIN>\SYSTEM32\DRIVERS\ETC\LMHOSTS <WIN> is the Windows directly which can chosen during installation of Windows itself. 3x/9x/Me has default C:\Windows; NT 3.1-2000 has default C:\WINNT and since Windows XP it is default C:\Windows. So path to the LMHOSTS file depends on installation and default path was changed more times.
Note that Microsoft Network Client 3.0 and Microsoft LAN Manager Client (both are DOS based) also need that adjustment of the LMHOSTS file. Default location for Network Client is C:\NET\LMHOSTS and for LAN Manager is C:\LANMAN\ETC\LMHOSTS. I check Network Client 3.0 and it is working fine with and also without #PRE #NOFNR.
Quoted 7 lines
Maybe the documentation could be extended and mention something like:
must be added in the file ``C:\NET\LMHOSTS`` (for DOS Network Client) or ``C:\LANMAN\ETC\LMHOSTS`` (for DOS LAN Manager)
or ``C:\WINDOWS\LMHOSTS`` (for Windows 3x/9x/Me)
or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows NT/2000) or ``C:\WINDOWS\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (for Windows XP and new)Thanks for doing the testing on different Windows versions. Based on this conversation, I'm going to take this patch, with some expansion of it, like this, so we explain what #PRE and #NOFNR do, and list LMHOSTS locations for newer Windows. Let me know if you're OK with this or you'd prefer some other changes.
qemu-options.hx +14
-5@@ -3415,7 +3415,7 @@ SRST ``smb=dir[,smbserver=addr]`` When using the user mode network stack, activate a built-in SMB - server so that Windows OSes can access to the host files in + server so that Windows OSes can access the host files in ``dir`` transparently. The IP address of the SMB server can be set to addr. By default the 4th IP in the guest network is used, i.e. x.x.x.4.@@ -3424,11 +3424,20 @@ SRST :: - 10.0.2.4 smbserver + 10.0.2.4 smbserver #PRE #NOFNR - must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows - 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows - NT/2000). + must be added in the ``LMHOSTS`` file. In this line, ``#PRE`` + requests pre-caching of the mapping, which speeds up the initial + connection on some Windows versions. ``#NOFNR`` is necessary for + Windows NT 3.1 to tell it not to send QEMU NBNS query packets that + QEMU does not handle, and is harmlessly ignored on other versions. + + The ``LMHOSTS`` file may be in different locations depending on + the Windows version: + + - ``C:\WINDOWS\LMHOSTS`` for Windows 3x/9x/Me + - ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` for Windows NT/2000 + - ``C:\WINDOWS\SYSTEM32\DRIVERS\ETC\LMHOSTS`` for Windows XP and newer Then ``dir`` can be accessed in ``\\smbserver\qemu``.
Quoted 2 lines
thanks
-- PMM
Hello, thank you for updating the change. It is fine from my side. And it is really good to mention where modern Windows systems have that file.
I have one just question regarding the (English) wording:
"... to tell it not to send QEMU NBNS query packets that QEMU does not handle"
Should not be there word "send to" QEMU? Packet is "NBNS query", it is not "QEMU NBNS packet", packet comes from Windows and is sent to QEMU.
E.g.:
"... to tell it not to send NBNS query packets to QEMU that QEMU does not handle" or just:
"... to tell it not to send NBNS query packets that QEMU does not handle"
Sorry if this is a stupid English question, I'm not native English speaker and sometimes I write or understand English words in wrong order.
Quoted 7 lines · Pali Rohár
I have one just question regarding the (English) wording:
"... to tell it not to send QEMU NBNS query packets that QEMU does not handle"
Should not be there word "send to" QEMU? Packet is "NBNS query", it is not "QEMU NBNS packet", packet comes from Windows and is sent to QEMU.
Quoted 7 lines
E.g.:
"... to tell it not to send NBNS query packets to QEMU that QEMU does not handle" or just:
"... to tell it not to send NBNS query packets that QEMU does not handle"Sorry if this is a stupid English question, I'm not native English speaker and sometimes I write or understand English words in wrong order.
No worries. It works both ways in English: you can say "I sent my friend a letter" or "I sent a letter to my friend", and they mean the same thing.
But I think I prefer "not to send NBNS query packets that QEMU does not handle" because it avoids awkwardly repeating "QEMU" and also it avoids the potential ambiguity in "QEMU NBNS query packets". So since I need to reroll this pull request anyway I've updated the phrasing.
thanks
-- PMM
Quoted 21 lines · On Sunday 03 May 2026 15:41:15 Peter Maydell wrote:
Quoted 7 lines · Pali Rohár
I have one just question regarding the (English) wording:
"... to tell it not to send QEMU NBNS query packets that QEMU does not handle"
Should not be there word "send to" QEMU? Packet is "NBNS query", it is not "QEMU NBNS packet", packet comes from Windows and is sent to QEMU.
Quoted 7 lines
E.g.:
"... to tell it not to send NBNS query packets to QEMU that QEMU does not handle" or just:
"... to tell it not to send NBNS query packets that QEMU does not handle"Sorry if this is a stupid English question, I'm not native English speaker and sometimes I write or understand English words in wrong order.
No worries. It works both ways in English: you can say "I sent my friend a letter" or "I sent a letter to my friend", and they mean the same thing.
Quoted 8 lines
But I think I prefer "not to send NBNS query packets that QEMU does not handle" because it avoids awkwardly repeating "QEMU" and also it avoids the potential ambiguity in "QEMU NBNS query packets". So since I need to reroll this pull request anyway I've updated the phrasing.
thanks
-- PMM
Ok, thank you for the explanation (I think that I did not use the first form so it looked a bit strange for me) and also taking care about this change and updating it. Now I see that it is in the git repository.