[HOLER]实战solaris之域名系统文件配置

[实战solaris之域名系统文件配置]
 
一、摘要
实战solaris之域名系统文件配置,配置/etc/ nsswitch.conf 、resolv.conf 、hosts
使服务器能够访问(ping)域名。
 
二、正文
#ping www.163.com
no answer from www.163.com
1.配置nsswitch.conf文件,主要是hosts项,如下所示:
#vi /etc/nsswitch.conf
#
# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
passwd:      files
group:       files
hosts:      files       dns
ipnodes:     files
networks:    files
protocols: files
rpc:         files
ethers:      files
netmasks:    files
bootparams: files
publickey: files
# At present there isn't a 'files' backend for netgroup; the system will
#    figure it out pretty quickly, and won't use netgroups at all.
netgroup:    files
automount: files
aliases:     files
services:    files
sendmailvars:    files
printers:        user files
 
auth_attr: files
prof_attr: files
project:     files
 
 
hosts:      files       dns
/*此处配置说明先用files后用dns;files配置见/etc/hosts;dns配置见/etc/resolv.conf*/
 
2.配置hosts文件
    hosts配置本地域名解析。
#vi /etc/hosts
#
# Internet host table
#
127.0.0.1        localhost
218.25.254.24    loghost
192.168.4.102    ora-vp
 
3.配置resolv.conf文件
     /etc/resolv.conf配置远程域名解析服务器,如下202.96.64.68为域名服务器。
#vi /etc/resolv.conf
nameserver       202.96.64.68
 
如上配置,当ping loghost时, 系统首先在 /etc/hosts 查找,由于nsswitch.conf文件中 hosts 项已配置,找到对应地址 218.25.254.24 ;当 ping www.163.com 时,由于本地 hosts 没有找到匹配项,所以系统会访问resolv.conf中配置的域名服务器解析。
holer
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值