@TOC

一、参考链接

阿里巴巴开源镜像站:阿里巴巴开源镜像站

DNS安装教程:DNS安装教程

二、DNS简介

域名系统(服务)协议(DNS)是一种分布式网络目录服务,主要用于域名与 IP 地址的相互转换,以及控制因特网的电子邮件的发送。

三、配置方法

Linux 快速配置ipv4

编辑文件 “/etc/resolv.conf”,根据情况修改文件内容。

只需要添加以下两行

nameserver 223.5.5.5
nameserver 223.6.6.6

  1. [root@ecs-kunpeng ~]# vim /etc/resolv.conf
  2. [root@ecs-kunpeng ~]# cat /etc/resolv.conf
  3. # Generated by NetworkManager
  4. search openstacklocal
  5. #nameserver 100.125.1.250
  6. #nameserver 100.125.129.250
  7. options timeout:1 single-request-reopen
  8. nameserver 223.5.5.5
  9. nameserver 223.6.6.6
  10. [root@ecs-kunpeng ~]#

在这里插入图片描述

Linux 快速配置ipv6

编辑文件 “/etc/resolv.conf”,根据情况修改文件内容。

只需要添加以下两行

nameserver 2400:3200::1
nameserver 2400:3200:baba::1

  1. [root@ecs-kunpeng ~]# vim /etc/resolv.conf
  2. [root@ecs-kunpeng ~]# cat /etc/resolv.conf
  3. # Generated by NetworkManager
  4. search openstacklocal
  5. #nameserver 100.125.1.250
  6. #nameserver 100.125.129.250
  7. options timeout:1 single-request-reopen
  8. nameserver 223.5.5.5
  9. nameserver 223.6.6.6
  10. nameserver 2400:3200::1
  11. nameserver 2400:3200:baba::1

保存退出,然后使用 dig 验证:

若显示以下错误信息

  1. [root@ecs-kunpeng ~]# dig alidns.com
  2. -bash: dig: command not found
  3. [root@ecs-kunpeng ~]#
  4. [root@ecs-kunpeng ~]# yum provides dig
  5. bind-utils-32:9.11.26-4.el8_4.aarch64 : Utilities for querying DNS name servers
  6. Repo : AppStream
  7. Matched from:
  8. Filename : /usr/bin/dig

使用yum源安装bind-utils-32:9.11.26-4.el8_4.aarch64组件

  1. [root@ecs-kunpeng ~]# yum install -y bind-utils-32:9.11.26-4.el8_4.aarch64
  2. CentOS-8 - AppStream 44 kB/s | 4.3 kB 00:00
  3. CentOS-8 - Base 40 kB/s | 3.9 kB 00:00
  4. CentOS-8 - Extras 15 kB/s | 1.5 kB 00:00
  5. Extra Packages for Enterprise Linux Modular 8 - aarch64 28 kB/s | 3.0 kB 00:00
  6. Extra Packages for Enterprise Linux 8 - aarch64 47 kB/s | 4.7 kB 00:00
  7. Dependencies resolved.
  8. ========================================================================================================================
  9. Package Architecture Version Repository Size
  10. ========================================================================================================================
  11. Installing:
  12. bind-utils aarch64 32:9.11.26-4.el8_4 AppStream 445 k
  13. Installing dependencies:
  14. bind-libs aarch64 32:9.11.26-4.el8_4 AppStream 169 k
  15. bind-libs-lite aarch64 32:9.11.26-4.el8_4 AppStream 1.1 M
  16. bind-license noarch 32:9.11.26-4.el8_4 AppStream 102 k
  17. fstrm aarch64 0.6.0-3.el8.1 AppStream 27 k
  18. protobuf-c aarch64 1.3.0-6.el8 AppStream 37 k
  19. python3-bind noarch 32:9.11.26-4.el8_4 AppStream 149 k
  20. Transaction Summary
  21. ========================================================================================================================
  22. Install 7 Packages
  23. Total download size: 2.0 M
  24. Installed size: 5.4 M
  25. Downloading Packages:
  26. (1/7): bind-license-9.11.26-4.el8_4.noarch.rpm 714 kB/s | 102 kB 00:00
  27. (2/7): bind-libs-lite-9.11.26-4.el8_4.aarch64.rpm 6.7 MB/s | 1.1 MB 00:00
  28. (3/7): fstrm-0.6.0-3.el8.1.aarch64.rpm 892 kB/s | 27 kB 00:00
  29. (4/7): bind-utils-9.11.26-4.el8_4.aarch64.rpm 7.9 MB/s | 445 kB 00:00
  30. (5/7): protobuf-c-1.3.0-6.el8.aarch64.rpm 1.2 MB/s | 37 kB 00:00
  31. (6/7): python3-bind-9.11.26-4.el8_4.noarch.rpm 5.0 MB/s | 149 kB 00:00
  32. (7/7): bind-libs-9.11.26-4.el8_4.aarch64.rpm 714 kB/s | 169 kB 00:00
  33. ------------------------------------------------------------------------------------------------------------------------
  34. Total 8.3 MB/s | 2.0 MB 00:00
  35. Running transaction check
  36. Transaction check succeeded.
  37. Running transaction test
  38. Transaction test succeeded.
  39. Running transaction
  40. Preparing : 1/1
  41. Installing : protobuf-c-1.3.0-6.el8.aarch64 1/7
  42. Installing : fstrm-0.6.0-3.el8.1.aarch64 2/7
  43. Installing : bind-license-32:9.11.26-4.el8_4.noarch 3/7
  44. Installing : bind-libs-lite-32:9.11.26-4.el8_4.aarch64 4/7
  45. Installing : bind-libs-32:9.11.26-4.el8_4.aarch64 5/7
  46. Installing : python3-bind-32:9.11.26-4.el8_4.noarch 6/7
  47. Installing : bind-utils-32:9.11.26-4.el8_4.aarch64 7/7
  48. Running scriptlet: bind-utils-32:9.11.26-4.el8_4.aarch64 7/7
  49. Verifying : bind-libs-32:9.11.26-4.el8_4.aarch64 1/7
  50. Verifying : bind-libs-lite-32:9.11.26-4.el8_4.aarch64 2/7
  51. Verifying : bind-license-32:9.11.26-4.el8_4.noarch 3/7
  52. Verifying : bind-utils-32:9.11.26-4.el8_4.aarch64 4/7
  53. Verifying : fstrm-0.6.0-3.el8.1.aarch64 5/7
  54. Verifying : protobuf-c-1.3.0-6.el8.aarch64 6/7
  55. Verifying : python3-bind-32:9.11.26-4.el8_4.noarch 7/7
  56. Installed:
  57. 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
  58. 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
  59. python3-bind-32:9.11.26-4.el8_4.noarch
  60. Complete!
  61. [root@ecs-kunpeng ~]#

使用 dig 验证

若返回结果的 server 为阿里公共 DNS,则配置成功。

  1. [root@ecs-kunpeng ~]# dig alidns.com
  2. ; <<>> DiG 9.11.26-RedHat-9.11.26-4.el8_4 <<>> alidns.com
  3. ;; global options: +cmd
  4. ;; Got answer:
  5. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57868
  6. ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
  7. ;; QUESTION SECTION:
  8. ;alidns.com. IN A
  9. ;; ANSWER SECTION:
  10. alidns.com. 120 IN A 203.119.175.226
  11. ;; Query time: 12 msec
  12. ;; SERVER: 223.5.5.5#53(223.5.5.5)
  13. ;; WHEN: Fri Dec 03 23:29:35 CST 2021
  14. ;; MSG SIZE rcvd: 44
  15. [root@ecs-kunpeng ~]#

更多相关文章

  1. Kubernetes 使用kubeadm创建集群
  2. 【阿里云镜像】使用阿里云Docker CE 镜像安装Docker
  3. webpack 配置文件webpack.config.js
  4. webpack 中使用 axios 方法总结及初识 vue
  5. 使用阿里云composer镜像加速
  6. 如何在 Ubuntu 20.04 上添加交换空间
  7. Java基于BIO实现文件上传功能
  8. Manjaro Linux 入门使用教程
  9. 模拟数组pop,push,toString和冒泡排序(sort的使用)

随机推荐

  1. 5 分钟开发一个 AI 检测人体框架的 App
  2. Android_selector背景选择器的用法
  3. android开发笔记之android studio
  4. Android 控件(button)对齐方法实现详解
  5. Epoxy——RecyclerView的绝佳助手
  6. Android中的单任务模式
  7. Kotlin 写 Android 单元测试(四),Robolectri
  8. android 桌面小工具(Widget)开发教程
  9. Android夸进程通信机制九:AIDL深入了解
  10. Android 智能手机开发概述