[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1400
  • Last Modified:

Lmhosts - Getting it to work

I have some questions...

Can i use lmhosts to have multiple names point to a single ip, i.e

192.168.1.1       magic    #pre
192.168.1.1       server   #pre

so if i go \\server  or \\magic, i open up the same computer     50 points

Another question

if i do a         nbtstat -c

why doesnt it show those entries after i have rebooted, is there a log that shows if lmhosts was loaded to the nbt cache?          125 points

how do i know if Lmhosts is working?  40 points

finally...

where does the lmhosts file have to reside for it be access and what is its extension?  35

I might throw in 50 extra points if you can provide insight into the workings of lmhosts file

0
jjk16
Asked:
jjk16
  • 8
  • 5
  • 2
3 Solutions
 
plemieux72Commented:
"lmhosts" is for NetBIOS name resolution.  On legacy Microsoft networks that don't have a WINS (NBNS) server, this file can help resolve those names.  On Microsoft's more modern operating systems (Windows 2000 and later), if all your applications support DNS, this would be the better way of resolving names.  On these networks, if you don't have a DNS server to resolve your local names, you can use the "hosts" file.  It behaves pretty much the same way but does not use the #PRE and other # options.

Both of these files reside in %SystemRoot%\System32\Drivers\Etc
None of them have an extension but both can be edited using notepad.exe

As far as having two different names for the same IP, yes, I do this on my network and it works fine.

Entries with #PRE are loaded into the cache when you reboot however, maybe the case matters?  Try with uppercase and see if it makes a difference... let us know.
0
 
jjk16Author Commented:
if the entries are loaded in my cache, why cant i see them with a nbtstat -c?
its always empty
0
 
lrmooreCommented:
Here are some links to really good detailed information:
LMHOSTS
http://support.microsoft.com/default.aspx?scid=kb;en-us;314884
http://www.realcomputerguy.com/lmhosts.htm
http://www.labmice.net/networking/lmhosts.htm

How to Write an LMHOSTS File for Domain Validation and Other Name Resolution Issues
http://support.microsoft.com/support/kb/articles/Q180/0/94.ASP 

plemieux72 has a point. Everything should be in uppercase in the LMHOSTS file..
Also, be sure to use the <TAB> between columns, not spaces

192.168.1.1<tab>MAGIC<tab>#PRE
192.168.1.1<tab>SERVER<tab>#PRE

Make the changes, and you can refresh the cache with "nbtstat -R"  <- that's a capital "R"

0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
lrmooreCommented:
>how do i know if Lmhosts is working?
If the entries show up in the cache with "nbtstat -c"
And if you can ping both magic and server by name.

>if the entries are loaded in my cache, why cant i see them with a nbtstat -c?
Probably because your format is not correct, and/or you have a file extension, or it is in the wrong location.
0
 
jjk16Author Commented:
thanks for the info,  the caps on #PRE
are important, that was what was missing

however, my cache is still empty, i can ping the ips by name

they are not in my cache, and i cannot open via unc

\\server or \\magic

im testing this on my computer, so i should be able to open mine as i can do a  \\192.168.1.100
and my computer name which is long,

my comp       xp sp2
0
 
jjk16Author Commented:
"Keyword entries in the LMHOSTS files of Microsoft Windows NT systems must be entered in uppercase to be recognized. If the keywords #INCLUDE and #PRE are not uppercase, they are considered to be comments"
0
 
plemieux72Commented:
Is NetBIOS over TCP/IP enabled?  What about "Enable LMHOSTS lookup" in the TCP/IP advanced properties WINS tab?
0
 
jjk16Author Commented:
it was setup as default, i changed it to enabled, still no dice, lmhosts lookup is also enabled

i was hoping that using lmhosts file would allow me to have easy names for certain computers, i.e magic, which when i run \\magic would open up the computer as  \\ipaddress even if the other machine name was different i,e    computername = dell0232
the lmhosts entry

192.168.1.1     dell      #PRE

would open up \\192.168.1.1 or \\dell0232

?
0
 
lrmooreCommented:
Works just fine with my LMHOSTS file (notice that even the system name is all caps):
#
192.168.122.150      EMERALD4          #PRE
192.168.122.150        MAGIC2          #PRE
#

C:\>nbtstat -R
C:\>nbtstat -c

                  NetBIOS Remote Cache Name Table

        Name              Type       Host Address    Life [sec]
    ------------------------------------------------------------
    MAGIC2         <03>  UNIQUE          192.168.122.150     -1
    MAGIC2         <00>  UNIQUE          192.168.122.150     -1
    MAGIC2         <20>  UNIQUE          192.168.122.150     -1
<clip>
    EMERALD4       <03>  UNIQUE          192.168.122.150     -1
    EMERALD4       <00>  UNIQUE          192.168.122.150     -1
    EMERALD4       <20>  UNIQUE          192.168.122.150     -1

0
 
jjk16Author Commented:
???

lmhosts file...
192.168.1.100    MAGIC2    #PRE

 Directory of C:\WINDOWS\system32\drivers\etc

11/06/2004  01:32 PM    <DIR>          .
11/06/2004  01:32 PM    <DIR>          ..
03/31/2003  04:00 AM               734 hosts
11/06/2004  01:18 PM                27 lmhosts
03/31/2003  04:00 AM               407 networks
03/31/2003  04:00 AM               799 protocol
06/30/2004  09:32 PM             7,276 services
               5 File(s)          9,243 bytes
               2 Dir(s)  15,713,738,752 bytes free

C:\WINDOWS\system32\drivers\etc>edit lmhosts

C:\WINDOWS\system32\drivers\etc>nbtstat -R
    Successful purge and preload of the NBT Remote Cache Name Table.

C:\WINDOWS\system32\drivers\etc>nbtstat -c

Local Area Connection 3:
Node IpAddress: [0.0.0.0] Scope Id: []

    No names in cache

Wireless Network Connection 2:
Node IpAddress: [192.168.1.100] Scope Id: []

    No names in cache

C:\WINDOWS\system32\drivers\etc>ping magic2

Pinging magic2 [192.168.1.100] with 32 bytes of data:

Reply from 192.168.1.100: bytes=32 time<1ms TTL=128
Reply from 192.168.1.100: bytes=32 time<1ms TTL=128
Reply from 192.168.1.100: bytes=32 time<1ms TTL=128
Reply from 192.168.1.100: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.1.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\WINDOWS\system32\drivers\etc>
0
 
jjk16Author Commented:
tried on laptop too.. same thing,   Lrmoore,  you got some soft of magic beans i can plant to make this work? I dont need 24k gold eggs to come of a duck by i would like the lmhosts to work
0
 
jjk16Author Commented:
I figured it out,     you cannot load names to point to your ip,

              NetBIOS Remote Cache Name Table

    Name              Type       Host Address    Life [sec]
------------------------------------------------------------
EMERALD        <03>  UNIQUE          192.168.52.102      -1
EMERALD        <00>  UNIQUE          192.168.52.102      -1
EMERALD        <20>  UNIQUE          192.168.52.102      -1

i just picked some arbitrary ip and name,  i guess the OS doesnt include itself in the cache, any insight is helpfull and i will be applying the points soon, thanks for the info
0
 
lrmooreCommented:
> i guess the OS doesnt include itself in the cache

Quite correct. I didn't realize you were trying to point to yourself all along...
Are you also trying to map a drive to yourself, too?
0
 
lrmooreCommented:
Also, make sure the names/ip's don't conflict with your hosts file...
0
 
jjk16Author Commented:
i was testing the lmhosts, on a known good, didnt realize that it has to be tested on remote connection. but thanks everyone's input
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now