Skip navigation

Q. How do I enable BranchCache?

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.

  1. Open a Group Policy Object.
  2. Navigate to Computer Configuration, then Policies, Administrative Templates, Network, Lanman Server.
  3. Double-click Hash Publication for BranchCache.
  4. 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.
  5. 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

  1. Right-click the shared folder in Explorer and select Properties.
  2. Select the Sharing tab.
  3. Click the Advanced Sharing button.
  4. Click the Caching button.
  5. Check the Enable BranchCache option, as shown here, and click OK to close all dialogs.
  6. 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.

  1. Navigate to Computer Configuration, then Policies, Administrative Templates, Network, BranchCache.
  2. Double-click Turn on BranchCache and set it to Enabled.
  3. Because you're using distributed BranchCache, double-click Set BranchCache Distributed Cache mode and set it to Enabled.
  4. 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.

  5. 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.

  1. Navigate to Computer Configuration then Policies, Windows Settings, Windows Firewall with Advanced Security, Inbound Rules.
  2. Select New Rule from the right-click menu.
  3. 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.

  4. 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.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish