# Architecture and deployment

### Components

[![image-1772786479925.png](https://docs.safedns.com/uploads/images/gallery/2026-03/scaled-1680-/MuD0Wr8fD6cCi4bA-image-1772786479925.png)](https://docs.safedns.com/uploads/images/gallery/2026-03/MuD0Wr8fD6cCi4bA-image-1772786479925.png)

<span class="">SafeDNS Shield is composed of the following components:</span>

- **<span class="">DNS Proxy Module</span>**  
    <span class="">The core filtering engine. It receives DNS requests from end users, identifies the requesting user, applies the configured filtering policy, and returns either the resolved IP address or the IP address of a block page.</span>
- **<span class="">Internal Database</span>**  
    <span class="">Stores all configuration and policy data: user identifiers (subnet, IP, port), filtering profiles, block pages, user groups, and their assignments.</span>
- <span class="">**Block pages**  
    HTTP/S pages served to the users instead of blocked websites. Can be hosted alongside Shield or on an external server.  
    </span>
- **<span class="">REST API</span>**  
    <span class="">Provides a management interface for administrators to update the Internal Database. It supports creation and modification of:</span>
    
    
    - <span class="">User identifiers (subnet, IP, port)</span>
    - <span class="">Filtering profiles (categories to block)</span>
    - <span class="">Block pages</span>
- **<span class="">Binary Log Parsing Module (StatsLoader)</span>**  
    <span class="">Processes the binary log files generated by the DNS Proxy. It parses the DNS query logs, extracts statistics, and sends them to the ClickHouse cluster for storage and analysis.</span>
- **<span class="">ClickHouse Cluster</span>**  
    <span class="">A distributed database for storing and analyzing DNS request statistics. The cluster is divided into shards, each containing multiple mirrored nodes for fault tolerance and high‑performance parallel reads and writes.</span>
    
    
    - **<span class="">Load Balancer</span>**  
        <span class="">Receives statistics data from StatsLoader and distributes it evenly across the ClickHouse cluster nodes.</span>
    - **<span class="">ZooKeeper</span>**  
        <span class="">Manages coordination and configuration of the ClickHouse cluster, ensuring data consistency and system reliability.</span>

<span class="">The DNS Proxy writes its binary query logs to a designated host path (</span>`HostPATH`<span class="">), from which StatsLoader reads them.</span>

**<span class="">External dependencies</span>**  
<span class="">The following elements are not part of SafeDNS Shield but are required for operation:</span>

- **<span class="">User</span>**<span class=""> – The end‑user device that sends DNS requests to SafeDNS Shield.</span>
- **<span class="">Caching DNS Server</span>**<span class=""> – A recursive resolver deployed on the organization’s network that performs upstream DNS resolution for allowed queries.</span>

### Deployment options

SafeDNS Shield supports multiple deployment options to accommodate different network topologies. This section describes the most common scenarios.

##### For ISPs

##### **![](https://docs.safedns.com/uploads/images/gallery/2024-10/qNQmeYymeTxr15Xl-image-1728560145793.png)**

This deployment option is used in ISP networks, where NAT separates end users from the on-premises DNS infrastructure, making it impossible to identify them solely by their individual IP addresses.

<div class="pointer-container" id="bkmrk-%C2%A0"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### For corporate clients  


[![image-1772786346085.png](https://docs.safedns.com/uploads/images/gallery/2026-03/scaled-1680-/eNEcaAFBnndiMMt5-image-1772786346085.png)](https://docs.safedns.com/uploads/images/gallery/2026-03/eNEcaAFBnndiMMt5-image-1772786346085.png)

or

[![image-1772786395390.png](https://docs.safedns.com/uploads/images/gallery/2026-03/scaled-1680-/wUXsLWAApQ8PeBDb-image-1772786395390.png)](https://docs.safedns.com/uploads/images/gallery/2026-03/wUXsLWAApQ8PeBDb-image-1772786395390.png)

This deployment option is used in corporate networks where end users can be identified by their individual IP addresses at the point where SafeDNS Shield is deployed. Depending on whether the organization has its own caching DNS server, requests are forwarded to that server or to an external resolver, such as an ISP’s DNS or a public DNS service (e.g., 1.1.1.1 or 8.8.8.8).

### <span class="">User Identification</span>

**<span class="">User Identification</span>**

<span class="">To apply filtering policies and to separate statistics on a per‑user basis, SafeDNS Shield must identify each end user. Identification is based on the source address of the DNS request and can be configured using one of the following methods:</span>

- **<span class="">IP address</span>**<span class=""> – Use when each user has a unique IP address.</span>
- **<span class="">IP subnet</span>**<span class=""> – Use when per‑user granularity is not required and all users in a subnet can share the same policy.</span>
- **<span class="">IP:port</span>**<span class=""> – Use when multiple users share a single IP address (for example, behind NAT44 or CGNAT). The source port distinguishes individual users.</span>
- **<span class="">IP:port range</span>**<span class=""> – Use when users can be identified by a range of source ports on a shared IP address.</span>

<span class="">The appropriate method depends on the network topology and the level of user separation required.</span>