Its very easy to import a list of domains contained in a file with the pihole
command and xargs
:
Usage: pihole -w [options] <domain> <domain2 ...>
Example: 'pihole -w site.com', or 'pihole -w site1.com site2.com'
Whitelist one or more domains
Options:
-d, --delmode Remove domain(s) from the whitelist
-nr, --noreload Update whitelist without reloading the DNS server
-q, --quiet Make output less verbose
-h, --help Show this help dialog
-l, --list Display all your whitelistlisted domains
--nuke Removes all entries in a list
--comment "text" Add a comment to the domain. If adding multiple domains the same comment will be used for all
pi@ph5b:~ $ nano whitelist.domains.list
domain.1
domain.2
domain.3
pi@ph5b:~ $ xargs < whitelist.domains.list
domain.1 domain.2 domain.3
pi@ph5b:~ $ xargs pihole -w < whitelist.domains.list
[i] Adding domain.1 to the whitelist...
[i] Adding domain.2 to the whitelist...
[i] Adding domain.3 to the whitelist...
[✓] Reloading DNS lists
pi@ph5b:~ $ xargs pihole -w -d < whitelist.domains.list
[i] Removing domain.1 from the whitelist...
[i] Removing domain.2 from the whitelist...
[i] Removing domain.3 from the whitelist...
[✓] Reloading DNS lists
Or from web:
pi@ph5b:~ $ curl -sSL http://localhost/whitelist.domains.list | xargs pihole -w
[i] Adding domain.1 to the whitelist...
[i] Adding domain.2 to the whitelist...
[i] Adding domain.3 to the whitelist...
[✓] Reloading DNS lists