公司RedHat5.5系統,配置了/etc/resolv.conf文件後重啟網絡服務,此文件內容就被復寫了。經過查看紅帽官方文檔,給出以下解決辦法。https://access.redhat.com/site/solutions/61921
問題主要原因是啟用了networkmanager服務,個人覺得是此服務接管了原有的網絡設置。
解決辦法是配置networkmanager的配置文件。
1.創建一個腳本。vim /etc/NetworkManager/dispatcher.d/15-resolv
內容為:
# vim /etc/NetworkManager/dispatcher.d/15-resolv
#!/bin/bash
#
# Description : script to override default resolv.conf file
# with customized file.
cp -f /etc/resolv.conf.custom /etc/resolv.conf
2.設置文件權限
# chmod u+x /etc/NetworkManager/dispatcher.d/15-resolv
3.創建一個文件 vi /etc/resolv.conf.custom
nameserver xx.xx.xx.xx
options single-request-reopen
4.重啟服務
service NetworkManager restart
更多RedHat相關信息見RedHat 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=10