linux 搭建一台自己的DNS服务器

linux系统版本:Ubuntu
输入cat /etc/issue即可查看

  1. 更新系统
sudo apt-get update
sudo apt-get upgrade
  1. 安装bind9
sudo apt-get install bind9
  1. 更改配置文件named.conf
// 其他信息都注释掉
include "/etc/bind/named.conf.options";
zone "example.com" IN {
        type master;
        file "/etc/bind/ns1.example.com.zone";
};

  1. 创建域文件
vim /etc/bind/ns1.example.com.zone
#/etc/bind/ns1.example.com.zone
//SOA并不是很重要
@  IN  SOA ns1.example.com. example.com. (
       20240613
       21600
       3600
       604800
       86400 )
// @表示本机
@    IN    NS    ns1.example.com.	// 末尾的.一定要加上,不然会解析错误
ns1.example.com.		IN		A		1.2.3.4 //你想要的IP

  1. 更新named.cond.options
vim /etc/bind/named.conf.options
//没有的都注释掉
options {
        directory "/var/cache/bind";

        dnssec-validation auto;
        recursion no;
        allow-transfer { none; };
        auth-nxdomain no;

        listen-on-v6 { any; };
        allow-query { any; };
};

  1. 重启named
sudo systemctl restart named
  1. 测试能够正确解析
dig ns1.example.com

相关推荐

  1. linux 自己DNS服务器

    2024-06-17 07:34:04       35 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-17 07:34:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-17 07:34:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-06-17 07:34:04       82 阅读
  4. Python语言-面向对象

    2024-06-17 07:34:04       91 阅读

热门阅读

  1. [AIGC] 选择LeetCode刷题的编程语言

    2024-06-17 07:34:04       34 阅读
  2. 比特币通用API服务

    2024-06-17 07:34:04       27 阅读
  3. Flink Watermark详解

    2024-06-17 07:34:04       26 阅读
  4. 矩阵补全IGMC 学习笔记

    2024-06-17 07:34:04       24 阅读
  5. ComfyUI

    ComfyUI

    2024-06-17 07:34:04      24 阅读
  6. 外键的基本概念

    2024-06-17 07:34:04       25 阅读
  7. C++多态

    2024-06-17 07:34:04       27 阅读
  8. 面试计算机网络八股文十问十答第九期

    2024-06-17 07:34:04       32 阅读
  9. linux发行版CentOS、Debian和Ubuntu的对比

    2024-06-17 07:34:04       26 阅读
  10. 按键精灵的自动q语言连接mysql

    2024-06-17 07:34:04       21 阅读
  11. LeetCode --- 2073. Time Needed to Buy Tickets 解题报告

    2024-06-17 07:34:04       25 阅读
  12. ES6-04-模块化的暴露:export关键字

    2024-06-17 07:34:04       33 阅读
  13. ActiViz中不规则网络数据体绘制技术介绍

    2024-06-17 07:34:04       28 阅读
  14. C# OpenCvSharp 图像处理函数-颜色通道-cvtColor

    2024-06-17 07:34:04       31 阅读