Windows BranchCache (Hosted and Distributed)

KB ID 0001212 

Problem

The purpose of BranchCache is, (as the name implies) to cache files in branch sites, without the need for a local file server or DFS. There are essentially two deployment models, In Hosted Mode a server in the branch caches the files locally as they are requested by clients.

BranchCache Hosted

This works because the main file server provides a hash of the requested file, the branch server will download it, and if another client asks for the same file it can check the hash on it’s local copy to see if it’s been updated, if not it serves the file locally without the need to be downloaded again. As the branch connections are typically slower, this makes things a lot more efficient.

Note: You cannot deploy BranchCache on a RODC domain controller.

But what if there is no server onsite? Then you can use Distributed Mode, where every client can download and cache a copy, then the clien’s serve the files to each other.

Distributed BranchCache Mode

Solution

Deploy The Main Office BranchCache File Server.

BrachCache for Network Files is a server role, select it and complete the Wizard.

 Install Branch Cache

You can carry out the following procedure with domain group policy, but it’s just as easy to setup in local group policy, on the file server. Windows Key + R > gpedit.msc > Computer Configuration > Administrative Templates > Network > Lanman Server > Hash Publication for Branch Cache.

Branch Cache Hash

Enable the policy and set to Allow hash publication for all  share folders > Apply  > OK.

Allow Branch Cache Hash

Note: You have enabled Hashing for ‘All shares ‘so the next step is a moot point. If you selected ‘Allow hash publication only for shared folders on which BrancCache is enabled’, then you would definitely need to do the following!

Now on the ‘Shares’ select the caching option.

Enable Branch Cache Share

Enable BranchCache.

Enable Branch Cache Folder

Now I’ve created a Domain Group Policy called ‘BranchCache Firewall Policy’. Because to serve files you need to enable a couple of pre-configured firewall rules.

Computer Configuration > Policies > Windows Settings > Security Settings > Windows Firewall with Advanced Security > Inbound Rules > Add Rule.

006 - GPO Branchcache Firewall Settings

Enable the pre-configured rule for ‘BranchCache – Content Retrieval (Uses HTTP).

Firewall BranchCache Settings

Repeat the procedure and also add a rule for ‘BrachCache – Peer Discovery (Uses WSD)’.

Firewall BranchCache Peer Discovery

Deploy The Branch Office ‘Hosted BranchCache’ Server.

Just as you did at the main office, install the ‘Brach Cache for Network Files’ Role.

Firewall BranchCache Branch Server Role

But this time install the additional BrachCache Server Feature.

010 - Firewall BranchCache Branch Server feature

The server will be serving files, so link the ‘BranchCache Firewall Policy‘ to the OU that contains the branch server. Then to start it servicing files, issue the following command;

Enable-BCHostedServer -RegisterSCP

To make sure it’s running;

Get-BCStatus

Ensure ContentServerIsEnabled has been set to ‘True‘.

Enable BranchCache Branch Server

If you scroll to the bottom of the output, you can see where the cache is going to live, and what ‘percent’ of the drive size it can grow to. You can change these two values.

BranchCache File Location and Cache Size

To Move BrachCache Folder Location

In this example I’ve got a volume on my Branch server, and I’ve created a folder on there to store my cached files in.

BranchCache Folder

Set-BCCache -MoveTo {Drive:)\{Folder}

To Change BrachCache Drive Percentage

Set-BCCache -Percentage {Percent}

Move BranchCache Folder Change Percentage

BranchCache Configure Client PC’s (For Hosted Mode)

Create a new policy and link it to the OU that your branch client PC’s are in.

BranchCache Configure Client PC GPO

Edit it.

Edit BranchCache Client PC GPO

Navigate to;

Computer Configuration > Policies > Administrative Templates > Network > BranchCache.

018 - Enable BranchCache on branch pc's

Policy: Turn on Branch Cache: Enabled.

Enable BranchCache Policy

Policy: Enable Automatic Hosted Cache Discovery by Service Connection Point: Enabled.

Hosted Cache Discovery by Service Connection Point

To test, (after the policy had been applied/refreshed). On a client PC issue the following command;

netsh branchcache show status all

Ensure current status is ‘running’.

Test BranchCache on Client

BranchCache Configure Client PC’s (For Distributed Mode)

If your client machines are going to serve BranchCache files, you will need to link the ‘BrachCache Firewall Policy‘ you created above to the OU that contains the client PC’s in the branch site.

Create a new policy and link it to the OU that your branch client PC’s are in.

BranchCache Configure Client PC GPO

Edit it.

Edit BranchCache Client PC GPO

Navigate to;

Computer Configuration > Policies > Administrative Templates > Network > BranchCache.

018 - Enable BranchCache on branch pc's

Policy: Turn on Branch Cache: Enabled.

Enable BranchCache Policy

Policy: Set BranchCache Distributed Cache Mode: Enabled.

Distributed BranchCache on Client

Policy: Configure BranchCache for network files: Enabled.

Policy: Maximum round trip network latency: 0 (zero)

Distributed BranchCache GPO on Client

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

2 Comments

  1. you mention that “Note: You cannot deploy BranchCache on a writable domain controller.” Does that mean you can deploy branchcache host on a RODC?

    Post a Reply
    • Yes thanks Peter – to much coffee!

      Post a Reply

Leave a Reply to PeteLong Cancel reply

Your email address will not be published. Required fields are marked *