[How-To-Updated 2021] Installing AdGuardHome on OpenWrt [Manual and opkg method]

Do adblock test Test Ad Block - Toolz (d3ward.github.io)

1 Like

I already did. Looks good!

@alandias17 do you have some advice on how to reduce the memory footprint? Is reducing the feeds the only way to save RAM?

I'm using three filters so far https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
https://adaway.org/hosts.txt
https://abp.oisd.nl/basic/

Blocks 95% of ads. Less feeds are better. If you want to reduce memory footprint then you can try caching

1 Like

How do I enable this and which cache size is recommended?
Btw, the Adguardhome Web UI is suddenly there and working after a sysupgrade to latest snapshot :+1 . Version is v0.107.25 .

When a file is read/written, a copy of the data is kept in memory. Depending on your usage patterns, that caching amount will vary. Also, the kernel will decide to throw some if it away, if it needs the memory for something else. You can build your own image and increase the swap memory size

Which file do you mean?

If anyone has a manual AdGuard installation, could you please post the location of the executable and the configuration YAML file, so I don't have to waste time investigating it? Need it to support AdGuardHome in pbr.

basically any file when it's read/written, it gets cached by operating system. If you really want to reduce memory foorprint you must strip out unnecessary modules and functionalities. Otherwise you can try upx to compress binaries

1 Like

@stangri sorry I used luci to install AGH.

1 Like

After installing, cant do opkg update, wget returns 4. What to do?

what's your openwrt version

22.03.3 r20028-43d71ad93e

[OpenWrt Wiki] Failed to download, wget returned 4

In your adguard upstream DNS server on top add following lines,

[/lan/]127.0.0.1:54
[//]127.0.0.1:54
[/pool.ntp.org/]1.1.1.1
[/pool.ntp.org/]1.0.0.1
[/pool.ntp.org/]8.8.8.8
[/pool.ntp.org/]8.8.4.4

Reboot router

1 Like

fixed thanks

okay, i think i need a little more help.
my lan ip is 10.1.1.1
i have set up AGH using your script. i dont intend to use any other dns other than my isp dns.
after setting up AGH, opkg update and other commands that require dns arent working. error is
;; communications error to 127.0.0.1#53: connection refused

internet is working fine everywhere else.

Please post your yaml file.
Did you give default DNS 53 to AGH?

i didnt put the isp dns here, everything else is as is

bind_host: 10.1.1.1
bind_port: 8080
users:
  - name: admin
    password: $2a$10$w5sZRj7c4lirTdtj6PdZx.LfLMU7qAE2L1iwWaiF6ayH2dCLwg7xG
auth_attempts: 5
block_auth_min: 15
http_proxy: ""
language: ""
theme: auto
debug_pprof: false
web_session_ttl: 720
dns:
  bind_hosts:
    - 10.1.1.1
  port: 53
  anonymize_client_ip: false
  protection_enabled: true
  blocking_mode: default
  blocking_ipv4: ""
  blocking_ipv6: ""
  blocked_response_ttl: 10
  parental_block_host: family-block.dns.adguard.com
  safebrowsing_block_host: standard-block.dns.adguard.com
  ratelimit: 20
  ratelimit_whitelist: []
  refuse_any: true
  upstream_dns:
    - 
    - 
  upstream_dns_file: ""
  bootstrap_dns:
    - 9.9.9.10
    - 149.112.112.10
    - 2620:fe::10
    - 2620:fe::fe:10
  all_servers: true
  fastest_addr: false
  fastest_timeout: 1s
  allowed_clients: []
  disallowed_clients: []
  blocked_hosts:
    - version.bind
    - id.server
    - hostname.bind
  trusted_proxies:
    - 127.0.0.0/8
    - ::1/128
  cache_size: 4194304
  cache_ttl_min: 0
  cache_ttl_max: 0
  cache_optimistic: false
  bogus_nxdomain: []
  aaaa_disabled: false
  enable_dnssec: false
  edns_client_subnet:
    custom_ip: ""
    enabled: false
    use_custom: false
  max_goroutines: 300
  handle_ddr: true
  ipset: []
  ipset_file: ""
  filtering_enabled: true
  filters_update_interval: 24
  parental_enabled: false
  safebrowsing_enabled: false
  safebrowsing_cache_size: 1048576
  safesearch_cache_size: 1048576
  parental_cache_size: 1048576
  cache_time: 30
  safe_search:
    enabled: false
    bing: false
    duckduckgo: false
    google: false
    pixabay: false
    yandex: false
    youtube: false
  rewrites: []
  blocked_services: []
  upstream_timeout: 10s
  private_networks: []
  use_private_ptr_resolvers: true
  local_ptr_upstreams: []
  use_dns64: false
  dns64_prefixes: []
  serve_http3: false
  use_http3_upstreams: false
tls:
  enabled: false
  server_name: ""
  force_https: false
  port_https: 443
  port_dns_over_tls: 853
  port_dns_over_quic: 853
  port_dnscrypt: 0
  dnscrypt_config_file: ""
  allow_unencrypted_doh: false
  certificate_chain: ""
  private_key: ""
  certificate_path: ""
  private_key_path: ""
  strict_sni_check: false
querylog:
  enabled: true
  file_enabled: true
  interval: 2160h
  size_memory: 1000
  ignored: []
statistics:
  enabled: true
  interval: 1
  ignored: []
filters:
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt
    name: AdGuard DNS filter
    id: 1
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt
    name: AdAway Default Blocklist
    id: 2
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt
    name: 1Hosts (Lite)
    id: 1679309241
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt
    name: Dan Pollock's List
    id: 1679309242
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt
    name: OISD Blocklist Full
    id: 1679309243
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt
    name: Peter Lowe's Blocklist
    id: 1679309244
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt
    name: Steven Black's List
    id: 1679309245
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt
    name: Perflyst and Dandelion Sprout's Smart-TV Blocklist
    id: 1679309246
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt
    name: Malicious URL Blocklist (URLHaus)
    id: 1679309247
  - enabled: true
    url: https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&showintro=1&mimetype=plaintext
    name: pglyoyo
    id: 1679309849
whitelist_filters:
  - enabled: true
    url: https://dbl.oisd.nl/commonly_whitelisted.php
    name: OISD
    id: 1679309847
user_rules: []
dhcp:
  enabled: false
  interface_name: ""
  local_domain_name: lan
  dhcpv4:
    gateway_ip: ""
    subnet_mask: ""
    range_start: ""
    range_end: ""
    lease_duration: 86400
    icmp_timeout_msec: 1000
    options: []
  dhcpv6:
    range_start: ""
    lease_duration: 86400
    ra_slaac_only: false
    ra_allow_slaac: false
clients:
  runtime_sources:
    whois: true
    arp: true
    rdns: true
    dhcp: true
    hosts: true
  persistent: []
log_file: ""
log_max_backups: 0
log_max_size: 100
log_max_age: 3
log_compress: false
log_localtime: false
verbose: false
os:
  group: ""
  user: ""
  rlimit_nofile: 0
schema_version: 19

Assuming openwrt dns is set to 54 then,

dns:
  bind_hosts:
    - 10.1.1.1
    - 127.0.0.1
  upstream_dns:
    - '[/lan/]127.0.0.1:54'
    - '[//]127.0.0.1:54'
    - '[/pool.ntp.org/]1.1.1.1'
    - '[/pool.ntp.org/]1.0.0.1'
    - '[/pool.ntp.org/]8.8.8.8'
    - '[/pool.ntp.org/]8.8.4.4'

restart agh service

1 Like

right that worked thanks

1 Like