偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

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

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

Unbound 是一個(gè)免費(fèi)的開源遞歸和驗(yàn)證 DNS 緩存服務(wù)器,它使用 DNS-over-TLS 和 DNS-over-HTTPS 來加密連接。Unbound 比 Bind9 快得多,可以幫助減少網(wǎng)頁和其他需要 DNS 解析的調(diào)用的加載時(shí)間。Unbound 還支持 DNSSEC 驗(yàn)證,因此它可以作為您網(wǎng)絡(luò)上的信任錨。

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

你需要什么

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

如何安裝 Unbound

幸運(yùn)的是,在默認(rèn)存儲(chǔ)庫中找到了 Unbound,因此要安裝它,請(qǐng)登錄到您的 Ubuntu 機(jī)器并發(fā)出命令:

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

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

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

如何配置 Unbound

安裝 Unbound 后,我們需要?jiǎng)?chuàng)建一個(gè)新的配置文件。使用以下命令創(chuàng)建該文件:

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

在該文件中,粘貼以下內(nèi)容: 您可以編輯上述配置,但要知道它應(yīng)該按原樣工作。保存并關(guān)閉文件。

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 創(chuàng)建一個(gè)日志文件:

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

通過以下方式為日志文件提供適當(dāng)?shù)臋?quán)限:

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

最后,使用以下命令啟動(dòng) Unbound 服務(wù):

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

如何測(cè)試 Unbound

啟動(dòng)服務(wù)后,立即發(fā)出命令:

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

您應(yīng)該會(huì)看到與此類似的輸出:

; <<>> 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

注意查詢時(shí)間為 603 毫秒。然后,讓我們?cè)俅芜\(yùn)行該命令:

注意 108 毫秒的查詢時(shí)間。這相當(dāng)快。但是,讓我們?cè)俅芜\(yùn)行命令:

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

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

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

責(zé)任編輯:龐桂玉 來源: Linux公社
相關(guān)推薦

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服務(wù)器

2017-03-29 16:18:11

LinuxUbuntuRedmine

2021-09-11 15:41:55

UbuntuDropbox云服務(wù)

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
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)