solaris11進行dns客戶端配置詳解

datapeng發表於2014-04-02

    今天,客戶在安裝sap的 bo系統時,出現問題,sap專家認為是該機器上沒有做dns的原因,需要加入到dns中去。現在把現場實施過程記錄下來,供大家參考

solaris10及之前,加入企業dns主要分為三步:
--1.建立resolv.conf檔案,加入dns伺服器地址  
--2.修改/etc/nsswitch.conf 
--3.建立/etc/defaultrouter檔案,加入閘道器地址

但到solaris11有了變化,不能這樣直接做,有些步驟是需要透過命令來做

1、透過編輯檔案nsswitch.conf,來配置NSSWITCH

1.1檢查當前的nsswitch

--檢查smf裡面的nsswitch情況

# svccfg -s svc:/system/name-service/switch listprop -l all config
config                      application site-profile          
config                      application manifest              
config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
config/default             astring     site-profile          files
config/default             astring     manifest              files
config/printer             astring     site-profile          "user files"
config/printer             astring     manifest              "user files"

--檢查原檔案的情況如下
# 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
ipnodes:        files
networks:       files
protocols:      files
rpc:    files
ethers: files
netmasks:       files
bootparams:     files
publickey:      files
netgroup:       files
automount:      files
aliases:        files
services:       files
printers:       user files
project:        files
auth_attr:      files
prof_attr:      files
tnrhtp: files
tnrhdb: files
sudoers:        files

1.2對nsswitch進行配置

注意,只需要編輯前面幾項,其編輯如下:

--編輯nsswitch檔案

# vi /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  ldap
group:  files  ldap
hosts:  files  dns
ipnodes:        files dns

--將我們剛才的配置匯入到SMF中去

這裡要說明一點是,SMF服務與核心配置服務的整合更加緊密,如命名服務等有關的,像domainname\nsswitch這些的內容基本也是在這裡面註冊的

# nscfg import -f svc:/system/name-service/switch:default

--檢查配置匯入情況
# svccfg -s svc:/system/name-service/switch listprop -l all config
config                      application site-profile          
config                      application manifest              
config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
config/default             astring     site-profile          files
config/default             astring     manifest              files
config/password            astring     admin                 "files  ldap"
config/group               astring     admin                 "files  ldap"
config/host                astring     admin                 "files  dns"
config/printer             astring     admin                 "user files"
config/printer             astring     site-profile          "user files"
config/printer             astring     manifest              "user files"

從結果上看,已經匯入了

1.3檢查nsswitch服務

--檢視服務本身的狀態
# svcs -a | grep swit
online         15:10:20 svc:/system/name-service/switch:default

--檢視依賴的服務,是否已啟動
# svcs -d svc:/system/name-service/switch
STATE          STIME    FMRI
disabled       15:13:10 svc:/system/name-service-cache:default
online         15:13:15 svc:/system/filesystem/root:default
online         15:13:16 svc:/system/name-service/upgrade:default
online         15:13:20 svc:/system/filesystem/usr:default
online         15:13:22 svc:/system/filesystem/minimal:default
online         15:13:22 svc:/milestone/unconfig:default
online         15:13:23 svc:/milestone/config:default
online         15:13:23 svc:/system/manifest-import:default
online         15:13:26 svc:/network/location:default

--把依賴的服務啟動起來
# svcadm enable svc:/system/name-service-cache

2、配置dns的客戶端

--在這時在,我們直接透過SMF命令來進行操作

# svccfg -s svc:/network/dns/client setprop config/domain= mytest.mydomain.local

--檢查配置後的結果
# svccfg -s svc:/network/dns/client listprop -l all config/domain
config/domain astring     admin                 mytest.mydomain.local

--配置域對應的ip地址

# svccfg -s svc:/network/dns/client setprop config/nameserver=net_address:'(172.18.88.8 172.18.88.9)'

--檢查配置後的結果
# svccfg -s svc:/network/dns/client listprop -l all config/nameserver
config/nameserver net_address admin                 172.18.88.8 172.18.88.9

# svccfg -s svc:/network/dns/client listprop -l all config
config                      application manifest              
config/value_authorization astring     manifest              solaris.smf.value.name-service.dns.client
config/domain              astring     admin                 mytest.mydomain.local
config/nameserver          net_address admin                 172.18.88.8 172.18.88.9

上面的步驟執行完成後,會在產生一個resolv.conf的檔案

# cat /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  mytest.mydomain.local
nameserver      172.18.88.8
nameserver      172.18.88.9

--把配置結果匯入到smf中去

# nscfg import -f svc:/network/dns/client:default

# svccfg -s svc:/network/dns/client listprop -l all config
config                      application manifest              
config/value_authorization astring     manifest              solaris.smf.value.name-service.dns.client
config/domain              astring     admin                 mytest.mydomain.local
config/nameserver          net_address admin                 172.18.88.8 172.18.88.9

--檢查與dns相關的服務
# svcs -a | grep dns
disabled        9:19:40 svc:/network/dns/client:default
disabled        9:19:46 svc:/network/dns/server:default
online          9:20:04 svc:/network/dns/multicast:default

--把client啟動起來
# svcadm enable svc:/network/dns/client

# svcs -a | grep dns
disabled        9:19:46 svc:/network/dns/server:default
online          9:20:04 svc:/network/dns/multicast:default
online          9:22:20 svc:/network/dns/client:default

--驗證配置的結果
# ping mytest.mydomain.local
mytest.mydomain.local is alive

至此,配置工作全部結束。但最後客戶仍然安裝不上,排除說與這個無關,白忙活了一下。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-1134872/,如需轉載,請註明出處,否則將追究法律責任。

相關文章