Mac Mini and iOS Caching Server for Wifi

So if you have a Wifi network and the updates to iOS devices flood your network with traffic as all the iOS devices try to talk to the internet at the same time, then this is for you, the solution requires you have a Mac Mini or any Apple hardware - please note there are mixed results with VM's virtualised as a Mac

Navigate to System Preferences from the Apple icon then choose "Sharing"....



Once here choose Content Caching, put a tick in the box for that....

Then to the right there will be some options, first you can untick the sharing of the internet connection that is silly, then in the cache section you have some options, I have only shared content.....read on really....


This is where it gets weird, the Apple definitions are horrible so lets go though them:

All content : This caches everything from personal iCloud data to Music to Photos to iOS Updates to Apple Music - unless you wish to host all the apple cloud internally do not choose this options

Only Shared Content : This will only cache shared content, which is defined as iOS updates which applies to all Apple devices but its only the OS and iPhone updates - this is our option in this example.

Only iCloud content : This will cache anything sent to icloud not in the shared update, aka OS updates or iOS updates, this is a crazy option to enable unless you have a 300PB NAS


With all content - the 512GB SSD filled up in 4 hours and the solution failed, so just be careful, anyway moving along to Storage options under advanced, I have allowed 350GB of updates and with the shared content only selected you can see there is only 44 bytes from iCloud - in about 8 months - nice.


Now on to clients settings this is where you put your Wifi network that you would like the content caching to serve updates to locally not via the internet, please note the apple devices needs to be on the same VLAN or subnet as the Wifi access points, if not this will not work.


Then we have peers, so the best option here is "content caches using the same local networks" unless you have one huge network and you can choose any from this list......


Then you have the parents, which are in Windows terms upstream servers that you need to use before or after this caching server, for this example we do not use parent servers, but if you have another server to take updates from enter it here......


Then finally enable remote management using SSH, so you can connect to the Mac Mini via SSH, this is completed with the "remote login" option as you can see here, you will require full disk access to manage it remotely.


Right, its now live but you need iOS or Mac OS updates to be downloaded for the first time, then the server will cache the update so the next device will talk to the cache not the internet, this therefore does not mean its "works immediately" also it needs to register on the network, which we will explore now.

Shell management : AssetCacheManagerUtil
Caching server location status: AssetCacheLocatorUtil

AssetCacheManagerUtil

This is the tool for management these are the options you get from the tool:

2022-02-09 16:52:16.412 AssetCacheManagerUtil[2579:30595688] Commands are:
    activate
    deactivate
    isActivated
    canActivate
    flushCache
    flushPersonalCache
    flushSharedCache
    status
    settings
    reloadSettings
    moveCacheTo path
    absorbCacheFrom

Many of these are self explanatory, but the "settings" covers the settings you set in the GUI, but this confirms the settings, however the "status" is the one that confirms it workload and status:

AssetCacheManagerUtil status

This will return a long list of variables, all which is very helpful in fixing issues, the commands in bold show the network registration status of the caching server and the ones its italics are the data and performance.

Content caching status:
    Activated: true
    Active: true
    CacheDetails: (4)
        iCloud: Zero KB
        iOS Software: 109.09 GB
        Mac Software: 70.43 GB
        Other: 168.76 GB
    CacheFree: 1.71 GB
    CacheLimit: 350 GB
    CacheStatus: OK
    CacheUsed: 348.29 GB
    MaxCachePressureLast1Hour: 0%
    Parents: (none)
    Peers: (none)
    PersonalCacheFree: 102.65 GB
    PersonalCacheLimit: 350 GB
    PersonalCacheUsed: 44 bytes
    RegistrationStatus: 1
    StartupStatus: OK
    TotalBytesDropped: 8.3 MB
    TotalBytesImported: 29.3 GB
    TotalBytesReturnedToChildren: Zero KB
    TotalBytesReturnedToClients: 4.56 TB
    TotalBytesReturnedToPeers: Zero KB
    TotalBytesStoredFromOrigin: 555.9 GB
    TotalBytesStoredFromParents: Zero KB
    TotalBytesStoredFromPeers: Zero KB

This is what I find very effeciant, we have downloaded 555GB and have serves 4.56TB to clients, whe this was added iOS 15.2 and 15.3 had just come out (in the timeframe of the logs) so this is an amazing bandwidth saving.

TotalBytesReturnedToClients: 4.56 TB
TotalBytesStoredFromOrigin: 555.9 GB