成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

如何在 Ubuntu 22.04 上安裝 Unbound DNS 解析器

系統 Linux
我想向您展示如何在 Ubuntu 22.04 上安裝 Unbound。這可以安裝在 Ubuntu 服務器或桌面上,您將獲得比默認設置顯著的 DNS 解析速度。

Unbound 是一個免費的開源遞歸和驗證 DNS 緩存服務器,它使用 DNS-over-TLS 和 DNS-over-HTTPS 來加密連接。Unbound 比 Bind9 快得多,可以幫助減少網頁和其他需要 DNS 解析的調用的加載時間。Unbound 還支持 DNSSEC 驗證,因此它可以作為您網絡上的信任錨。

我想向您展示如何在 Ubuntu 22.04 上安裝 Unbound。這可以安裝在 Ubuntu 服務器或桌面上,您將獲得比默認設置顯著的 DNS 解析速度。

你需要什么

為此,您唯一需要的是一個正在運行的 Ubuntu 實例——盡管它也可以安裝在基于 RHEL 的發行版上——以及一個具有 sudo 權限的用戶。就是這樣:讓我們加快 DNS 解析速度。

如何安裝 Unbound

幸運的是,在默認存儲庫中找到了 Unbound,因此要安裝它,請登錄到您的 Ubuntu 機器并發出命令:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo apt-get install unbound -y

如果您正在使用基于 RHEL 的發行版,則該安裝將是:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo dnf install unbound -y

如何配置 Unbound

安裝 Unbound 后,我們需要創建一個新的配置文件。使用以下命令創建該文件:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo nano /etc/unbound/unbound.conf.d/myunbound.conf

在該文件中,粘貼以下內容: 您可以編輯上述配置,但要知道它應該按原樣工作。保存并關閉文件。

server:
port: 53
verbosity: 0
num-threads: 2
outgoing-range: 512
num-queries-per-thread: 1024
msg-cache-size: 32m
interface: 0.0.0.0
rrset-cache-size: 64m
cache-max-ttl: 86400
infra-host-ttl: 60
infra-lame-ttl: 120
access-control: 127.0.0.0/8 allow
access-control: 0.0.0.0/0 allow
username: unbound
directory: "/etc/unbound"
logfile: "/var/log/unbound.log"
use-syslog: no
hide-version: yes
so-rcvbuf: 4m
so-sndbuf: 4m
do-ip4: yes
do-ip6: no
do-udp: yes
do-tcp: yes
remote-control:
control-enable: yes
control-port: 953
control-interface: 0.0.0.0

接下來,我們需要使用以下命令為 Unbound 創建一個日志文件:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo touch /var/log/unbound.log

通過以下方式為日志文件提供適當的權限:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo chown unbound:unbound /var/log/unbound.log

最后,使用以下命令啟動 Unbound 服務:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo systemctl enable --now unbound

輸出如下:

Synchronizing state of unbound.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable unbound

如何測試 Unbound

啟動服務后,立即發出命令:

linuxmi@linuxmi:~/www.linuxmi.com$ dig baidu.com @localhost

您應該會看到與此類似的輸出:

; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> baidu.com @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12084
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;baidu.com. IN A
;; ANSWER SECTION:
baidu.com. 600 IN A 220.181.38.148
baidu.com. 600 IN A 220.181.38.251
;; Query time: 630 msec
;; SERVER: 127.0.0.1#53(localhost) (UDP)
;; WHEN: Sun Jun 19 08:57:13 EDT 2022
;; MSG SIZE rcvd: 70

注意查詢時間為 603 毫秒。然后,讓我們再次運行該命令:

注意 108 毫秒的查詢時間。這相當快。但是,讓我們再次運行命令:

linuxmi@linuxmi:~/www.linuxmi.com$ dig baidu.com @localhost

您的查詢時間應該要少得多。我在第二次嘗試時收到了 0 毫秒的查詢時間,在第三次嘗試時還是收到了 0。

恭喜,由于開源的 Unbound DNS 解析器,您的 DNS 查詢現在更快了。如果您選擇,您甚至可以將該服務器用作基于 LAN 的 DNS 服務器。

責任編輯:龐桂玉 來源: Linux公社
相關推薦

2023-09-12 10:23:28

2014-05-06 09:27:54

2022-10-27 10:02:58

UbuntuLinux

2023-04-03 13:01:14

UbuntuCRI-O

2023-07-05 16:45:30

WiresharkLinux

2015-11-30 14:33:36

Intel GraphLinuxUbuntu

2018-10-15 15:23:50

UbuntupipPython

2019-08-30 11:20:28

UbuntuVirtualBoxLinux

2024-01-04 11:50:00

UbuntuDocker

2023-08-08 12:38:52

2019-08-02 15:30:42

UbuntuMongoDB命令

2023-05-27 16:27:25

2013-07-29 13:49:23

UbuntuLAMP服務器

2017-03-29 16:18:11

LinuxUbuntuRedmine

2021-09-11 15:41:55

UbuntuDropbox云服務

2013-07-25 10:00:30

UbuntuVirtualBox

2021-07-12 14:47:16

UbuntuZlib代碼

2015-10-16 10:07:22

Justniffer安裝Ubuntu

2022-06-14 09:33:15

LinuxGNU Emacs命令

2022-07-28 15:10:34

UbuntuDocker
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 在线一区二区三区 | 成人欧美一区二区三区色青冈 | 色婷婷一区二区三区四区 | 黄色一级特级片 | 超碰成人在线观看 | 国产精品久久久久一区二区三区 | 久久av网| 日韩精品四区 | 国产精品成人一区二区三区夜夜夜 | 亚洲黄色av | 国产精品99久久久久久宅男 | 国产aⅴ| 国产精品1区 | 黄频免费 | 国产91在线播放 | 日本久久久久久 | 国产视频中文字幕在线观看 | 在线播放国产一区二区三区 | 丝袜美腿一区二区三区动态图 | 精品日韩一区二区三区 | 亚洲系列第一页 | 性色网站| 久久国产精品一区二区三区 | 91久久精品 | 免费精品视频一区 | 国产三级 | 日韩免费一区二区 | 亚洲精选一区 | 精品免费国产视频 | 麻豆精品久久久 | 在线观看中文字幕视频 | 日本啊v在线 | 天天操网| 久在线 | 亚洲女人天堂成人av在线 | 一区二区在线免费观看视频 | 一区二区三区影院 | 成人午夜精品 | 激情六月丁香 | 亚洲午夜视频 | 中文字幕一区在线观看视频 |