AdGuardHome (with examples)
As internet users, we are constantly bombarded with advertisements and our online activities are often tracked by various entities. AdGuardHome is a powerful tool that allows us to take control of our network and block ads and tracking at a network-wide level. In this article, we will explore 8 different use cases of AdGuardHome’s command-line interface, along with code examples and explanations for each use case.
Run AdGuard Home
To start using AdGuardHome, we first need to run the application. This can be achieved by simply executing the AdGuardHome
command.
AdGuardHome
Motivation: Running AdGuardHome without any additional arguments starts the application using default settings. This is useful when we want to quickly start blocking ads and tracking on our network without any custom configuration.
Example output:
[info] [service] AdGuardHome started, version=3.7.0
[info] [httpserver] HTTP server started, addr=:3000, tls=false, host=***
Run AdGuard Home with a specific config
AdGuardHome allows us to provide a specific configuration file to customize its behavior. To do so, we can use the --config
flag followed by the path to the configuration file.
AdGuardHome --config /path/to/AdGuardHome.yaml
Motivation: Using a specific config file enables us to fine-tune AdGuardHome to meet our specific needs. We can define custom blocking and whitelisting rules, configure DNS settings, and much more.
Example output:
[info] [service] AdGuardHome started, version=3.7.0
[info] [config] Profiles path: /path/to/AdGuardHome.yaml
Set the work directory for data storage
AdGuardHome needs to store data such as logs, filters, and backups. By default, it uses the current working directory. However, we can change the directory where AdGuardHome stores its data by using the --work-dir
flag followed by the desired directory path.
AdGuardHome --work-dir /path/to/directory
Motivation: Specifying a dedicated directory for AdGuardHome’s data storage allows us to keep our system organized and separate the application’s files from other files in the current working directory.
Example output:
[info] [service] AdGuardHome started, version=3.7.0
[info] [work_dir] Using /path/to/directory as the working directory
Install or uninstall AdGuard Home as a service
AdGuardHome provides the ability to install itself as a service, allowing it to automatically start on system boot. To install or uninstall AdGuardHome as a service, we can use the --service
flag followed by either install
or uninstall
.
AdGuardHome --service install
AdGuardHome --service uninstall
Motivation: Installing AdGuardHome as a service ensures that it is always running in the background, providing uninterrupted ad-blocking and tracking protection even after system restarts.
Example output (for install):
[info] [service] AdGuardHome installed as a service
Start the AdGuard Home service
Once AdGuardHome is installed as a service, it can be started using the --service start
command. This will initiate the AdGuardHome service and enable its ad-blocking and tracking protection capabilities.
AdGuardHome --service start
Motivation: AdGuardHome as a service ensures that it is automatically started and immediately active on system boot, allowing continuous protection against advertisements and tracking.
Example output:
[info] [service] AdGuardHome started as a service
Reload the configuration for the AdGuard Home service
After making changes to the AdGuardHome configuration file, we need to reload the configuration for the service to apply the updated settings. This can be done using the --service reload
command.
AdGuardHome --service reload
Motivation: Reloading the configuration file is necessary when we modify the AdGuardHome settings to ensure that the changes take effect without the need to restart the entire service.
Example output:
[info] [service] Configuration reloaded successfully
Stop or restart the AdGuard Home service
To stop or restart the AdGuardHome service, we can use the --service stop
or --service restart
commands, respectively. Stopping the service temporarily disables ad-blocking and tracking protection, while restarting ensures that changes, if any, are applied.
AdGuardHome --service stop
AdGuardHome --service restart
Motivation: Stopping the service can be useful when troubleshooting or making temporary changes to the system. Restarting the service is required to apply changes that cannot be reloaded using the --service reload
command.
Example output (for stop):
[info] [service] AdGuardHome service stopped
Example output (for restart):
[info] [service] AdGuardHome service restarting
Conclusion
AdGuardHome provides a comprehensive set of command-line options that allow us to customize its behavior and seamlessly integrate it into our network. By exploring the use cases covered in this article, we can make the most out of AdGuardHome’s features and effectively protect ourselves from ads and tracking on a network-wide level.