Bind-DLZ + Django + Mysql DNS管理平台
系统环境:CentOS 7.6 X64
软件版本:
1 | bind-9.11.6.tar.gz |
一.源码安装配置Bind:
1 | yum -y install make gcc-c++ cmake bison-devel ncurses-devel python-devel python-ply bind-utils |
1.用户添加授权目录
1 | mkdir -p /usr/local/bind/var/{logs,zones} |
2.配置Bind
# 配置主服务器
1 | vim /usr/local/bind/etc/named.conf # 主 |
# 配置从服务器
1 | vim /usr/local/bind/etc/named.conf # 从 |
# 启动脚本
1 | vim /etc/systemd/system/named.service |
# 启动命令
1 | systemctl daemon-reload |
二.配置Bind-Web 管理平台
1.获取代码
1 | git clone https://github.com/ymx8383521/Bind-Web.git #git 克隆下来 |
2.数据库配置
1 | 1.) CREATE DATABASE db_ops CHARACTER SET utf8 COLLATE utf8_general_ci; #创建数据库 |
三. 针对已有数据库的操作
##### # 把新生成的models.py放到app目录下
1 | python manage.py inspectdb > models.py #需要修改managed = True |
# 数据库构
1 | create table `t_dns_records` ( |
四.Bind-Web使用
参考:http://wiki.vknow.com/display/yunwei/bind
slave配置zone
1
2
3
4
5
6zone "php.com." in {
type slave;
file "zones/php.com";
masterfile-format text;
masters{ 172.28.10.60; };
};Bind-Web平台上操作,首先要创建SOA记录和NS记录
1
2
3
4
5
6
7
8
9select * from t_dns_records limit 3;
+----+-----------+------+------+------------- -+-----+-------------+---------+-------+--------+---------+------------+-------------+------------+--------+---------------------+---------------------+ | id | zone | host | type | data | ttl | mx_priority | refresh | retry | expire | minimum | serial | resp_person | primary_ns | status | created_at | updated_at | +----+-----------+------+------+---------------+-----+-------------+---------+-------+--------+---------+------------+-------------+------------+--------+---------------------+---------------------+ | 1 | baidu.com | @ | NS | ns.baidu.com. | 60 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 1 | 2019-07-01 11:02:14 | 2019-07-11 19:10:54 | | 2 | baidu.com | @ | SOA | ns | 60 | NULL | 300 | 3000 | 86400 | 86400 | 1562898308 | admin | NULL | 1 | 2019-07-01 11:02:28 | 2019-07-12 10:25:12 | | 3 | baidu.com | xxxx | A | 172.20.10.72 | 60 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 1 | 2019-07-01 11:05:44 | 2019-07-11 19:10:54 | +----+-------- --+------+------+---------------+-----+-------------+---------+-------+--------+---------+------------+-------------+------------+--------+---------------------+---------------------+
select * from t_dns_xfr_table limit 1;
+----+-----------+--------------+--------+---------------------+---------------------+
| id | zone | client | status | created_at | updated_at |
+----+-----------+--------------+--------+---------------------+---------------------+
| 1 | baidu.com | 172.20.10.61 | 1 | 2019-07-01 11:01:46 | 2019-07-01 11:01:46 |
+----+-----------+--------------+--------+---------------------+---------------------+原文链接: