Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 備份 ifcfg-eth0 導致網卡無法綁定 IP?Oracle Linux 5.7 實戰排查

編輯:關於 Linux

在 Oracle Linux 5.7 修改 /etc/sysconfig/network-scripts/ifcfg-eth0 前備份為 ifcfg-eth0_bak,卻導致網卡無法綁定靜態 IP。經排查發現,備份檔殘留 BOOTPROTO=dhcp 且 ONBOOT=yes,啟動時 network 服務嘗試同時啟動 eth0 與 eth0_bak 造成衝突。解法:刪除或重命名備份檔(非 ifcfg-* 命名),重啟網路服務即可恢復正常。

問題重現

# cp ifcfg-eth0 ifcfg-eth0_bak
# vi ifcfg-eth0  # 改為 static IP
# service network restart  # 失敗,IP 未綁定

根因分析

network 啟動腳本會掃描 ifcfg-* 所有檔案,ifcfg-eth0_bak 符合模式被當作第二張網卡處理,導致 eth0 與 eth0_bak 衝突。

正確備份姿勢

# cp ifcfg-eth0 ifcfg-eth0.bak.20240101  # 不符合 ifcfg-* 模式
# 或移至其他目錄
mkdir -p ~/backup && cp ifcfg-eth0 ~/backup/

網路腳本檔案命名極其敏感,備份務必避開 ifcfg-* 模式,防止啟動衝突。

Copyright © Windows教程網 All Rights Reserved