Using DHCP Reservations to overcome Bonjour woes
I love everything about my MacBook Pro, but for some reason it does not like to share its screen. It appears under the "Shared" section of the sidebar in Finder, and file sharing works perfectly, but for some reason screen sharing won't work. The "Connecting To 'MacBookPro'" panel will pop up and then disappear a few moments later (as if it is about to connect), but at least 90% of the time no screen sharing window appears.
Fellow TUAW writer Aron Trimble suggested that I go into Finder and try "Go > Connect to Server" and then put in "vnc://10.0.x.x" (where 10.0.x.x is my MacBook Pro's IP address). That worked immediately, and every time.
This confirmed that it wasn't a firewall setting (Screen Sharing is explicitly on) or trouble accessing the MacBook Pro over the LAN (file sharing already worked perfectly). For some reason the screen sharing connection was just not being made over Bonjour.
The only drawback to this direct-IP method is that my network, like most, uses dynamic addresses with DHCP, meaning that the IP addresses change from time to time, especially on a network with multiple devices which are not always turned on. My first thought was to create a static IP for the MacBook Pro in System Preferences > Network, but then I realized that my office LAN uses IPs which start with 192.168.x.x. I could create a new network "Location" but that would also involve manually switching it back and forth, or using a third-party program.
What I really needed was a way to make sure that my MacBook Pro is given the same IP every time it connects to my home LAN. Fortunately, Apple's Airport Extreme will allow me to do just that using DHCP Reservations.
A DHCP Reservation tells the Airport Extreme to reserve a certain IP address for certain computers, as determined either by a "DHCP Client ID" or the computer's MAC address. A DHCP Client ID is easier to remember than a MAC address, but the MAC address will never change unless you swap out the logic board or Airport card of your Mac. I'll show you how to set it up using either method.
Launch System Preferences, then open the Network panel. You have different MAC addresses for AirPort and Ethernet, so choose whichever one you want to configure. Then click the "Advanced..." button.
If you want to use a DHCP Client ID, you will see a field for it in the TCP/IP tab. Enter a name in there. I prefer to keep it simple: Macbook, iMac, MacBookPro. Copy whatever you enter there into the clipboard.
If you want to use the MAC Address, click the "Ethernet" tab and select and copy to clipboard all the letters and numbers next to the "Ethernet ID" (in System Preferences, Mac OS X also refers to MAC address as the "Ethernet ID", perhaps to avoid confusion between "Mac" and "MAC". However, in Airport Utility, it is referred to as the MAC Address.)
Launch AirPort Utility. Select your AirPort base station and click the "Manual Setup" button. When the settings load, click the "Internet" icon from the top toolbar, and then click the DHCP tab. You will see a spot for "DHCP Reservations." Click the + and then add a description (this can be anything you want). Next to "Reserve address" choose either MAC Address or DHCP Client ID (whichever you chose above). Click "Continue" and paste the information into the next window. Then select the IPv4 address you want to use for that computer (I chose 10.0.1.51).
Click Done, and the window will close. Click update in Airport Utility and the Airport Base Station will reboot to use the new settings.
OK, but how do I get Screen Sharing to use that IP instead of the Bonjour name? We're going to create a "vncloc" file. When double-clicked, it will automatically start a screen sharing session. The file format is quite simple:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>URL</key> <string>vnc://10.0.1.51</string> </dict> </plist>
Obviously the IP address in the file should be the same as the one that was chosen earlier. I saved the file as "Macbookpro.vncloc" and saved it in ~/Library/Application Support/Screen Sharing/ (although you can save it anywhere you want). I then dragged the vncloc into the "Places" sidebar in Finder.
Since setting up this method, I have had a 100% success rate at connecting to my MacBook Pro.
Bonus: If you have no problems using screen sharing over Bonjour and want to make a quick shortcut to screensharing, you can simply create a .vncloc file like this (for my iMac which is named, uncreatively "iMac"):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>URL</key> <string>vnc://imac.local.</string> </dict> </plist>
Drag that file to your Places sidebar (or your Desktop, or the Documents section of your Dock), and have quick access to screen sharing anywhere.
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)
- NFL Mobile updated for 2014 Season with new Fantasy Football features, NFL Now integration
- Yahoo Mail improves email inbox searching with new filtering options
- Ember for Mac gains 'hugely-requested' screen recording feature