注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

骐骥一跃

日积跬步 业精于勤荒于嬉

 
 
 

日志

 
 

[原创]FreeBSD学习笔记05-域名解析  

2008-06-12 15:14:45|  分类: Unix/Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

( 声明:原创文章,未经授权,不得转载。作者:印第安 http://blog.kysf.net ) 

 

 

1.9. HOSTS AND RESOLV.CONF

The hosts and resolv.conf files are used to control how FreeBSD performs DNS lookups. A DNS lookup is like calling a telephone operator: You give the operator a person's name and she gives you a phone number in return. For example, if a web page like http://www.google.com is requested, FreeBSD (by default) first consults the hosts file (/etc/hosts), then the DNS servers specified in resolv.conf in order to translate www.google.com into an IP address like 66.102.7.99.

Let's take a closer look at each of these files and see how to set them up.

1.9.1. hosts

The hosts file resolves (translates) hostnames to IP addresses. At minimum, the hosts file should be modified to reflect your system's domain name and hostname.

Open the hosts file in a text editor:

# ee /etc/hosts


Your hosts file (~14) should look like this (replace example.com with your domain name, host.example.com with your hostname, and 192.168.1.11 with your IP address):

::1               localhost localhost.example.com  127.0.0.1         localhost localhost.example.com  192.168.1.11      host.example.com


Save and exit.

Settings in this file only affect the local system. The hosts file supplies basic hostname resolution for daemons and other system processes. If you need to provide DNS services, you'll need to use a DNS server. (See "ISC BIND DNS Server 9.4.2" for more information.)

1.9.2. resolv.conf

The resolv.conf file contains the IP addresses of the DNS servers that your system will query when trying to resolve any hostname whose IP address is not found in the hosts file. The addresses in this file are automatically set if you chose DHCP to configure your network adapter during the initial FreeBSD installation. To set this file manually, open it:

# ee /etc/resolv.conf


The resolv.conf file should look something like this, where example.com is your domain name, 206.12.29.11 is the IP address of the DNS server, and 192.168.1.11 is the IP address of the backup DNS server (both IP addresses are provided by your ISP):

domain example.com  nameserver 206.12.29.11  nameserver 192.168.1.11

 

注:这个是针对 Unix/Linux 客户端配置的,即客户端的 OS 是 Unix/Linux 才需要这样配置,目的是让客户端可以解析 host.example.com ,类似 Windows 下的 hosts 文件。

 

          印第安

      2009年4月6日11:47:18 更新

 

 

( 声明:原创文章,未经授权,不得转载。作者:印第安 http://blog.kysf.net

  评论这张
 
阅读(1304)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018