@TOC
一、参考链接
阿里巴巴开源镜像站:阿里巴巴开源镜像站
DNS安装教程:DNS安装教程
二、DNS简介
域名系统(服务)协议(DNS)是一种分布式网络目录服务,主要用于域名与 IP 地址的相互转换,以及控制因特网的电子邮件的发送。
三、配置方法
Linux 快速配置ipv4
编辑文件 “/etc/resolv.conf”,根据情况修改文件内容。
只需要添加以下两行
nameserver 223.5.5.5
nameserver 223.6.6.6
[root@ecs-kunpeng ~]# vim /etc/resolv.conf[root@ecs-kunpeng ~]# cat /etc/resolv.conf# Generated by NetworkManagersearch openstacklocal#nameserver 100.125.1.250#nameserver 100.125.129.250options timeout:1 single-request-reopennameserver 223.5.5.5nameserver 223.6.6.6[root@ecs-kunpeng ~]#
Linux 快速配置ipv6
编辑文件 “/etc/resolv.conf”,根据情况修改文件内容。
只需要添加以下两行
nameserver 2400:3200::1
nameserver 2400:3200:baba::1
[root@ecs-kunpeng ~]# vim /etc/resolv.conf[root@ecs-kunpeng ~]# cat /etc/resolv.conf# Generated by NetworkManagersearch openstacklocal#nameserver 100.125.1.250#nameserver 100.125.129.250options timeout:1 single-request-reopennameserver 223.5.5.5nameserver 223.6.6.6nameserver 2400:3200::1nameserver 2400:3200:baba::1
保存退出,然后使用 dig 验证:
若显示以下错误信息
[root@ecs-kunpeng ~]# dig alidns.com-bash: dig: command not found[root@ecs-kunpeng ~]#[root@ecs-kunpeng ~]# yum provides digbind-utils-32:9.11.26-4.el8_4.aarch64 : Utilities for querying DNS name serversRepo : AppStreamMatched from:Filename : /usr/bin/dig
使用yum源安装bind-utils-32:9.11.26-4.el8_4.aarch64
组件
[root@ecs-kunpeng ~]# yum install -y bind-utils-32:9.11.26-4.el8_4.aarch64CentOS-8 - AppStream 44 kB/s | 4.3 kB 00:00CentOS-8 - Base 40 kB/s | 3.9 kB 00:00CentOS-8 - Extras 15 kB/s | 1.5 kB 00:00Extra Packages for Enterprise Linux Modular 8 - aarch64 28 kB/s | 3.0 kB 00:00Extra Packages for Enterprise Linux 8 - aarch64 47 kB/s | 4.7 kB 00:00Dependencies resolved.======================================================================================================================== Package Architecture Version Repository Size========================================================================================================================Installing: bind-utils aarch64 32:9.11.26-4.el8_4 AppStream 445 kInstalling dependencies: bind-libs aarch64 32:9.11.26-4.el8_4 AppStream 169 k bind-libs-lite aarch64 32:9.11.26-4.el8_4 AppStream 1.1 M bind-license noarch 32:9.11.26-4.el8_4 AppStream 102 k fstrm aarch64 0.6.0-3.el8.1 AppStream 27 k protobuf-c aarch64 1.3.0-6.el8 AppStream 37 k python3-bind noarch 32:9.11.26-4.el8_4 AppStream 149 kTransaction Summary========================================================================================================================Install 7 PackagesTotal download size: 2.0 MInstalled size: 5.4 MDownloading Packages:(1/7): bind-license-9.11.26-4.el8_4.noarch.rpm 714 kB/s | 102 kB 00:00(2/7): bind-libs-lite-9.11.26-4.el8_4.aarch64.rpm 6.7 MB/s | 1.1 MB 00:00(3/7): fstrm-0.6.0-3.el8.1.aarch64.rpm 892 kB/s | 27 kB 00:00(4/7): bind-utils-9.11.26-4.el8_4.aarch64.rpm 7.9 MB/s | 445 kB 00:00(5/7): protobuf-c-1.3.0-6.el8.aarch64.rpm 1.2 MB/s | 37 kB 00:00(6/7): python3-bind-9.11.26-4.el8_4.noarch.rpm 5.0 MB/s | 149 kB 00:00(7/7): bind-libs-9.11.26-4.el8_4.aarch64.rpm 714 kB/s | 169 kB 00:00------------------------------------------------------------------------------------------------------------------------Total 8.3 MB/s | 2.0 MB 00:00Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing : 1/1 Installing : protobuf-c-1.3.0-6.el8.aarch64 1/7 Installing : fstrm-0.6.0-3.el8.1.aarch64 2/7 Installing : bind-license-32:9.11.26-4.el8_4.noarch 3/7 Installing : bind-libs-lite-32:9.11.26-4.el8_4.aarch64 4/7 Installing : bind-libs-32:9.11.26-4.el8_4.aarch64 5/7 Installing : python3-bind-32:9.11.26-4.el8_4.noarch 6/7 Installing : bind-utils-32:9.11.26-4.el8_4.aarch64 7/7 Running scriptlet: bind-utils-32:9.11.26-4.el8_4.aarch64 7/7 Verifying : bind-libs-32:9.11.26-4.el8_4.aarch64 1/7 Verifying : bind-libs-lite-32:9.11.26-4.el8_4.aarch64 2/7 Verifying : bind-license-32:9.11.26-4.el8_4.noarch 3/7 Verifying : bind-utils-32:9.11.26-4.el8_4.aarch64 4/7 Verifying : fstrm-0.6.0-3.el8.1.aarch64 5/7 Verifying : protobuf-c-1.3.0-6.el8.aarch64 6/7 Verifying : python3-bind-32:9.11.26-4.el8_4.noarch 7/7Installed: bind-utils-32:9.11.26-4.el8_4.aarch64 bind-libs-32:9.11.26-4.el8_4.aarch64 bind-libs-lite-32:9.11.26-4.el8_4.aarch64 bind-license-32:9.11.26-4.el8_4.noarch fstrm-0.6.0-3.el8.1.aarch64 protobuf-c-1.3.0-6.el8.aarch64 python3-bind-32:9.11.26-4.el8_4.noarchComplete![root@ecs-kunpeng ~]#
使用 dig 验证
若返回结果的 server 为阿里公共 DNS,则配置成功。
[root@ecs-kunpeng ~]# dig alidns.com; <<>> DiG 9.11.26-RedHat-9.11.26-4.el8_4 <<>> alidns.com;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57868;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0;; QUESTION SECTION:;alidns.com. IN A;; ANSWER SECTION:alidns.com. 120 IN A 203.119.175.226;; Query time: 12 msec;; SERVER: 223.5.5.5#53(223.5.5.5);; WHEN: Fri Dec 03 23:29:35 CST 2021;; MSG SIZE rcvd: 44[root@ecs-kunpeng ~]#