1

If you turn on Web Sharing in Mac OS X, you can hit your local server with http://machinename.local/ instead of just your local IP address like http://192.168.1.101/. That's very convenient to me; I no longer have to remember IP addresses or worry about them changing.

This works great for me from other Apple devices connected to my network, e.g. iPhones and iPads. However, I can't seem to hit my server this way from a Windows machine. I was able to hit it fine with the IP address http://192.168.1.101/, but not as http://machinename.local/. I also tried just http://machinename/, but that didn't work either.

Does anyone know how I can hit the server from Windows by its machine name rather than the IP address?

4 Answers 4

3

Have you tried installing Bonjour for windows? That should let hostname.local names work.

3
  • Hmm, interesting -- thanks for the tip! I wasn't aware this would do it. Is there any way to achieve this without installing software on the machine though, just out of curiosity? Mar 30, 2011 at 0:46
  • 1
    Yes, this has worked very well in my experience. That package is the only way I know of to accomplish this.
    – mbauman
    Mar 30, 2011 at 2:21
  • 1
    @Aseem Kishore - yes, you can do this without bonjour. The process is called DNS. You can also achieve the same effect by adding entries to your hosts file
    – skub
    Mar 30, 2011 at 2:30
3

I see from your Question and your comment on some of the answers that you'd prefer a way to do this without doing anything on the Windows boxes.

Does anyone know if web browsers on Windows can hit the personal web sharing on other Windows boxes based on their NetBIOS Name Service / WINS names (that is, the names you'd use when mapping a remote SMB share to a drive letter -- like "\SERVERNAME\SHARENAME\")?

I ask because Macs can participate in NetBIOS Name Service and even register with WINS servers, but it might not be activated until you turn on Windows-style SMB file sharing:

  1. Go to the "Sharing" pane of System Preferences.
  2. Check the "File Sharing" checkbox.
  3. Hit the "Options..." button.
  4. Check the "Share files and folders using SMB (Windows)" checkbox.
  5. Now go to the "Network" pane of System Preferences.
  6. Select your usual network interface and hit "Advanced..."
  7. Click on the "WINS" tab.
  8. Pick a Windows-style hostname and workgroup for your Mac
  9. Optionally specify a WINS server to use (if your site already has a WINS server, they probably give this information out via DHCP already).

One last helpful note: Starting in Vista, Microsoft put something Bonjour-like into Windows, called Link-Local Multicast Name Resolution (LLMNR). Unfortunately, it's not interoperable with Bonjour, and most Windows users are still on XP anyway. I don't know of any LLMNR implementations for Mac OS X.

The Wikipedia article on Zero Configuration Networking (i.e. IETF ZeroConf, etc.) provides a helpful overview of different technologies and their current status.

2
  • Awesome! Thanks for the tip. I'll try it out next time I have a Windows machine nearby. Mar 31, 2011 at 6:34
  • Re question in second paragraph: On most systems (Windows, Linux, OS X), name resolution is implemented at system level. When a program tries to resolve a name using getaddrinfo() or gethostbyname(), it works with any protocol that is enabled: DNS, NBNS, Bonjour... I have used both \\dns-name.tld\share and http://nbns-name/ many times. Mar 31, 2011 at 20:10
0

Add the machine's name to your local hosts file. In Windows 7:

  1. Click the Start button and then click into the Search box in the menu.
  2. Enter "C:\Windows\System32\drivers\etc" without the quotes.
  3. Hit Enter on the keyboard.
  4. When the window opens, ouble-click on the hosts file.
  5. Choose Notepad to open the file.
  6. Manually add your entry to the file.
  7. Save.

Do this once for each Windows box on the LAN, and you'll be able to use the name instead of the IP from then on.

This solution will fail if the IP address changes.

8
  • Thanks, but I was aware of hosts and was hoping for a better solution. Whenever I'm on a friend's computer or network I don't want to have to mess with hosts files, mine or theirs. Mar 29, 2011 at 23:54
  • You want to reach these machines across the Internet, then, not just in your own LAN? If so, please update the question because that scenario has a completely different solution. :-)
    – goblinbox
    Mar 29, 2011 at 23:56
  • Nope, not on the internet. I sometimes develop at home, sometimes at a friend's house, sometimes at another friend's house. The IP address changes each time. I don't have a Windows box so sometimes borrow my girlfriend's laptop for a quick test in IE when I'm at home, or my friend's laptop at his home, etc. Mar 29, 2011 at 23:59
  • If machinename.local is on one private network and you're on another, then you would have to cross the internet to reach it. You would have to enable NAT in your gateway device/router, and have DNS hosted as well. Are you talking about connecting over a VPN, maybe?
    – goblinbox
    Mar 30, 2011 at 0:02
  • No, sorry for still not being clear. =P My machine is a laptop; there's no crossing network boundaries. Mar 30, 2011 at 0:23
0

Another option you might consider is Dynamic DNS. There are even free dynamic DNS services out there. Note that in order for it to work the network you are on would have to have an internet connection to interrogate the dynamic DNS server you are using.

1
  • Care with the DynDNS guys — they will spam the crap out of you for years :(
    – Alan H.
    May 24, 2012 at 6:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .