linux 服务器本机hosts文件配置了域名解析不生效 |
您所在的位置:网站首页 › host文件修改域名到域名 › linux 服务器本机hosts文件配置了域名解析不生效 |
问题现象: 已经在hosts文件配置好了域名,发现配置的不生效 [root@reg ta]# head /etc/hosts 127.0.0.1 localhost 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@reg ta]# ping localhost ping: localhost: Name or service not known解决: 发现nsswitch.conf的配置文件hosts属性冒号是中文的,改回英文的就可以了 #旧的 [root@iZuf6hd51mz5z31be327a7Z ~]# cat /etc/nsswitch.conf|grep hosts #hosts: db files nisplus nis dns hosts: files dns myhostname #新的 [root@iZuf6hd51mz5z31be327a7Z ~]# cat /etc/nsswitch.conf|grep hosts #hosts: db files nisplus nis dns hosts: files dns myhostname效果: [root@iZuf6hd51mz5z31be327a7Z ~]# ping localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.029 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.019 ms
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |