Solaris 11 DNS Client 設定
檢查現有的DNS Client 設定root@s11:~# svccfg -s network/dns/client listprop config
config application
config/value_authorization astring solaris.smf.value.name-service.dns.client
更新 DNS Client 設定
root@s11:~# svccfg -s network/dns/client setprop config/nameserver = net_address: "(168.95.1.1 8.8.8.8)"
root@s11:~# svccfg -s network/dns/client setprop config/domain = astring: test.com.tw
root@s11:~# svccfg -s network/dns/client setprop config/search = astring: '("test.com.tw" "test1.com.tw")'
設定名稱解析順序
root@s11:~# svccfg -s name-service/switch setprop config/ipnodes = astring: '("files dns")'
root@s11:~# svccfg -s name-service/switch setprop config/host = astring: '("files dns")'
檢視DNS Client變更的設定
root@s11:~# svccfg -s network/dns/client listprop config
config application
config/value_authorization astring solaris.smf.value.name-service.dns.client
config/nameserver net_address 168.95.1.1 8.8.8.8
config/domain astring test.com.tw
config/search astring "test.com.tw" "test1.com.tw"
root@s11:~#
檢視nsswitch變更的設定
root@s11:~# svccfg -s name-service/switch listprop config
config application
config/default astring files
config/value_authorization astring solaris.smf.value.name-service.switch
config/printer astring "user files"
config/ipnodes astring "files dns"
config/host astring "files dns"
root@s11:~# svcadm enable dns/client
root@s11:~# more /etc/resolv.conf (此時檢視/etc/resolv.conf並不存在)
/etc/resolv.conf: No such file or directory
root@s11:~# nscfg export svc:/network/dns/client:default
root@s11:~# more /etc/resolv.conf (此時檢視/etc/resolv.conf已建立)
#
# _AUTOGENERATED_FROM_SMF_V1_
#
# WARNING: THIS FILE GENERATED FROM SMF DATA.
# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.
# See resolv.conf(4) for details.
domain test.com.tw
search test.com.tw test1.com.tw
nameserver 168.95.1.1
nameserver 8.8.8.8
root@s11:~#
root@s11:~# svcadm refresh name-service/switch
root@s11:~# cat /etc/nsswitch.conf
#
# _AUTOGENERATED_FROM_SMF_V1_
#
# WARNING: THIS FILE GENERATED FROM SMF DATA.
# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.
# See nsswitch.conf(4) for details.
passwd: files
group: files
hosts: files dns
ipnodes: files dns
networks: files
protocols: files
root@s11:~# nscfg import -f name-service/switch:default
root@s11:~# nscfg import -f dns/client:defaul
此設定reboot 設定會清除
I. DNS client setup
1. 設定network/dns/client SMF 服務
# svccfg -s
network/dns/client
svc:/network/dns/client>
setprop config/search = astring: ("test.com.tw""test1.com.tw")
svc:/network/dns/client>
setprop config/nameserver = net_address: (168.95.1.1 8.8.8.8)
svc:/network/dns/client>
exit
2. 開啟 DNS client 服務 (第一次使用需要設定)
#svcadm enable -r
dns/client
3.重啟/更新 DNS client 服務 (當設定完成或是有任何更新時)
#svcadm refresh
dns/client
#svcadm restart
dns/client
4. 檢查設定完成後/etc/resolv.conf 是否有更新(出現紅字部份)
# more /etc/resolv.conf
#
# _AUTOGENERATED_FROM_SMF_V1_
#
# WARNING: THIS FILE GENERATED FROM SMF
DATA.
# DO NOT EDIT THIS
FILE. EDITS WILL BE LOST.
# See resolv.conf(4) for details.
search
cht.com.tw cht1.com.tw
nameserver
xx.xx.xx.xx
nameserver
yy.yy.yy.yy
---
II. 設定Name service
switch 使用 DNS
1. 設定 system/name-service/switch SMF 服務
# svccfg -s system/name-service/switch
svc:/system/name-service/switch>
setprop config/host = astring: "files dns"
svc:/system/name-service/switch>end
2. .重啟/更新 name-service/switch 服務
#svcadm refresh name-service/switch
#svcadm restart
name-service/switch
3. 檢查設定完成後/etc/nsswitch.conf檔,出現紅字部份的更新)
# more /etc/nsswitch.conf
#
# _AUTOGENERATED_FROM_SMF_V1_
#
# WARNING: THIS FILE GENERATED FROM SMF
DATA.
# DO NOT EDIT THIS
FILE. EDITS WILL BE LOST.
# See nsswitch.conf(4) for details.
passwd: files
group: files
hosts: files
dns
ipnodes:
files dns
.
最後nslookup試試看DNS是否解析