Skip to content

Instantly share code, notes, and snippets.

@kjdavidson
Forked from f9n/unbound-cheat-sheet.md
Created May 30, 2024 07:45
Show Gist options
  • Save kjdavidson/3a7493df5321e54ced6dab511373fa02 to your computer and use it in GitHub Desktop.
Save kjdavidson/3a7493df5321e54ced6dab511373fa02 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 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment