[20161221]快速建立dns服务器.txt

简介: [20161221]快速建立dns服务器.txt --建立dns对我来讲如同噩梦,我记得以前当开始学linux时就配置过一次,里面参数我根本不熟悉,而且是看这一本书做的,那本书存在印刷 --错误,导致自己调式遇到许多问题.所以我对dns的配置一直有点心理上害怕。

[20161221]快速建立dns服务器.txt

--建立dns对我来讲如同噩梦,我记得以前当开始学linux时就配置过一次,里面参数我根本不熟悉,而且是看这一本书做的,那本书存在印刷
--错误,导致自己调式遇到许多问题.所以我对dns的配置一直有点心理上害怕。

--而11Grac需要一个dns,学习一些配置dns非常必要,昨天我重新看了文档,先学习一个简单的配置就是使用dnsmasq软件包.感觉它很简单.

1.环境:

# cat /etc/issue
Oracle Linux Server release 5.9
Kernel \r on an \m

# rpm -qil dnsmasq
Name        : dnsmasq                      Relocations: (not relocatable)
Version     : 2.45                              Vendor: Oracle USA
Release     : 1.1.el5_3                     Build Date: Tue 01 Sep 2009 09:27:24 AM CST
Install Date: Fri 29 Aug 2014 09:30:39 PM CST      Build Host: ca-build9.us.oracle.com
Group       : System Environment/Daemons    Source RPM: dnsmasq-2.45-1.1.el5_3.src.rpm
Size        : 358490                           License: GPL
Signature   : DSA/SHA1, Tue 01 Sep 2009 09:27:36 AM CST, Key ID 66ced3de1e5e0159
URL         : http://www.thekelleys.org.uk/dnsmasq/
Summary     : A lightweight DHCP/caching DNS server
Description :
Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
It is designed to provide DNS and, optionally, DHCP, to a small network.
It can serve the names of local machines which are not in the global
DNS. The DHCP server integrates with the DNS server and allows machines
with DHCP-allocated addresses to appear in the DNS with names configured
either in each host or in a central configuration file. Dnsmasq supports
static and dynamic DHCP leases and BOOTP for network booting of diskless
machines.
/etc/dnsmasq.conf
/etc/dnsmasq.d
/etc/rc.d/init.d/dnsmasq
/usr/sbin/dnsmasq
/usr/share/doc/dnsmasq-2.45
/usr/share/doc/dnsmasq-2.45/CHANGELOG
/usr/share/doc/dnsmasq-2.45/COPYING
/usr/share/doc/dnsmasq-2.45/DBus-interface
/usr/share/doc/dnsmasq-2.45/FAQ
/usr/share/doc/dnsmasq-2.45/doc.html
/usr/share/doc/dnsmasq-2.45/setup.html
/usr/share/man/man8/dnsmasq.8.gz

-- 感觉这个就足够了.很明显配置文件/etc/dnsmasq.conf与目录/etc/dnsmasq.d。
# rpm -qc dnsmasq
/etc/dnsmasq.conf

2.我需要配置的IP如下:
#SCAN IP
#192.168.200.101 xxxscan
#192.168.200.102 xxxscan
#192.168.200.103 xxxscan

--//仅仅3个scan-ip.

3.修改/etc/resolv.conf,加入名字服务器:
# cat /etc/resolv.conf
search localdomain
nameserver 192.168.100.78
nameserver 192.168.101.7

--也就是本机(192.168.100.78,这行要写在前面,我不知道为什么??),如果你存在别的dns服务器,可以在这里加入:

4.配置/etc/dnsmasq.conf文件:
# grep -v "^#" /etc/dnsmasq.conf | grep '^[a-zA-Z]'
conf-dir=/etc/dnsmasq.d

--仅仅1行,其他全是注解,注:如果改动建立做1个备份.
--我修改如下注解上面那行,加入:
# cat /etc/dnsmasq.conf
# conf-dir=/etc/dnsmasq.d
addn-hosts=/etc/dnsmasq.d/rachosts

5.建立/etc/dnsmasq.d/rachosts文件,包括全部需要解析的主机名.
# cat   /etc/dnsmasq.d/rachosts
192.168.200.101  xxxscan
192.168.200.102  xxxscan
192.168.200.103  xxxscan

--实际上步骤很简单就是包括1个全部机器的文本文件,加入addn-hosts=/etc/dnsmasq.d/rachosts这行在配置文件中.

6.启动dbsmasq:
# service dnsmasq start
Starting dnsmasq:          [  OK  ]

6.测试:
# nslookup xxxscan
Server:         192.168.100.78
Address:        192.168.100.78#53

Name:   xxxscan
Address: 192.168.200.103
Name:   xxxscan
Address: 192.168.200.101
Name:   xxxscan
Address: 192.168.200.102

# nslookup 192.168.200.101
Server:         192.168.100.78
Address:        192.168.100.78#53

101.200.168.192.in-addr.arpa    name = xxxscan.

# nslookup 192.168.200.102
Server:         192.168.100.78
Address:        192.168.100.78#53

102.200.168.192.in-addr.arpa    name = xxxscan.

# nslookup 192.168.200.103
Server:         192.168.100.78
Address:        192.168.100.78#53

103.200.168.192.in-addr.arpa    name = xxxscan.

# nslookup 127.0.0.1
Server:         192.168.100.78
Address:        192.168.100.78#53

1.0.0.127.in-addr.arpa  name = localhost.localdomain.

# nslookup localhost
Server:         192.168.100.78
Address:        192.168.100.78#53

Name:   localhost.localdomain
Address: 127.0.0.1

--//这样配置小型的dns简单多了,快捷简单实用。

7.其他机器仅仅需要配置:
# cat   /etc/resolv.conf
nameserver 192.168.100.78

--我参考了链接:http://www.oracle-base.com/articles/linux/dnsmasq-for-simple-dns-configurations.php
--按照他的说明,你什么都不要做,仅仅将主机列表写入/etc/hosts文件就ok了.我自己也测试1次确实这样.剩下仅仅启动dnsmasq服务.
--我觉得这个太合适小网络的配置了.根本无需了解dns细节.

目录
相关文章
|
1月前
|
域名解析 网络协议 Linux
使用 Webmin+bind9快速搭建私有DNS服务器
使用 Webmin+bind9快速搭建私有DNS服务器
132 1
|
6天前
|
Linux 网络安全 数据库
linux centos系统搭建samba文件服务器 NetBIOS解析 (超详细)
linux centos系统搭建samba文件服务器 NetBIOS解析 (超详细)
|
6天前
|
域名解析 存储 缓存
Linux中搭建DNS 域名解析服务器(详细版)
Linux中搭建DNS 域名解析服务器(详细版)
|
7天前
|
存储 弹性计算 固态存储
阿里云服务器配置选择指南,2024年全解析
阿里云服务器配置选择涉及CPU、内存、带宽和磁盘。个人开发者或中小企业推荐使用轻量应用服务器或ECS经济型实例,如2核2G3M配置,适合网站和轻量应用。企业用户则应选择企业级独享型ECS,如计算型c7、通用型g7,至少2核4G起,带宽建议5M,系统盘考虑SSD云盘或ESSD云盘以保证性能。阿里云提供了多种实例类型和配置,用户需根据实际需求进行选择。
|
13天前
|
网络协议 Windows
Windows Server 各版本搭建 DNS 服务器实现域名正反向解析
Windows Server 各版本搭建 DNS 服务器实现域名正反向解析
|
14天前
|
存储 缓存 网络协议
【专栏】理解并优化DNS设置对于提高网络速度至关重要
【4月更文挑战第28天】本文探讨了DNS服务器是否能加快网络访问速度。DNS负责将域名转换为IP地址,其查询时间、缓存机制和地理位置都影响网络速度。优化DNS配置,如选择快速的公共DNS服务、使用附近的服务器、确保设备正确配置和利用DNS缓存,都能有效提升网络体验。理解并优化DNS设置对于提高网络速度至关重要。
|
15天前
|
监控 负载均衡 网络协议
|
25天前
|
运维 监控 安全
服务器问题解析
服务器运营面临五大挑战:宕机、安全性问题、性能下降、数据备份恢复和网络问题。预防宕机需维护硬件、软件及备份;保障安全需强密码、安全补丁和防火墙;应对性能下降需监控分析并优化;数据备份要定期且完整;网络问题需与管理员合作解决。作为管理员,持续学习和改进以确保服务器稳定和数据安全。
|
1月前
|
存储 数据库
服务器数据恢复—服务器RAID5故障数据恢复解析
RAID5作为应用最广泛的raid阵列级别之一,在不同型号服务器中的RAID5出现故障后,处理方法也不同。 RAID5阵列级别是无独立校验磁盘的奇偶校验磁盘阵列,采用数据分块和独立存取技术,能在同一磁盘上并行处理多个访问请求,同时允许阵列中的任何一个硬盘出现故障。 实际案例中,raid5阵列最常出现的故障情况就是硬盘自行脱机,联机状态显示为DDD(Defunct Disk Drive,无效磁盘驱动器),硬盘出现物理故障或逻辑故障。
服务器数据恢复—服务器RAID5故障数据恢复解析
|
1月前
|
监控 负载均衡 网络协议
DNS服务器的搭建之初体验
通过这些步骤,你可以在初次搭建DNS服务器时获得基本的体验,了解如何为域名提供解析服务,促进网络的正常运行。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
46 7

相关产品

  • 云解析DNS
  • 推荐镜像

    更多