在Solaris中配置DNS

一般来讲在安装的时候就应该已经把nameserver相关的东西都配置好了。
不过我安装的时候配错了。。。

这是最简单的DNS静态指定IP的配置方法,目的是让「ping www.google.com」这个命令能ping通。
需要修改或者添加以下两个文件:
/etc/resolv.conf
/etc/nsswitch.conf

这里默认网卡是被安装并且被正确配置的。

/etc/resolv.conf

#为nameserver指定IP地址,这里指定的是我的路由器地址
#如果这个文件不存在,新建一个,然后加上这一行
nameserver 192.168.11.1


保存之后试试「nslookup www.google.com」,如果能找到网址就说明配对了

# nslookup www.google.com
Server:         192.168.11.1
Address:        192.168.11.1#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 66.249.89.99
Name:   www.l.google.com
Address: 66.249.89.104


/etc/nsswitch.conf

#找到 hosts 这一行,在后面追加 dns
hosts:      files dns


保存后外面的域名应该就可以ping通了

# ping www.gogle.com
www.gogle.com is alive

你可能感兴趣的:(Solaris)