Linux??????/etc/hosts??hostName????????Ч
???????????? ???????[ 2016/11/10 10:38:11 ] ?????????????? Linux
????1??Linux??????????/etc/hosts??hostName????????Ч???
????Linux??????????/etc/hosts??hostName????????Ч?? ????????/etc/hosts?????????£?
????#192.68.1.10 message.xxx.com
????192.68.1.11 message.xxx.com
????????ping
????message.xxx.com???????192.68.1.10??
???????2??????????
????1). ????????????????????????????????Щ?????????????????????????????
????2). ???/etc/sysconfig/network???????HOSTNAME????????????????£?
????NETWORKING=yes
????HOSTNAME=host1
???????????????????
????service network restart (??????/etc/init.d/network) 3).
????????????????????????????????????????dns??????????
??????nscd???????? ps -ef|grep nscd
?????????Linux nscd ??????? /etc/init.d/nscd stop
????2??Linux??DNS
????linux?????????dns???????????dns?????????????????????????NSCD(name service cache daemon).
????nscd???????????passwd group hosts????????????????????????/etc/passwd?? /etc/hosts ?? /etc/resolv.conf?????????????棬?????????????????????????????????????涼?????????????TTL??.
?????????
????yum install nscd
??????????????/etc/nscd.conf??????dns???棬????????
????enable-cache hosts yes??
?????????????nscd ????????dns ???棬?????????dns??????
???????? ?????? ??????? service nscd start | stop | restart
????nscd???????
?????????/etc/nscd.conf?????????????????????п?????????DNS cache??
????enable-cache hosts yes
????????????????????????£?
[root@iZ2571ykq ~]# cat /etc/nscd.conf
#logfile /var/log/nscd.log
threads 6
max-threads 128
server-user nscd
debug-level 5
paranoia no
enable-cache passwd no
enable-cache group no
enable-cache hosts yes
positive-time-to-live hosts 5
negative-time-to-live hosts 20
suggested-size hosts 211
check-files hosts yes
persistent hosts yes
shared hosts yes
max-db-size hosts 33554432
??????????????????£?
????logfile debug-file-name????????????д??????????
????debug-level value?????????????????
????threads number????????????????????????????????5??????
????server-user user???????????????nscd?????????????У??????????root???????????????????????????棨-S??????????????????
????enable-cache service <yes|no>??????????????? ???? ???檔
????positive-time-to-live service value?????? service ???????????????????????????????TTL?????????? Value ???????λ???????????????????????????????????????????????????????????
????negative-time-to-live service value?????? service ??????????и??????????????????TTL?????????? Value ???????λ??????????????????????е?uid?????ID????????????root?????linux ???????????????е?????????????????????????С????????????????????
????suggested-size service value???????????б???С?? value ???????????????????Ч????
????check-files service <yes|no>?????????ü????????? ???? ???????????Щ????? /etc/passwd?? /etc/group?? ???/etc/hosts??
????nscd ????????
????nscd????DB?????/var/db/nscd???
????nscd -g ????????
??????? nscd???棺
????nscd -i passwd
????nscd -i group
????nscd -i hosts
????????????????????????nscd????
????rm -f /var/db/nscd/hosts
????service nscd restart
???????????????nscd ????
????service nscd stop??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11