1. 程式人生 > >Ubuntu 18.10 使用VMware克隆後,克隆後的機器再手動更改interfaces配置檔案後無法啟動網路的解決辦法

Ubuntu 18.10 使用VMware克隆後,克隆後的機器再手動更改interfaces配置檔案後無法啟動網路的解決辦法

克隆過程就略過了

配置interfaces

[email protected]:~# vim /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ens33
iface ens33 inet static
address 192.168.244.11
netmask 255.255.255.0
gateway 192.168.244.2

儲存之後重啟網路服務會拋錯

[email protected]
:~# service networking restart Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.

折騰了一會,從熱心的網友的經驗中找到了解決辦法:

[email protected]:~# vim /etc/NetworkManager/NetworkManager.conf 
[main]
plugins
=ifupdown,keyfile [ifupdown] managed=false #手動更改過interfaces配置檔案後,這裡會變成false,將其改為true,然後使用service network-manager restart重啟後,使用ifconfig可以看到手動設定的IP,且網路恢復正常(這種方法針對Ubuntu Desktop,server中暫時不清楚是否可行?) [device] wifi.scan-rand-mac-address=no

這裡雖然恢復正常了,但是不明白的是,在centOS和RHEL系統中,一般這個Network-Manager在做實驗的時候是關閉的,也沒有影響到網路,換到Ubuntu系統中就要啟動它,有點不明白。

參考:https://blog.csdn.net/qq_34706955/article/details/78051075?locationNum=10&fps=1