Centos-啟動network報錯RTNETLINK answers: File exists解決方案

來源:互聯網
上載者:User

最好串連到console,而不要在SSH下面進行,因為可能導致網路中斷,到時候你就連不到機器了
chkconfig --level 35 network on
chkconfig --level 0123456 NetworkManager off

service NetworkManager stop
service network stop

service network start
如果還不行,重啟系統看看

service network start 出現RTNETLINKanswers:Fileexists錯誤解決 或者
/etc/init.d/network start 出現RTNETLINKanswers:Fileexists錯誤解決 (呵呵,其實兩者是等效的,其實前者執行的就是這個命令)。
在centos下出現該故障的原因是啟動網路的兩個服務有衝突:/etc/init.d/network 和 /etc/init.d/NetworkManager這兩個服務有衝突吧。
從根本上說是NetworkMaganager(NM)的帶來的衝突,停用NetworkManager即可解決。重啟即可。
1.切換到root賬戶,並用chkconfig命令查看network 和 NetworkManager兩個服務的開機啟動配置情況;
[wzb@embedded ~]$ su - root
口令:
[root@embedded ~]# chkconfig --list network
network 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
[root@embedded ~]# chkconfig --list NetworkManager
NetworkManager 0:關閉 1:關閉 2:關閉 3:啟用 4:關閉 5:關閉 6:關閉
[root@embedded ~]#
2.停用NetworkManager,開機時,不讓其啟動:
[root@embedded ~]# chkconfig --level123456 NetworkManager off
3.啟用network服務,開機啟動。在3、4、5使用者模式下;
[root@embedded ~]# chkconfig --level345 network on
或者 通過編輯 vi /etc/rc.d/rc.local檔案在最後添加一行:/etc/init.d/network start
[root@embedded ~]# vi /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
/etc/init.d/network start
4.停用NetworkManager.,通過重啟如果是遠端話,比較安全。
[root@embedded ~]# reboot
注意:如果不是遠端話也可以通過如下命令解決,不過上述配置將在下次重啟後,生效。
[root@embedded ~]# /etc/init.d/NetworkManager stop //若果是遠端的話,這將中斷你的網路,即不能進行遠端控制了(相當於自殺)
[root@embedded ~]# /etc/init.d/NetworkManager status
NetworkManager 已停
[root@embedded ~]# /etc/init.d/network stop //若果是遠端的話,這將中斷你的網路,即不能進行遠端控制了(相當於自殺)
[root@embedded ~]# /etc/init.d/network start
彈出環回介面: [確定]
彈出介面 eth0: [確定]
[root@embedded ~]#
5.測試網路: ping http://www.baidu.com/
如果能夠ping通的話,說明網路已經錯誤了。
如果ping不通的話,說明網路dns配置有問題,既然遠程連上你的主機,說明主機的網路沒問題,而你用的是ip。而你的遠程主機ping網域名稱ping不通,當時你若嘗試ping ip話也是能ping通的,這就更進一步說明,是dns配置的問題。這都network Manager帶來的問題,使DNS的設定檔 /etc/resolv.conf 為預設狀態,即沒有佈建網域名伺服器;
可以通過編輯 vi /etc/resolv.conf 檔案:
以google的網域名稱伺服器為例:在最後添加兩句:
search google.com
nameserver 8.8.8.8
儲存/etc/resolv.conf 並退出。
再次ping www.baidu.com 發現成功了。

6.總結: 問題產生的原因:是兩個配置網路的服務的衝突造成的。卸載 NetworkManager這個罪魁禍首,是根本。
你兩次執行 /etc/init.d/network start 同樣會產生上述問題的癥狀。正常的情況下,在網路開啟的狀態下,應該用 /etc/init.d/network restart.
(可能網路的設定檔 ip 、dns的設定檔,是這兩個佈建服務的臨界資源吧,這可能是造成衝突的主要原因)。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.