码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu14.04本地域名服务器配置

时间:2015-07-29 00:28:10      阅读:309      评论:0      收藏:0      [点我收藏+]

标签:

dnsmasq

1 修改dnsmasq配置文件/etc/dnsmasq.conf

# Change this line if you want dns to get its upstream servers from somewhere other that /etc/resolv.conf

# 如果你想让dns从某个地方(而不是/etc/resolv.conf)获得上游服务

resolv-file=/etc/resolv.dnsmasq ##从/etc/resolv.dnsmasq文件中获得上游DNS服务的IP地址

?

# By default, dnsmasq will send queries to any of the upstream servers it knows about

# 默认dnsmasq会把查询请求发送到它知道的任意一个上游DNS服务器

# and tries to favour servers to are known to be up.

# Uncommenting this forces dnsmasq to try each query with each server strictly in the order they appear in /etc/resolv.conf

# 解注该行,强制dnsmasq严格以/etc/resolv.conf文件中每个服务的出现顺序尝试查询

strict-order

?

# Or which to listen on by address (remember to include 127.0.0.1 if you use this.)

listen-address=192.168.145.131,127.0.0.1

?

listen-address=127.0.0.1,表示这个 dnsmasq 本机自己使用有效。

注意:如果你想让本机所在的局域网的其它电脑也能够使用上Dnsmasq,应该把本机的局域网IP加上去:listen-address=192.168.1.123,127.0.0.1

?

2 指定在本地缓存中解析域名

grid_hd@hadoop1:~$ cat /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

nameserver 127.0.0.1

?

3 配置真正的DNS域名服务器地址

grid_hd@hadoop1:~$ cat /etc/resolv.dnsmasq

nameserver 192.168.145.2

nameserver 8.8.8.8

nameserver 8.8.4.4

?

?

?

/etc/rc.local脚本会在每个多用户运行级别启动结束后运行

grid_hd@hadoop1:~$ sudo cat /etc/rc.local

#!/bin/sh -e

#

# rc.local

#

# This script is executed at the end of each multiuser runlevel.

# Make sure that the script will "exit 0" on success or any other value on error.

#

# In order to enable or disable this script just change the execution bits.

#

# By default this script does nothing.

?

dnsmasq -r /etc/resolv.dnsmasq

?

exit 0

?

?

=====

-r, --resolv-file=<file>

Read the IP addresses of the upstream nameservers from <file>, instead of /etc/resolv.conf.

For the format of this file see resolv.conf(5).

The only lines relevant to dnsmasq are nameserver ones.

Dnsmasq can be told to poll more than one resolv.conf file, the first file name specified overrides the default, subsequent ones add to the list.

This is only allowed when polling; the file with the currently latest modification time is the one used.

ubuntu14.04本地域名服务器配置

标签:

原文地址:http://www.cnblogs.com/asnjudy/p/4684578.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!