Skip to content

Instantly share code, notes, and snippets.

@f9n
Last active April 16, 2024 01:38
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save f9n/3c4453489820f150c81bdf2f1ccd9516 to your computer and use it in GitHub Desktop.
Save f9n/3c4453489820f150c81bdf2f1ccd9516 to your computer and use it in GitHub Desktop.
Unbound Cheat Sheet

Unbound Cheat Sheet

Installation

$ yum install -y unbound

Setup SSL keys for unbound-control

$ unbound-control-setup

Configuration File

server:
    interface 0.0.0.0
    do-ip4: yes
    do-udp: yes
    do-tcp: yes
    logfile: /var/log/unbound
    access-control: 0.0.0.0/0 allow
    
    local-zone: "trabzon." static
    local-data: "of.trabzon IN A 192.168.0.61"
    local-data: "macka.trabzon IN A 192.168.0.100"
    # ping of.trabzon
    # ping macka.trabzon

forward-zone:
    name: "."
    forward-addr: 8.8.8.8
    forward-addr: 8.8.4.4

Verify configuration

$ unbound-checkconf

Unbound Status

$ unbound-control status

List Forwards

$ unbound-control list_forwards

Lookup on Cache

$ unbound-control lookup youtube.com

Dump Cache

$ unbound-control dump_cache > dns-cache.txt

Restore Cache

$ unbound-control load_cache < dns-cache.txt

Flush Cache

$ # Flush Specific Host
$ unbound-control flush www.youtube.com
$ # Flush everything
$ unbound-control flush_zone .
@YG-UK
Copy link

YG-UK commented Feb 21, 2023

Thanks, helpful! Small typo on "Lookup on Cache" section (unbound-contral)

@pedropombeiro
Copy link

In Restore Cache, the command should be unbound-control load_cache < dns-cache.txt.

@f9n
Copy link
Author

f9n commented Apr 4, 2023

Thanks. 👑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment