Q. How do I enable BranchCache?
May 20, 2009
A. BranchCache, described in this FAQ, must be enabled on your clients to instruct them which type to use (hosted or distributed cache). You must also create the required firewall exceptions and ensure that the files you wish to be cacheable have a hash generated on them. The easiest way to configure BranchCache is via Group Policy.
First, you need to make the server hosting the data generate hash values.
Open a Group Policy Object.
Navigate to Computer Configuration, then Policies, Administrative Templates, Network, Lanman Server.
Double-click Hash Publication for BranchCache.
Set this to Enabled, then configure when the hash should be generated, as shown here. You can generate hashes if a folder is shared and enabled for cache (recommended), never generate a hash, or generate a hash for every shared folder. Make a choice and click OK.
Click to expand.
If you configured the server to generate a hash only if a shared folder is set to use caching, you need to
Right-click the shared folder in Explorer and select Properties.
Select the Sharing tab.
Click the Advanced Sharing button.
Click the Caching button.
Check the Enable BranchCache option, as shown here, and click OK to close all dialogs.
Click to expand.
You can also use the hashgen command to force a hash generation for other files, such as web files served via HTTP.
If you're using hosted cache, you now need to enable the BranchCache feature on a Server 2008 R2 server. For this walkthrough, I'll configure distributed cache (peer to peer).
The next step is to enable BranchCache on the clients. Again, I'll use Group Policy.
Navigate to Computer Configuration, then Policies, Administrative Templates, Network, BranchCache.
Double-click Turn on BranchCache and set it to Enabled.
Because you're using distributed BranchCache, double-click Set BranchCache Distributed Cache mode and set it to Enabled.
You can also configure the latency required before caching is used. You probably don't want to cache data if the connection is very fast, so you might only cache if the latency is over 70 ms. Double-click Configure BranchCache for network files, set it to Enabled and set the latency. In the example here, I set latency to 0, so everything is cached.
Click to expand.
Note that you can also set the amount of disk space to be used for the cache on clients. The default value is 5 percent. Use the Set percentage of disk space used for client computer cache option to set this value.
Now you need to enable two firewall rules.
Navigate to Computer Configuration then Policies, Windows Settings, Windows Firewall with Advanced Security, Inbound Rules.
Select New Rule from the right-click menu.
Under HTTP, Port, TCP 80, create a rule to allow all profiles (or just a domain, depending on environment). Also create a rule under WS-Discovery, Port, UDP 3702 to allow all profiles (or, again, just a domain), as shown here.
Click to expand.
Close the GPO
At this point, you have a GPO with all the required settings. Make sure the GPO is linked to the client and the client refreshes its policy, either by rebooting or using the command gpupdate /force.
You can check if BranchCache is enabled on a client using the command netsh branchcache show status. You can also directly enable BranchCache using netsh commands such as
netsh branchcache set service mode=distributed
or
netsh branchcache set service mode=hostedclient location=
Related Reading:
Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.
About the Author
You May Also Like